Skip to content

Instantly share code, notes, and snippets.

@jamesmcroft
Created April 24, 2024 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmcroft/ec2b945bda3db96e24e3390b9889d7fb to your computer and use it in GitHub Desktop.
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
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