This commit is contained in:
Luis Tomas Bolivar 2025-10-03 17:56:55 +02:00 committed by GitHub
commit 8486f861bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 10 additions and 64 deletions

View file

@ -746,15 +746,7 @@ class OpenAIResponseInputFunctionToolCallOutput(BaseModel):
OpenAIResponseInput = Annotated[
# Responses API allows output messages to be passed in as input
OpenAIResponseOutputMessageWebSearchToolCall
| OpenAIResponseOutputMessageFileSearchToolCall
| OpenAIResponseOutputMessageFunctionToolCall
| OpenAIResponseInputFunctionToolCallOutput
| OpenAIResponseMCPApprovalRequest
| OpenAIResponseMCPApprovalResponse
|
# Fallback to the generic message type as a last resort
OpenAIResponseMessage,
OpenAIResponseOutput | OpenAIResponseInputFunctionToolCallOutput | OpenAIResponseMCPApprovalResponse,
Field(union_mode="left_to_right"),
]
register_schema(OpenAIResponseInput, name="OpenAIResponseInput")

View file

@ -125,7 +125,9 @@ class StreamingResponseOrchestrator:
while True:
# Text is the default response format for chat completion so don't need to pass it
# (some providers don't support non-empty response_format when tools are present)
response_format = None if self.ctx.response_format.type == "text" else self.ctx.response_format
response_format = (
None if getattr(self.ctx.response_format, "type", None) == "text" else self.ctx.response_format
)
completion_result = await self.inference_api.openai_chat_completion(
model=self.ctx.model,
messages=messages,