Created
April 24, 2024 14:10
-
-
Save jamesmcroft/ec2b945bda3db96e24e3390b9889d7fb to your computer and use it in GitHub Desktop.
Example of how to include the logprobs and top_logprobs properties in an Azure OpenAI request using the JavaScript SDK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const optionExtras = { | |
logprobs: true, | |
top_logprobs: 3, | |
}; | |
const result = await client.getChatCompletions( | |
deploymentId, | |
[ | |
{ | |
role: "system", | |
content: | |
"You are an AI assistant that splits text, classifies it into categories, and returns the response as structured JSON objects.", | |
}, | |
{ | |
role: "user", | |
content: | |
"Classify the following text in the following categories: 'top_priority', 'high_priority', 'medium_priority', 'low_priority'.", | |
}, | |
{ role: "user", content: text }, | |
], | |
{ | |
maxTokens: 4096, | |
temperature: 0.1, | |
topP: 0.1, | |
...optionExtras, | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment