You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I've been reading the previous pull requests and found that #916 has been deprecated in favor of #938 which calls structured outputs using tool call by setting strict to True. In theory this is great for compatibility with previous models, however, as reported in #742 , tool/function calls doesn't output logprobs. Here's an example:
importopenaiimportjsonopenai_client=openai.OpenAI()
completion=openai_client.chat.completions.create(
model="gpt-4o-mini",
tools=[
{
"type": "function",
"function": {
"name": "ExtractUser",
"description": "Correctly extracted `ExtractUser` with all the required parameters with correct types",
"parameters": {
"properties": {
"name": {"title": "Name", "type": "string"},
"age": {"title": "Age", "type": "integer"},
},
"required": ["age", "name"],
"type": "object",
},
},
}
],
tool_choice={"type": "function", "function": {"name": "ExtractUser"}},
logprobs=True,
messages=[
{"role": "user", "content": "Extract Jason is 25 years old"},
],
)
print(completion.choices[0].logprobs)
# Output: ChoiceLogprobs(content=None, refusal=None)
While using the native structured output parser from OpenAI will provide logprobs:
Is your feature request related to a problem? Please describe.
I've been reading the previous pull requests and found that #916 has been deprecated in favor of #938 which calls structured outputs using tool call by setting strict to True. In theory this is great for compatibility with previous models, however, as reported in #742 , tool/function calls doesn't output logprobs. Here's an example:
While using the native structured output parser from OpenAI will provide logprobs:
Describe the solution you'd like
Continue #916
Describe alternatives you've considered
Using the native structured outputs from open ai client (
client.beta.chat.completions.parse
)The text was updated successfully, but these errors were encountered: