fix: OpenAI spec cleanup for assistant requests

Some of our multi-turn verification tests were failing because I had
accidentally marked content as a required field in the OpenAI chat
completion request assistant messages, but it's actually optional. It
is required for messages from other roles, but assistant is explicitly
allowed to be optional.

Similarly, the assistant message tool_calls field should default to None
instead of an empty list.

These two changes get the openai-llama-stack verification test back to
100% passing, just like it passes 100% when not behind Llama Stack.

Signed-off-by: Ben Browning <bbrownin@redhat.com>
This commit is contained in:
Ben Browning 2025-04-15 20:54:16 -04:00
parent b5a9ef4c6d
commit a411746df3
3 changed files with 3 additions and 5 deletions

View file

@ -8891,8 +8891,7 @@
}, },
"additionalProperties": false, "additionalProperties": false,
"required": [ "required": [
"role", "role"
"content"
], ],
"title": "OpenAIAssistantMessageParam", "title": "OpenAIAssistantMessageParam",
"description": "A message containing the model's (assistant) response in an OpenAI-compatible chat completion request." "description": "A message containing the model's (assistant) response in an OpenAI-compatible chat completion request."

View file

@ -6097,7 +6097,6 @@ components:
additionalProperties: false additionalProperties: false
required: required:
- role - role
- content
title: OpenAIAssistantMessageParam title: OpenAIAssistantMessageParam
description: >- description: >-
A message containing the model's (assistant) response in an OpenAI-compatible A message containing the model's (assistant) response in an OpenAI-compatible

View file

@ -526,9 +526,9 @@ class OpenAIAssistantMessageParam(BaseModel):
""" """
role: Literal["assistant"] = "assistant" role: Literal["assistant"] = "assistant"
content: OpenAIChatCompletionMessageContent content: Optional[OpenAIChatCompletionMessageContent] = None
name: Optional[str] = None name: Optional[str] = None
tool_calls: Optional[List[OpenAIChatCompletionToolCall]] = Field(default_factory=list) tool_calls: Optional[List[OpenAIChatCompletionToolCall]] = None
@json_schema_type @json_schema_type