Helicone can be seamlessly integrated with your Azure-OpenAI deployment. This integration requires no additional code changes beyond importing the OpenAI package with Helicone.
MODEL OVERRIDE When using Azure, the model may sometimes display differently than expected. We have implemented a series of logic to parse out the model, but the returned body of the model can be inconsistent in most cases.
Helicone-Model-Override: [MODEL_NAME]
Click here to learn more about model override
Python Node.js Python w/package LangChain JS LangChain cURL Please ensure to include the ‘api-version’ in all of your requests.
Congratulations! Your Azure OpenAI requests are now configured to log results to Helicone.
Please ensure to include the ‘api-version’ in all of your requests.
Congratulations! Your Azure OpenAI requests are now configured to log results to Helicone.
Please ensure to include the ‘api-version’ in all of your requests.
from helicone.openai_proxy import openai
openai.api_type = "azure"
openai.api_base = "https://[YOUR_AZURE_DOMAIN].openai.azure.com"
openai.api_version = "2023-03-15-preview"
openai.api_key = YOUR_AZURE_API_KEY
response = openai.ChatCompletion.create(
engine = 'gpt-35-turbo' ,
messages = [{
'role' : 'user' ,
'content' : "Hello World!"
}],
max_tokens = 15 ,
)
const model = new ChatOpenAI ({
azureOpenAIApiKey: "[AZURE_OPENAI_API_KEY]" ,
azureOpenAIApiDeploymentName: "openai/deployments/gpt-35-turbo" ,
azureOpenAIApiVersion: "2023-03-15-preview" ,
azureOpenAIBasePath: "https://oai.helicone.ai" ,
configuration: {
organization: "[organization]" ,
baseOptions: {
headers: {
"Helicone-Auth" : `Bearer ${ heliconeApiKey } ` ,
"Helicone-OpenAI-Api-Base" :
"https://[YOUR_AZURE_DOMAIN].openai.azure.com" ,
},
},
},
});
from langchain.chat_models import AzureChatOpenAI
helicone_headers = {
"Helicone-Auth" : f "Bearer { helicone_api_key } " ,
"Helicone-OpenAI-Api-Base" :
"https://<model_name>.openai.azure.com/"
}
self .model = AzureChatOpenAI(
openai_api_base = "https://oai.helicone.ai" ,
deployment_name = "gpt-35-turbo" ,
openai_api_key =< AZURE_OPENAI_API_KEY > ,
openai_api_version = "2023-05-15" ,
openai_api_type = "azure" ,
max_retries = max_retries,
headers = helicone_headers,
** kwargs,
)
curl --request POST \
--url https://oai.helicone.ai/openai/deployments/DEPLOYMENTNAME/chat/completions?api-version=[API_VERSION] \
--header 'Helicone-Auth: Bearer [HELICONE_KEY]' \
--header 'Helicone-OpenAI-Api-Base: https://[AZUREDOMAIN].openai.azure.com' \
--header 'api-key: [AZURE_API_KEY]' \
--header 'content-type: application/json' \
--data '{
"messages": [
{
"role": "user",
"content": "Answer in one word"
}],
"max_tokens": 800,
"temperature": 1,
"model": "gpt-3.5-turbo-0613"
}'