From f7b6d7f0451d47e7ed35dcf3b47217fc3fa770c4 Mon Sep 17 00:00:00 2001 From: Shabana Baig <43451943+s-akhtar-baig@users.noreply.github.com> Date: Mon, 20 Oct 2025 15:33:59 -0400 Subject: [PATCH] Handle review comments --- docs/static/deprecated-llama-stack-spec.html | 24 +------- docs/static/deprecated-llama-stack-spec.yaml | 12 +--- docs/static/llama-stack-spec.html | 24 +------- docs/static/llama-stack-spec.yaml | 12 +--- docs/static/stainless-llama-stack-spec.html | 24 +------- docs/static/stainless-llama-stack-spec.yaml | 12 +--- llama_stack/apis/agents/openai_responses.py | 60 ++++++++++---------- 7 files changed, 42 insertions(+), 126 deletions(-) diff --git a/docs/static/deprecated-llama-stack-spec.html b/docs/static/deprecated-llama-stack-spec.html index 37fab0e26..98ed50c4f 100644 --- a/docs/static/deprecated-llama-stack-spec.html +++ b/docs/static/deprecated-llama-stack-spec.html @@ -9025,17 +9025,7 @@ "description": "(Optional) Token usage information for the response" }, "instructions": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIResponseInput" - } - } - ], + "type": "string", "description": "(Optional) System message inserted into the model's context" }, "input": { @@ -9917,17 +9907,7 @@ "description": "(Optional) Token usage information for the response" }, "instructions": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIResponseInput" - } - } - ], + "type": "string", "description": "(Optional) System message inserted into the model's context" } }, diff --git a/docs/static/deprecated-llama-stack-spec.yaml b/docs/static/deprecated-llama-stack-spec.yaml index 08ace6f7e..99c8dd03e 100644 --- a/docs/static/deprecated-llama-stack-spec.yaml +++ b/docs/static/deprecated-llama-stack-spec.yaml @@ -6735,11 +6735,7 @@ components: description: >- (Optional) Token usage information for the response instructions: - oneOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAIResponseInput' + type: string description: >- (Optional) System message inserted into the model's context input: @@ -7412,11 +7408,7 @@ components: description: >- (Optional) Token usage information for the response instructions: - oneOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAIResponseInput' + type: string description: >- (Optional) System message inserted into the model's context additionalProperties: false diff --git a/docs/static/llama-stack-spec.html b/docs/static/llama-stack-spec.html index 8be929754..1091a1cb6 100644 --- a/docs/static/llama-stack-spec.html +++ b/docs/static/llama-stack-spec.html @@ -7601,17 +7601,7 @@ "description": "(Optional) Token usage information for the response" }, "instructions": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIResponseInput" - } - } - ], + "type": "string", "description": "(Optional) System message inserted into the model's context" }, "input": { @@ -8164,17 +8154,7 @@ "description": "(Optional) Token usage information for the response" }, "instructions": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIResponseInput" - } - } - ], + "type": "string", "description": "(Optional) System message inserted into the model's context" } }, diff --git a/docs/static/llama-stack-spec.yaml b/docs/static/llama-stack-spec.yaml index be138dcc4..6c3702374 100644 --- a/docs/static/llama-stack-spec.yaml +++ b/docs/static/llama-stack-spec.yaml @@ -5816,11 +5816,7 @@ components: description: >- (Optional) Token usage information for the response instructions: - oneOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAIResponseInput' + type: string description: >- (Optional) System message inserted into the model's context input: @@ -6227,11 +6223,7 @@ components: description: >- (Optional) Token usage information for the response instructions: - oneOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAIResponseInput' + type: string description: >- (Optional) System message inserted into the model's context additionalProperties: false diff --git a/docs/static/stainless-llama-stack-spec.html b/docs/static/stainless-llama-stack-spec.html index 178109c44..ee0a265d3 100644 --- a/docs/static/stainless-llama-stack-spec.html +++ b/docs/static/stainless-llama-stack-spec.html @@ -9273,17 +9273,7 @@ "description": "(Optional) Token usage information for the response" }, "instructions": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIResponseInput" - } - } - ], + "type": "string", "description": "(Optional) System message inserted into the model's context" }, "input": { @@ -9836,17 +9826,7 @@ "description": "(Optional) Token usage information for the response" }, "instructions": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIResponseInput" - } - } - ], + "type": "string", "description": "(Optional) System message inserted into the model's context" } }, diff --git a/docs/static/stainless-llama-stack-spec.yaml b/docs/static/stainless-llama-stack-spec.yaml index 27c54e185..eff01931f 100644 --- a/docs/static/stainless-llama-stack-spec.yaml +++ b/docs/static/stainless-llama-stack-spec.yaml @@ -7029,11 +7029,7 @@ components: description: >- (Optional) Token usage information for the response instructions: - oneOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAIResponseInput' + type: string description: >- (Optional) System message inserted into the model's context input: @@ -7440,11 +7436,7 @@ components: description: >- (Optional) Token usage information for the response instructions: - oneOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAIResponseInput' + type: string description: >- (Optional) System message inserted into the model's context additionalProperties: false diff --git a/llama_stack/apis/agents/openai_responses.py b/llama_stack/apis/agents/openai_responses.py index a9a5bcb3f..821d6a8af 100644 --- a/llama_stack/apis/agents/openai_responses.py +++ b/llama_stack/apis/agents/openai_responses.py @@ -327,35 +327,6 @@ OpenAIResponseOutput = Annotated[ register_schema(OpenAIResponseOutput, name="OpenAIResponseOutput") -@json_schema_type -class OpenAIResponseInputFunctionToolCallOutput(BaseModel): - """ - This represents the output of a function call that gets passed back to the model. - """ - - call_id: str - output: str - type: Literal["function_call_output"] = "function_call_output" - id: str | None = None - status: str | None = None - - -OpenAIResponseInput = Annotated[ - # Responses API allows output messages to be passed in as input - OpenAIResponseOutputMessageWebSearchToolCall - | OpenAIResponseOutputMessageFileSearchToolCall - | OpenAIResponseOutputMessageFunctionToolCall - | OpenAIResponseInputFunctionToolCallOutput - | OpenAIResponseMCPApprovalRequest - | OpenAIResponseMCPApprovalResponse - | OpenAIResponseOutputMessageMCPCall - | OpenAIResponseOutputMessageMCPListTools - | OpenAIResponseMessage, - Field(union_mode="left_to_right"), -] -register_schema(OpenAIResponseInput, name="OpenAIResponseInput") - - # This has to be a TypedDict because we need a "schema" field and our strong # typing code in the schema generator doesn't support Pydantic aliases. That also # means we can't use a discriminator field here, because TypedDicts don't support @@ -594,7 +565,7 @@ class OpenAIResponseObject(BaseModel): tools: list[OpenAIResponseTool] | None = None truncation: str | None = None usage: OpenAIResponseUsage | None = None - instructions: str | list[OpenAIResponseInput] | None = None + instructions: str | None = None @json_schema_type @@ -1268,6 +1239,35 @@ OpenAIResponseObjectStream = Annotated[ register_schema(OpenAIResponseObjectStream, name="OpenAIResponseObjectStream") +@json_schema_type +class OpenAIResponseInputFunctionToolCallOutput(BaseModel): + """ + This represents the output of a function call that gets passed back to the model. + """ + + call_id: str + output: str + type: Literal["function_call_output"] = "function_call_output" + id: str | None = None + status: str | None = None + + +OpenAIResponseInput = Annotated[ + # Responses API allows output messages to be passed in as input + OpenAIResponseOutputMessageWebSearchToolCall + | OpenAIResponseOutputMessageFileSearchToolCall + | OpenAIResponseOutputMessageFunctionToolCall + | OpenAIResponseInputFunctionToolCallOutput + | OpenAIResponseMCPApprovalRequest + | OpenAIResponseMCPApprovalResponse + | OpenAIResponseOutputMessageMCPCall + | OpenAIResponseOutputMessageMCPListTools + | OpenAIResponseMessage, + Field(union_mode="left_to_right"), +] +register_schema(OpenAIResponseInput, name="OpenAIResponseInput") + + class ListOpenAIResponseInputItem(BaseModel): """List container for OpenAI response input items.