azure-openai
For azure-openai
, we provide a client that can be used to interact with the OpenAI API hosted on Azure using the /chat/completions
endpoint.
Example:
api_version
is required. Azure will return not found if the version is not specified.
The options are passed through directly to the API, barring a few. Here’s a shorthand of the options:
Non-forwarded options
Will be injected via the header API-KEY
. Default: env.AZURE_OPENAI_API_KEY
API-KEY: $api_key
The base URL for the API. Default: https://${resource_name}.openai.azure.com/openai/deployments/${deployment_id}
May be used instead of resource_name
and deployment_id
.
See the base_url
field.
See the base_url
field.
The default role for any prompts that don’t specify a role. Default: system
We don’t have any checks for this field, you can pass any string you wish.
Will be passed via a query parameter api-version
.
Additional headers to send with the request.
Example:
Which role metadata should we forward to the API? Default: []
For example you can set this to ["foo", "bar"]
to forward the cache policy to the API.
If you do not set allowed_role_metadata
, we will not forward any role metadata to the API even if it is set in the prompt.
Then in your prompt you can use something like:
You can use the playground to see the raw curl request to see what is being sent to the API.
Whether the internal LLM client should use the streaming API. Default: true
Then in your prompt you can use something like:
Forwarded options
BAML will auto construct this field for you from the prompt
BAML will auto construct this field for you based on how you call the client in your code
For all other options, see the official Azure API documentation.