In certain scenarios, responses from providers like Perplexity may include additional fields
that do not directly correspond to OpenAI fields. To retrieve these fields, use one of the following methods:
- Python SDK: Set the parameter
strict_open_ai_compliance=false when initializing the Obiguard client.
- Node SDK: Set the parameter
strictOpenAiCompliance: false when initializing the Obiguard client.
- HTTP Requests: Include the header
x-obiguard-strict-open-ai-compliance: false in your request.
By default, Obiguard Python and Node SDKs have strict_open_ai_compliance set to false.
Examples
Python SDK
OpenAI Python
cURL
from obiguard import Obiguard
client = Obiguard(
provider='openai',
base_url='https://gateway.obiguard.ai/v1',
obiguard_api_key='vk-obg***', # Your Obiguard virtual key here
strict_open_ai_compliance=False,
)
response = client.chat.completions.create(
messages = [{ "role": 'user', "content": 'Say this is a test' }],
model = "Qwen/Qwen2.5-32B-Instruct" # The LLM model tied to the virtual key
)