diff --git a/docs/static/deprecated-llama-stack-spec.html b/docs/static/deprecated-llama-stack-spec.html index 2fa339eeb..da479cd12 100644 --- a/docs/static/deprecated-llama-stack-spec.html +++ b/docs/static/deprecated-llama-stack-spec.html @@ -3949,8 +3949,20 @@ "AgentConfig": { "type": "object", "properties": { - "sampling_params": { - "$ref": "#/components/schemas/SamplingParams" + "max_output_tokens": { + "type": "integer" + }, + "temperature": { + "type": "number" + }, + "top_p": { + "type": "number" + }, + "stop": { + "type": "array", + "items": { + "type": "string" + } }, "input_shields": { "type": "array", @@ -3964,40 +3976,25 @@ "type": "string" } }, - "toolgroups": { + "tools": { "type": "array", "items": { - "$ref": "#/components/schemas/AgentTool" + "$ref": "#/components/schemas/OpenAIResponseInputTool" } }, "client_tools": { "type": "array", "items": { - "$ref": "#/components/schemas/ToolDef" + "oneOf": [ + { + "$ref": "#/components/schemas/OpenAIResponseInputTool" + }, + { + "$ref": "#/components/schemas/ToolDef" + } + ] } }, - "tool_choice": { - "type": "string", - "enum": [ - "auto", - "required", - "none" - ], - "title": "ToolChoice", - "description": "Whether tool use is required or automatic. This is a hint to the model which may not be followed. It depends on the Instruction Following capabilities of the model.", - "deprecated": true - }, - "tool_prompt_format": { - "type": "string", - "enum": [ - "json", - "function_tag", - "python_list" - ], - "title": "ToolPromptFormat", - "description": "Prompt format for calling custom / zero shot tools.", - "deprecated": true - }, "tool_config": { "$ref": "#/components/schemas/ToolConfig" }, @@ -4023,7 +4020,7 @@ "description": "Optional flag indicating whether session data has to be persisted" }, "response_format": { - "$ref": "#/components/schemas/ResponseFormat", + "$ref": "#/components/schemas/OpenAIResponseFormatParam", "description": "Optional response format configuration" } }, @@ -4035,66 +4032,22 @@ "title": "AgentConfig", "description": "Configuration for an agent." }, - "AgentTool": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "args": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - } - } - }, - "additionalProperties": false, - "required": [ - "name", - "args" - ], - "title": "AgentToolGroupWithArgs" - } - ] - }, - "GrammarResponseFormat": { + "OpenAIJSONSchema": { "type": "object", "properties": { - "type": { + "name": { "type": "string", - "enum": [ - "json_schema", - "grammar" - ], - "description": "Must be \"grammar\" to identify this format type", - "const": "grammar", - "default": "grammar" + "description": "Name of the schema" }, - "bnf": { + "description": { + "type": "string", + "description": "(Optional) Description of the schema" + }, + "strict": { + "type": "boolean", + "description": "(Optional) Whether to enforce strict adherence to the schema" + }, + "schema": { "type": "object", "additionalProperties": { "oneOf": [ @@ -4118,72 +4071,45 @@ } ] }, - "description": "The BNF grammar specification the response should conform to" + "description": "(Optional) The JSON schema definition" } }, "additionalProperties": false, "required": [ - "type", - "bnf" + "name" ], - "title": "GrammarResponseFormat", - "description": "Configuration for grammar-guided response generation." + "title": "OpenAIJSONSchema", + "description": "JSON schema specification for OpenAI-compatible structured response format." }, - "GreedySamplingStrategy": { + "OpenAIResponseFormatJSONObject": { "type": "object", "properties": { "type": { "type": "string", - "const": "greedy", - "default": "greedy", - "description": "Must be \"greedy\" to identify this sampling strategy" + "const": "json_object", + "default": "json_object", + "description": "Must be \"json_object\" to indicate generic JSON object response format" } }, "additionalProperties": false, "required": [ "type" ], - "title": "GreedySamplingStrategy", - "description": "Greedy sampling strategy that selects the highest probability token at each step." + "title": "OpenAIResponseFormatJSONObject", + "description": "JSON object response format for OpenAI-compatible chat completion requests." }, - "JsonSchemaResponseFormat": { + "OpenAIResponseFormatJSONSchema": { "type": "object", "properties": { "type": { "type": "string", - "enum": [ - "json_schema", - "grammar" - ], - "description": "Must be \"json_schema\" to identify this format type", "const": "json_schema", - "default": "json_schema" + "default": "json_schema", + "description": "Must be \"json_schema\" to indicate structured JSON response format" }, "json_schema": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "The JSON schema the response should conform to. In a Python SDK, this is often a `pydantic` model." + "$ref": "#/components/schemas/OpenAIJSONSchema", + "description": "The JSON schema specification for the response" } }, "additionalProperties": false, @@ -4191,75 +4117,349 @@ "type", "json_schema" ], - "title": "JsonSchemaResponseFormat", - "description": "Configuration for JSON schema-guided response generation." + "title": "OpenAIResponseFormatJSONSchema", + "description": "JSON schema response format for OpenAI-compatible chat completion requests." }, - "ResponseFormat": { + "OpenAIResponseFormatParam": { "oneOf": [ { - "$ref": "#/components/schemas/JsonSchemaResponseFormat" + "$ref": "#/components/schemas/OpenAIResponseFormatText" }, { - "$ref": "#/components/schemas/GrammarResponseFormat" + "$ref": "#/components/schemas/OpenAIResponseFormatJSONSchema" + }, + { + "$ref": "#/components/schemas/OpenAIResponseFormatJSONObject" } ], "discriminator": { "propertyName": "type", "mapping": { - "json_schema": "#/components/schemas/JsonSchemaResponseFormat", - "grammar": "#/components/schemas/GrammarResponseFormat" + "text": "#/components/schemas/OpenAIResponseFormatText", + "json_schema": "#/components/schemas/OpenAIResponseFormatJSONSchema", + "json_object": "#/components/schemas/OpenAIResponseFormatJSONObject" } } }, - "SamplingParams": { + "OpenAIResponseFormatText": { "type": "object", "properties": { - "strategy": { - "oneOf": [ - { - "$ref": "#/components/schemas/GreedySamplingStrategy" - }, - { - "$ref": "#/components/schemas/TopPSamplingStrategy" - }, - { - "$ref": "#/components/schemas/TopKSamplingStrategy" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "greedy": "#/components/schemas/GreedySamplingStrategy", - "top_p": "#/components/schemas/TopPSamplingStrategy", - "top_k": "#/components/schemas/TopKSamplingStrategy" - } - }, - "description": "The sampling strategy." - }, - "max_tokens": { - "type": "integer", - "default": 0, - "description": "The maximum number of tokens that can be generated in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length." - }, - "repetition_penalty": { - "type": "number", - "default": 1.0, - "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics." - }, - "stop": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence." + "type": { + "type": "string", + "const": "text", + "default": "text", + "description": "Must be \"text\" to indicate plain text response format" } }, "additionalProperties": false, "required": [ - "strategy" + "type" ], - "title": "SamplingParams", - "description": "Sampling parameters." + "title": "OpenAIResponseFormatText", + "description": "Text response format for OpenAI-compatible chat completion requests." + }, + "OpenAIResponseInputTool": { + "oneOf": [ + { + "$ref": "#/components/schemas/OpenAIResponseInputToolWebSearch" + }, + { + "$ref": "#/components/schemas/OpenAIResponseInputToolFileSearch" + }, + { + "$ref": "#/components/schemas/OpenAIResponseInputToolFunction" + }, + { + "$ref": "#/components/schemas/OpenAIResponseInputToolMCP" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "web_search": "#/components/schemas/OpenAIResponseInputToolWebSearch", + "file_search": "#/components/schemas/OpenAIResponseInputToolFileSearch", + "function": "#/components/schemas/OpenAIResponseInputToolFunction", + "mcp": "#/components/schemas/OpenAIResponseInputToolMCP" + } + } + }, + "OpenAIResponseInputToolFileSearch": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file_search", + "default": "file_search", + "description": "Tool type identifier, always \"file_search\"" + }, + "vector_store_ids": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of vector store identifiers to search within" + }, + "filters": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "type": "null" + }, + { + "type": "boolean" + }, + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "array" + }, + { + "type": "object" + } + ] + }, + "description": "(Optional) Additional filters to apply to the search" + }, + "max_num_results": { + "type": "integer", + "default": 10, + "description": "(Optional) Maximum number of search results to return (1-50)" + }, + "ranking_options": { + "type": "object", + "properties": { + "ranker": { + "type": "string", + "description": "(Optional) Name of the ranking algorithm to use" + }, + "score_threshold": { + "type": "number", + "default": 0.0, + "description": "(Optional) Minimum relevance score threshold for results" + } + }, + "additionalProperties": false, + "description": "(Optional) Options for ranking and scoring search results" + } + }, + "additionalProperties": false, + "required": [ + "type", + "vector_store_ids" + ], + "title": "OpenAIResponseInputToolFileSearch", + "description": "File search tool configuration for OpenAI response inputs." + }, + "OpenAIResponseInputToolFunction": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "function", + "default": "function", + "description": "Tool type identifier, always \"function\"" + }, + "name": { + "type": "string", + "description": "Name of the function that can be called" + }, + "description": { + "type": "string", + "description": "(Optional) Description of what the function does" + }, + "parameters": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "type": "null" + }, + { + "type": "boolean" + }, + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "array" + }, + { + "type": "object" + } + ] + }, + "description": "(Optional) JSON schema defining the function's parameters" + }, + "strict": { + "type": "boolean", + "description": "(Optional) Whether to enforce strict parameter validation" + } + }, + "additionalProperties": false, + "required": [ + "type", + "name" + ], + "title": "OpenAIResponseInputToolFunction", + "description": "Function tool configuration for OpenAI response inputs." + }, + "OpenAIResponseInputToolMCP": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "mcp", + "default": "mcp", + "description": "Tool type identifier, always \"mcp\"" + }, + "server_label": { + "type": "string", + "description": "Label to identify this MCP server" + }, + "server_url": { + "type": "string", + "description": "URL endpoint of the MCP server" + }, + "headers": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "type": "null" + }, + { + "type": "boolean" + }, + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "array" + }, + { + "type": "object" + } + ] + }, + "description": "(Optional) HTTP headers to include when connecting to the server" + }, + "require_approval": { + "oneOf": [ + { + "type": "string", + "const": "always" + }, + { + "type": "string", + "const": "never" + }, + { + "type": "object", + "properties": { + "always": { + "type": "array", + "items": { + "type": "string" + }, + "description": "(Optional) List of tool names that always require approval" + }, + "never": { + "type": "array", + "items": { + "type": "string" + }, + "description": "(Optional) List of tool names that never require approval" + } + }, + "additionalProperties": false, + "title": "ApprovalFilter", + "description": "Filter configuration for MCP tool approval requirements." + } + ], + "default": "never", + "description": "Approval requirement for tool calls (\"always\", \"never\", or filter)" + }, + "allowed_tools": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object", + "properties": { + "tool_names": { + "type": "array", + "items": { + "type": "string" + }, + "description": "(Optional) List of specific tool names that are allowed" + } + }, + "additionalProperties": false, + "title": "AllowedToolsFilter", + "description": "Filter configuration for restricting which MCP tools can be used." + } + ], + "description": "(Optional) Restriction on which tools can be used from this server" + } + }, + "additionalProperties": false, + "required": [ + "type", + "server_label", + "server_url", + "require_approval" + ], + "title": "OpenAIResponseInputToolMCP", + "description": "Model Context Protocol (MCP) tool configuration for OpenAI response inputs." + }, + "OpenAIResponseInputToolWebSearch": { + "type": "object", + "properties": { + "type": { + "oneOf": [ + { + "type": "string", + "const": "web_search" + }, + { + "type": "string", + "const": "web_search_preview" + }, + { + "type": "string", + "const": "web_search_preview_2025_03_11" + } + ], + "default": "web_search", + "description": "Web search tool type variant to use" + }, + "search_context_size": { + "type": "string", + "default": "medium", + "description": "(Optional) Size of search context, must be \"low\", \"medium\", or \"high\"" + } + }, + "additionalProperties": false, + "required": [ + "type" + ], + "title": "OpenAIResponseInputToolWebSearch", + "description": "Web search tool configuration for OpenAI response inputs." }, "ToolConfig": { "type": "object", @@ -4407,54 +4607,6 @@ "title": "ToolDef", "description": "Tool definition used in runtime contexts." }, - "TopKSamplingStrategy": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "top_k", - "default": "top_k", - "description": "Must be \"top_k\" to identify this sampling strategy" - }, - "top_k": { - "type": "integer", - "description": "Number of top tokens to consider for sampling. Must be at least 1" - } - }, - "additionalProperties": false, - "required": [ - "type", - "top_k" - ], - "title": "TopKSamplingStrategy", - "description": "Top-k sampling strategy that restricts sampling to the k most likely tokens." - }, - "TopPSamplingStrategy": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "top_p", - "default": "top_p", - "description": "Must be \"top_p\" to identify this sampling strategy" - }, - "temperature": { - "type": "number", - "description": "Controls randomness in sampling. Higher values increase randomness" - }, - "top_p": { - "type": "number", - "default": 0.95, - "description": "Cumulative probability threshold for nucleus sampling. Defaults to 0.95" - } - }, - "additionalProperties": false, - "required": [ - "type" - ], - "title": "TopPSamplingStrategy", - "description": "Top-p (nucleus) sampling strategy that samples from the smallest set of tokens with cumulative probability >= p." - }, "CreateAgentRequest": { "type": "object", "properties": { @@ -4539,79 +4691,6 @@ "title": "AgentSessionCreateResponse", "description": "Response returned when creating a new agent session." }, - "CompletionMessage": { - "type": "object", - "properties": { - "role": { - "type": "string", - "const": "assistant", - "default": "assistant", - "description": "Must be \"assistant\" to identify this as the model's response" - }, - "content": { - "$ref": "#/components/schemas/InterleavedContent", - "description": "The content of the model's response" - }, - "stop_reason": { - "type": "string", - "enum": [ - "end_of_turn", - "end_of_message", - "out_of_tokens" - ], - "description": "Reason why the model stopped generating. Options are: - `StopReason.end_of_turn`: The model finished generating the entire response. - `StopReason.end_of_message`: The model finished generating but generated a partial response -- usually, a tool call. The user may call the tool and continue the conversation with the tool's response. - `StopReason.out_of_tokens`: The model ran out of token budget." - }, - "tool_calls": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ToolCall" - }, - "description": "List of tool calls. Each tool call is a ToolCall object." - } - }, - "additionalProperties": false, - "required": [ - "role", - "content", - "stop_reason" - ], - "title": "CompletionMessage", - "description": "A message containing the model's (assistant) response in a chat conversation." - }, - "ImageContentItem": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "image", - "default": "image", - "description": "Discriminator type of the content item. Always \"image\"" - }, - "image": { - "type": "object", - "properties": { - "url": { - "$ref": "#/components/schemas/URL", - "description": "A URL of the image or data URL in the format of data:image/{type};base64,{data}. Note that URL could have length limits." - }, - "data": { - "type": "string", - "contentEncoding": "base64", - "description": "base64 encoded image data as string" - } - }, - "additionalProperties": false, - "description": "Image as a base64 encoded string or an URL" - } - }, - "additionalProperties": false, - "required": [ - "type", - "image" - ], - "title": "ImageContentItem", - "description": "A image content item" - }, "InferenceStep": { "type": "object", "properties": { @@ -4647,8 +4726,11 @@ "default": "inference" }, "model_response": { - "$ref": "#/components/schemas/CompletionMessage", + "$ref": "#/components/schemas/OpenAIAssistantMessageParam", "description": "The response from the LLM." + }, + "finish_reason": { + "type": "string" } }, "additionalProperties": false, @@ -4661,39 +4743,6 @@ "title": "InferenceStep", "description": "An inference step in an agent turn." }, - "InterleavedContent": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/components/schemas/InterleavedContentItem" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/InterleavedContentItem" - } - } - ] - }, - "InterleavedContentItem": { - "oneOf": [ - { - "$ref": "#/components/schemas/ImageContentItem" - }, - { - "$ref": "#/components/schemas/TextContentItem" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "image": "#/components/schemas/ImageContentItem", - "text": "#/components/schemas/TextContentItem" - } - } - }, "MemoryRetrievalStep": { "type": "object", "properties": { @@ -4733,7 +4782,17 @@ "description": "The IDs of the vector databases to retrieve context from." }, "inserted_context": { - "$ref": "#/components/schemas/InterleavedContent", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartParam" + } + } + ], "description": "The context retrieved from the vector databases." } }, @@ -4748,6 +4807,386 @@ "title": "MemoryRetrievalStep", "description": "A memory retrieval step in an agent turn." }, + "OpenAIAssistantMessageParam": { + "type": "object", + "properties": { + "role": { + "type": "string", + "const": "assistant", + "default": "assistant", + "description": "Must be \"assistant\" to identify this as the model's response" + }, + "content": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" + } + } + ], + "description": "The content of the model's response" + }, + "name": { + "type": "string", + "description": "(Optional) The name of the assistant message participant." + }, + "tool_calls": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionToolCall" + }, + "description": "List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object." + } + }, + "additionalProperties": false, + "required": [ + "role" + ], + "title": "OpenAIAssistantMessageParam", + "description": "A message containing the model's (assistant) response in an OpenAI-compatible chat completion request." + }, + "OpenAIChatCompletionContentPartImageParam": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "image_url", + "default": "image_url", + "description": "Must be \"image_url\" to identify this as image content" + }, + "image_url": { + "$ref": "#/components/schemas/OpenAIImageURL", + "description": "Image URL specification and processing details" + } + }, + "additionalProperties": false, + "required": [ + "type", + "image_url" + ], + "title": "OpenAIChatCompletionContentPartImageParam", + "description": "Image content part for OpenAI-compatible chat completion messages." + }, + "OpenAIChatCompletionContentPartParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" + }, + { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartImageParam" + }, + { + "$ref": "#/components/schemas/OpenAIFile" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "text": "#/components/schemas/OpenAIChatCompletionContentPartTextParam", + "image_url": "#/components/schemas/OpenAIChatCompletionContentPartImageParam", + "file": "#/components/schemas/OpenAIFile" + } + } + }, + "OpenAIChatCompletionContentPartTextParam": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text", + "default": "text", + "description": "Must be \"text\" to identify this as text content" + }, + "text": { + "type": "string", + "description": "The text content of the message" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ], + "title": "OpenAIChatCompletionContentPartTextParam", + "description": "Text content part for OpenAI-compatible chat completion messages." + }, + "OpenAIChatCompletionToolCall": { + "type": "object", + "properties": { + "index": { + "type": "integer", + "description": "(Optional) Index of the tool call in the list" + }, + "id": { + "type": "string", + "description": "(Optional) Unique identifier for the tool call" + }, + "type": { + "type": "string", + "const": "function", + "default": "function", + "description": "Must be \"function\" to identify this as a function call" + }, + "function": { + "$ref": "#/components/schemas/OpenAIChatCompletionToolCallFunction", + "description": "(Optional) Function call details" + } + }, + "additionalProperties": false, + "required": [ + "type" + ], + "title": "OpenAIChatCompletionToolCall", + "description": "Tool call specification for OpenAI-compatible chat completion responses." + }, + "OpenAIChatCompletionToolCallFunction": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "(Optional) Name of the function to call" + }, + "arguments": { + "type": "string", + "description": "(Optional) Arguments to pass to the function as a JSON string" + } + }, + "additionalProperties": false, + "title": "OpenAIChatCompletionToolCallFunction", + "description": "Function call details for OpenAI-compatible tool calls." + }, + "OpenAIDeveloperMessageParam": { + "type": "object", + "properties": { + "role": { + "type": "string", + "const": "developer", + "default": "developer", + "description": "Must be \"developer\" to identify this as a developer message" + }, + "content": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" + } + } + ], + "description": "The content of the developer message" + }, + "name": { + "type": "string", + "description": "(Optional) The name of the developer message participant." + } + }, + "additionalProperties": false, + "required": [ + "role", + "content" + ], + "title": "OpenAIDeveloperMessageParam", + "description": "A message from the developer in an OpenAI-compatible chat completion request." + }, + "OpenAIFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "default": "file" + }, + "file": { + "$ref": "#/components/schemas/OpenAIFileFile" + } + }, + "additionalProperties": false, + "required": [ + "type", + "file" + ], + "title": "OpenAIFile" + }, + "OpenAIFileFile": { + "type": "object", + "properties": { + "file_data": { + "type": "string" + }, + "file_id": { + "type": "string" + }, + "filename": { + "type": "string" + } + }, + "additionalProperties": false, + "title": "OpenAIFileFile" + }, + "OpenAIImageURL": { + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "URL of the image to include in the message" + }, + "detail": { + "type": "string", + "description": "(Optional) Level of detail for image processing. Can be \"low\", \"high\", or \"auto\"" + } + }, + "additionalProperties": false, + "required": [ + "url" + ], + "title": "OpenAIImageURL", + "description": "Image URL specification for OpenAI-compatible chat completion messages." + }, + "OpenAIMessageParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/OpenAIUserMessageParam" + }, + { + "$ref": "#/components/schemas/OpenAISystemMessageParam" + }, + { + "$ref": "#/components/schemas/OpenAIAssistantMessageParam" + }, + { + "$ref": "#/components/schemas/OpenAIToolMessageParam" + }, + { + "$ref": "#/components/schemas/OpenAIDeveloperMessageParam" + } + ], + "discriminator": { + "propertyName": "role", + "mapping": { + "user": "#/components/schemas/OpenAIUserMessageParam", + "system": "#/components/schemas/OpenAISystemMessageParam", + "assistant": "#/components/schemas/OpenAIAssistantMessageParam", + "tool": "#/components/schemas/OpenAIToolMessageParam", + "developer": "#/components/schemas/OpenAIDeveloperMessageParam" + } + } + }, + "OpenAISystemMessageParam": { + "type": "object", + "properties": { + "role": { + "type": "string", + "const": "system", + "default": "system", + "description": "Must be \"system\" to identify this as a system message" + }, + "content": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" + } + } + ], + "description": "The content of the \"system prompt\". If multiple system messages are provided, they are concatenated. The underlying Llama Stack code may also add other system messages (for example, for formatting tool definitions)." + }, + "name": { + "type": "string", + "description": "(Optional) The name of the system message participant." + } + }, + "additionalProperties": false, + "required": [ + "role", + "content" + ], + "title": "OpenAISystemMessageParam", + "description": "A system message providing instructions or context to the model." + }, + "OpenAIToolMessageParam": { + "type": "object", + "properties": { + "role": { + "type": "string", + "const": "tool", + "default": "tool", + "description": "Must be \"tool\" to identify this as a tool response" + }, + "tool_call_id": { + "type": "string", + "description": "Unique identifier for the tool call this response is for" + }, + "content": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" + } + } + ], + "description": "The response content from the tool" + } + }, + "additionalProperties": false, + "required": [ + "role", + "tool_call_id", + "content" + ], + "title": "OpenAIToolMessageParam", + "description": "A message representing the result of a tool invocation in an OpenAI-compatible chat completion request." + }, + "OpenAIUserMessageParam": { + "type": "object", + "properties": { + "role": { + "type": "string", + "const": "user", + "default": "user", + "description": "Must be \"user\" to identify this as a user message" + }, + "content": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartParam" + } + } + ], + "description": "The content of the message, which can include text and other media" + }, + "name": { + "type": "string", + "description": "(Optional) The name of the user message participant." + } + }, + "additionalProperties": false, + "required": [ + "role", + "content" + ], + "title": "OpenAIUserMessageParam", + "description": "A message from the user in an OpenAI-compatible chat completion request." + }, "SafetyViolation": { "type": "object", "properties": { @@ -4876,63 +5315,6 @@ "title": "ShieldCallStep", "description": "A shield call step in an agent turn." }, - "TextContentItem": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "text", - "default": "text", - "description": "Discriminator type of the content item. Always \"text\"" - }, - "text": { - "type": "string", - "description": "Text content" - } - }, - "additionalProperties": false, - "required": [ - "type", - "text" - ], - "title": "TextContentItem", - "description": "A text content item" - }, - "ToolCall": { - "type": "object", - "properties": { - "call_id": { - "type": "string" - }, - "tool_name": { - "oneOf": [ - { - "type": "string", - "enum": [ - "brave_search", - "wolfram_alpha", - "photogen", - "code_interpreter" - ], - "title": "BuiltinTool" - }, - { - "type": "string" - } - ] - }, - "arguments": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "call_id", - "tool_name", - "arguments" - ], - "title": "ToolCall" - }, "ToolExecutionStep": { "type": "object", "properties": { @@ -4970,14 +5352,14 @@ "tool_calls": { "type": "array", "items": { - "$ref": "#/components/schemas/ToolCall" + "$ref": "#/components/schemas/OpenAIChatCompletionToolCall" }, "description": "The tool calls to execute." }, "tool_responses": { "type": "array", "items": { - "$ref": "#/components/schemas/ToolResponse" + "$ref": "#/components/schemas/OpenAIToolMessageParam" }, "description": "The tool responses from the tool calls." } @@ -4993,98 +5375,6 @@ "title": "ToolExecutionStep", "description": "A tool execution step in an agent turn." }, - "ToolResponse": { - "type": "object", - "properties": { - "call_id": { - "type": "string", - "description": "Unique identifier for the tool call this response is for" - }, - "tool_name": { - "oneOf": [ - { - "type": "string", - "enum": [ - "brave_search", - "wolfram_alpha", - "photogen", - "code_interpreter" - ], - "title": "BuiltinTool" - }, - { - "type": "string" - } - ], - "description": "Name of the tool that was invoked" - }, - "content": { - "$ref": "#/components/schemas/InterleavedContent", - "description": "The response content from the tool" - }, - "metadata": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "(Optional) Additional metadata about the tool response" - } - }, - "additionalProperties": false, - "required": [ - "call_id", - "tool_name", - "content" - ], - "title": "ToolResponse", - "description": "Response from a tool invocation." - }, - "ToolResponseMessage": { - "type": "object", - "properties": { - "role": { - "type": "string", - "const": "tool", - "default": "tool", - "description": "Must be \"tool\" to identify this as a tool response" - }, - "call_id": { - "type": "string", - "description": "Unique identifier for the tool call this response is for" - }, - "content": { - "$ref": "#/components/schemas/InterleavedContent", - "description": "The response content from the tool" - } - }, - "additionalProperties": false, - "required": [ - "role", - "call_id", - "content" - ], - "title": "ToolResponseMessage", - "description": "A message representing the result of a tool invocation." - }, "Turn": { "type": "object", "properties": { @@ -5099,14 +5389,7 @@ "input_messages": { "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserMessage" - }, - { - "$ref": "#/components/schemas/ToolResponseMessage" - } - ] + "$ref": "#/components/schemas/OpenAIMessageParam" }, "description": "List of messages that initiated this turn" }, @@ -5140,9 +5423,12 @@ "description": "Ordered list of processing steps executed during this turn" }, "output_message": { - "$ref": "#/components/schemas/CompletionMessage", + "$ref": "#/components/schemas/OpenAIAssistantMessageParam", "description": "The model's generated response containing content and metadata" }, + "finish_reason": { + "type": "string" + }, "output_attachments": { "type": "array", "items": { @@ -5153,13 +5439,10 @@ { "type": "string" }, - { - "$ref": "#/components/schemas/InterleavedContentItem" - }, { "type": "array", "items": { - "$ref": "#/components/schemas/InterleavedContentItem" + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartParam" } }, { @@ -5221,32 +5504,6 @@ "title": "URL", "description": "A URL reference to external content." }, - "UserMessage": { - "type": "object", - "properties": { - "role": { - "type": "string", - "const": "user", - "default": "user", - "description": "Must be \"user\" to identify this as a user message" - }, - "content": { - "$ref": "#/components/schemas/InterleavedContent", - "description": "The content of the message, which can include text and other media" - }, - "context": { - "$ref": "#/components/schemas/InterleavedContent", - "description": "(Optional) This field is used internally by Llama Stack to pass RAG context. This field may be removed in the API in the future." - } - }, - "additionalProperties": false, - "required": [ - "role", - "content" - ], - "title": "UserMessage", - "description": "A message from the user in a chat conversation." - }, "ViolationLevel": { "type": "string", "enum": [ @@ -5263,14 +5520,7 @@ "messages": { "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserMessage" - }, - { - "$ref": "#/components/schemas/ToolResponseMessage" - } - ] + "$ref": "#/components/schemas/OpenAIMessageParam" }, "description": "List of messages to start the turn with." }, @@ -5288,13 +5538,10 @@ { "type": "string" }, - { - "$ref": "#/components/schemas/InterleavedContentItem" - }, { "type": "array", "items": { - "$ref": "#/components/schemas/InterleavedContentItem" + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartParam" } }, { @@ -5318,12 +5565,12 @@ }, "description": "(Optional) List of documents to create the turn with." }, - "toolgroups": { + "tools": { "type": "array", "items": { - "$ref": "#/components/schemas/AgentTool" + "$ref": "#/components/schemas/OpenAIResponseInputTool" }, - "description": "(Optional) List of toolgroups to create the turn with, will be used in addition to the agent's config toolgroups for the request." + "description": "(Optional) List of tools to create the turn with, will be used in addition to the agent's config tools for the request." }, "tool_config": { "$ref": "#/components/schemas/ToolConfig", @@ -5730,6 +5977,41 @@ "title": "TextDelta", "description": "A text content delta for streaming responses." }, + "ToolCall": { + "type": "object", + "properties": { + "call_id": { + "type": "string" + }, + "tool_name": { + "oneOf": [ + { + "type": "string", + "enum": [ + "brave_search", + "wolfram_alpha", + "photogen", + "code_interpreter" + ], + "title": "BuiltinTool" + }, + { + "type": "string" + } + ] + }, + "arguments": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "call_id", + "tool_name", + "arguments" + ], + "title": "ToolCall" + }, "ToolCallDelta": { "type": "object", "properties": { @@ -5776,7 +6058,7 @@ "tool_responses": { "type": "array", "items": { - "$ref": "#/components/schemas/ToolResponse" + "$ref": "#/components/schemas/OpenAIToolMessageParam" }, "description": "The tool call responses to resume the turn with." }, @@ -6373,6 +6655,90 @@ "title": "BenchmarkConfig", "description": "A benchmark configuration for evaluation." }, + "GreedySamplingStrategy": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "greedy", + "default": "greedy", + "description": "Must be \"greedy\" to identify this sampling strategy" + } + }, + "additionalProperties": false, + "required": [ + "type" + ], + "title": "GreedySamplingStrategy", + "description": "Greedy sampling strategy that selects the highest probability token at each step." + }, + "ImageContentItem": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "image", + "default": "image", + "description": "Discriminator type of the content item. Always \"image\"" + }, + "image": { + "type": "object", + "properties": { + "url": { + "$ref": "#/components/schemas/URL", + "description": "A URL of the image or data URL in the format of data:image/{type};base64,{data}. Note that URL could have length limits." + }, + "data": { + "type": "string", + "contentEncoding": "base64", + "description": "base64 encoded image data as string" + } + }, + "additionalProperties": false, + "description": "Image as a base64 encoded string or an URL" + } + }, + "additionalProperties": false, + "required": [ + "type", + "image" + ], + "title": "ImageContentItem", + "description": "A image content item" + }, + "InterleavedContent": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/components/schemas/InterleavedContentItem" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/InterleavedContentItem" + } + } + ] + }, + "InterleavedContentItem": { + "oneOf": [ + { + "$ref": "#/components/schemas/ImageContentItem" + }, + { + "$ref": "#/components/schemas/TextContentItem" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "image": "#/components/schemas/ImageContentItem", + "text": "#/components/schemas/TextContentItem" + } + } + }, "LLMAsJudgeScoringFnParams": { "type": "object", "properties": { @@ -6478,6 +6844,56 @@ "title": "RegexParserScoringFnParams", "description": "Parameters for regex parser scoring function configuration." }, + "SamplingParams": { + "type": "object", + "properties": { + "strategy": { + "oneOf": [ + { + "$ref": "#/components/schemas/GreedySamplingStrategy" + }, + { + "$ref": "#/components/schemas/TopPSamplingStrategy" + }, + { + "$ref": "#/components/schemas/TopKSamplingStrategy" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "greedy": "#/components/schemas/GreedySamplingStrategy", + "top_p": "#/components/schemas/TopPSamplingStrategy", + "top_k": "#/components/schemas/TopKSamplingStrategy" + } + }, + "description": "The sampling strategy." + }, + "max_tokens": { + "type": "integer", + "default": 0, + "description": "The maximum number of tokens that can be generated in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length." + }, + "repetition_penalty": { + "type": "number", + "default": 1.0, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics." + }, + "stop": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence." + } + }, + "additionalProperties": false, + "required": [ + "strategy" + ], + "title": "SamplingParams", + "description": "Sampling parameters." + }, "ScoringFnParams": { "oneOf": [ { @@ -6531,6 +6947,76 @@ "title": "SystemMessage", "description": "A system message providing instructions or context to the model." }, + "TextContentItem": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text", + "default": "text", + "description": "Discriminator type of the content item. Always \"text\"" + }, + "text": { + "type": "string", + "description": "Text content" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ], + "title": "TextContentItem", + "description": "A text content item" + }, + "TopKSamplingStrategy": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "top_k", + "default": "top_k", + "description": "Must be \"top_k\" to identify this sampling strategy" + }, + "top_k": { + "type": "integer", + "description": "Number of top tokens to consider for sampling. Must be at least 1" + } + }, + "additionalProperties": false, + "required": [ + "type", + "top_k" + ], + "title": "TopKSamplingStrategy", + "description": "Top-k sampling strategy that restricts sampling to the k most likely tokens." + }, + "TopPSamplingStrategy": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "top_p", + "default": "top_p", + "description": "Must be \"top_p\" to identify this sampling strategy" + }, + "temperature": { + "type": "number", + "description": "Controls randomness in sampling. Higher values increase randomness" + }, + "top_p": { + "type": "number", + "default": 0.95, + "description": "Cumulative probability threshold for nucleus sampling. Defaults to 0.95" + } + }, + "additionalProperties": false, + "required": [ + "type" + ], + "title": "TopPSamplingStrategy", + "description": "Top-p (nucleus) sampling strategy that samples from the smallest set of tokens with cumulative probability >= p." + }, "EvaluateRowsRequest": { "type": "object", "properties": { @@ -6835,158 +7321,6 @@ "title": "ListOpenAIChatCompletionResponse", "description": "Response from listing OpenAI-compatible chat completions." }, - "OpenAIAssistantMessageParam": { - "type": "object", - "properties": { - "role": { - "type": "string", - "const": "assistant", - "default": "assistant", - "description": "Must be \"assistant\" to identify this as the model's response" - }, - "content": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" - } - } - ], - "description": "The content of the model's response" - }, - "name": { - "type": "string", - "description": "(Optional) The name of the assistant message participant." - }, - "tool_calls": { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIChatCompletionToolCall" - }, - "description": "List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object." - } - }, - "additionalProperties": false, - "required": [ - "role" - ], - "title": "OpenAIAssistantMessageParam", - "description": "A message containing the model's (assistant) response in an OpenAI-compatible chat completion request." - }, - "OpenAIChatCompletionContentPartImageParam": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "image_url", - "default": "image_url", - "description": "Must be \"image_url\" to identify this as image content" - }, - "image_url": { - "$ref": "#/components/schemas/OpenAIImageURL", - "description": "Image URL specification and processing details" - } - }, - "additionalProperties": false, - "required": [ - "type", - "image_url" - ], - "title": "OpenAIChatCompletionContentPartImageParam", - "description": "Image content part for OpenAI-compatible chat completion messages." - }, - "OpenAIChatCompletionContentPartParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" - }, - { - "$ref": "#/components/schemas/OpenAIChatCompletionContentPartImageParam" - }, - { - "$ref": "#/components/schemas/OpenAIFile" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "text": "#/components/schemas/OpenAIChatCompletionContentPartTextParam", - "image_url": "#/components/schemas/OpenAIChatCompletionContentPartImageParam", - "file": "#/components/schemas/OpenAIFile" - } - } - }, - "OpenAIChatCompletionContentPartTextParam": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "text", - "default": "text", - "description": "Must be \"text\" to identify this as text content" - }, - "text": { - "type": "string", - "description": "The text content of the message" - } - }, - "additionalProperties": false, - "required": [ - "type", - "text" - ], - "title": "OpenAIChatCompletionContentPartTextParam", - "description": "Text content part for OpenAI-compatible chat completion messages." - }, - "OpenAIChatCompletionToolCall": { - "type": "object", - "properties": { - "index": { - "type": "integer", - "description": "(Optional) Index of the tool call in the list" - }, - "id": { - "type": "string", - "description": "(Optional) Unique identifier for the tool call" - }, - "type": { - "type": "string", - "const": "function", - "default": "function", - "description": "Must be \"function\" to identify this as a function call" - }, - "function": { - "$ref": "#/components/schemas/OpenAIChatCompletionToolCallFunction", - "description": "(Optional) Function call details" - } - }, - "additionalProperties": false, - "required": [ - "type" - ], - "title": "OpenAIChatCompletionToolCall", - "description": "Tool call specification for OpenAI-compatible chat completion responses." - }, - "OpenAIChatCompletionToolCallFunction": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "(Optional) Name of the function to call" - }, - "arguments": { - "type": "string", - "description": "(Optional) Arguments to pass to the function as a JSON string" - } - }, - "additionalProperties": false, - "title": "OpenAIChatCompletionToolCallFunction", - "description": "Function call details for OpenAI-compatible tool calls." - }, "OpenAIChatCompletionUsage": { "type": "object", "properties": { @@ -7113,161 +7447,6 @@ "title": "OpenAIChoiceLogprobs", "description": "The log probabilities for the tokens in the message from an OpenAI-compatible chat completion response." }, - "OpenAIDeveloperMessageParam": { - "type": "object", - "properties": { - "role": { - "type": "string", - "const": "developer", - "default": "developer", - "description": "Must be \"developer\" to identify this as a developer message" - }, - "content": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" - } - } - ], - "description": "The content of the developer message" - }, - "name": { - "type": "string", - "description": "(Optional) The name of the developer message participant." - } - }, - "additionalProperties": false, - "required": [ - "role", - "content" - ], - "title": "OpenAIDeveloperMessageParam", - "description": "A message from the developer in an OpenAI-compatible chat completion request." - }, - "OpenAIFile": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "file", - "default": "file" - }, - "file": { - "$ref": "#/components/schemas/OpenAIFileFile" - } - }, - "additionalProperties": false, - "required": [ - "type", - "file" - ], - "title": "OpenAIFile" - }, - "OpenAIFileFile": { - "type": "object", - "properties": { - "file_data": { - "type": "string" - }, - "file_id": { - "type": "string" - }, - "filename": { - "type": "string" - } - }, - "additionalProperties": false, - "title": "OpenAIFileFile" - }, - "OpenAIImageURL": { - "type": "object", - "properties": { - "url": { - "type": "string", - "description": "URL of the image to include in the message" - }, - "detail": { - "type": "string", - "description": "(Optional) Level of detail for image processing. Can be \"low\", \"high\", or \"auto\"" - } - }, - "additionalProperties": false, - "required": [ - "url" - ], - "title": "OpenAIImageURL", - "description": "Image URL specification for OpenAI-compatible chat completion messages." - }, - "OpenAIMessageParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/OpenAIUserMessageParam" - }, - { - "$ref": "#/components/schemas/OpenAISystemMessageParam" - }, - { - "$ref": "#/components/schemas/OpenAIAssistantMessageParam" - }, - { - "$ref": "#/components/schemas/OpenAIToolMessageParam" - }, - { - "$ref": "#/components/schemas/OpenAIDeveloperMessageParam" - } - ], - "discriminator": { - "propertyName": "role", - "mapping": { - "user": "#/components/schemas/OpenAIUserMessageParam", - "system": "#/components/schemas/OpenAISystemMessageParam", - "assistant": "#/components/schemas/OpenAIAssistantMessageParam", - "tool": "#/components/schemas/OpenAIToolMessageParam", - "developer": "#/components/schemas/OpenAIDeveloperMessageParam" - } - } - }, - "OpenAISystemMessageParam": { - "type": "object", - "properties": { - "role": { - "type": "string", - "const": "system", - "default": "system", - "description": "Must be \"system\" to identify this as a system message" - }, - "content": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" - } - } - ], - "description": "The content of the \"system prompt\". If multiple system messages are provided, they are concatenated. The underlying Llama Stack code may also add other system messages (for example, for formatting tool definitions)." - }, - "name": { - "type": "string", - "description": "(Optional) The name of the system message participant." - } - }, - "additionalProperties": false, - "required": [ - "role", - "content" - ], - "title": "OpenAISystemMessageParam", - "description": "A system message providing instructions or context to the model." - }, "OpenAITokenLogProb": { "type": "object", "properties": { @@ -7299,43 +7478,6 @@ "title": "OpenAITokenLogProb", "description": "The log probability for a token from an OpenAI-compatible chat completion response." }, - "OpenAIToolMessageParam": { - "type": "object", - "properties": { - "role": { - "type": "string", - "const": "tool", - "default": "tool", - "description": "Must be \"tool\" to identify this as a tool response" - }, - "tool_call_id": { - "type": "string", - "description": "Unique identifier for the tool call this response is for" - }, - "content": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" - } - } - ], - "description": "The response content from the tool" - } - }, - "additionalProperties": false, - "required": [ - "role", - "tool_call_id", - "content" - ], - "title": "OpenAIToolMessageParam", - "description": "A message representing the result of a tool invocation in an OpenAI-compatible chat completion request." - }, "OpenAITopLogProb": { "type": "object", "properties": { @@ -7360,168 +7502,6 @@ "title": "OpenAITopLogProb", "description": "The top log probability for a token from an OpenAI-compatible chat completion response." }, - "OpenAIUserMessageParam": { - "type": "object", - "properties": { - "role": { - "type": "string", - "const": "user", - "default": "user", - "description": "Must be \"user\" to identify this as a user message" - }, - "content": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/OpenAIChatCompletionContentPartParam" - } - } - ], - "description": "The content of the message, which can include text and other media" - }, - "name": { - "type": "string", - "description": "(Optional) The name of the user message participant." - } - }, - "additionalProperties": false, - "required": [ - "role", - "content" - ], - "title": "OpenAIUserMessageParam", - "description": "A message from the user in an OpenAI-compatible chat completion request." - }, - "OpenAIJSONSchema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the schema" - }, - "description": { - "type": "string", - "description": "(Optional) Description of the schema" - }, - "strict": { - "type": "boolean", - "description": "(Optional) Whether to enforce strict adherence to the schema" - }, - "schema": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "(Optional) The JSON schema definition" - } - }, - "additionalProperties": false, - "required": [ - "name" - ], - "title": "OpenAIJSONSchema", - "description": "JSON schema specification for OpenAI-compatible structured response format." - }, - "OpenAIResponseFormatJSONObject": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "json_object", - "default": "json_object", - "description": "Must be \"json_object\" to indicate generic JSON object response format" - } - }, - "additionalProperties": false, - "required": [ - "type" - ], - "title": "OpenAIResponseFormatJSONObject", - "description": "JSON object response format for OpenAI-compatible chat completion requests." - }, - "OpenAIResponseFormatJSONSchema": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "json_schema", - "default": "json_schema", - "description": "Must be \"json_schema\" to indicate structured JSON response format" - }, - "json_schema": { - "$ref": "#/components/schemas/OpenAIJSONSchema", - "description": "The JSON schema specification for the response" - } - }, - "additionalProperties": false, - "required": [ - "type", - "json_schema" - ], - "title": "OpenAIResponseFormatJSONSchema", - "description": "JSON schema response format for OpenAI-compatible chat completion requests." - }, - "OpenAIResponseFormatParam": { - "oneOf": [ - { - "$ref": "#/components/schemas/OpenAIResponseFormatText" - }, - { - "$ref": "#/components/schemas/OpenAIResponseFormatJSONSchema" - }, - { - "$ref": "#/components/schemas/OpenAIResponseFormatJSONObject" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "text": "#/components/schemas/OpenAIResponseFormatText", - "json_schema": "#/components/schemas/OpenAIResponseFormatJSONSchema", - "json_object": "#/components/schemas/OpenAIResponseFormatJSONObject" - } - } - }, - "OpenAIResponseFormatText": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "text", - "default": "text", - "description": "Must be \"text\" to indicate plain text response format" - } - }, - "additionalProperties": false, - "required": [ - "type" - ], - "title": "OpenAIResponseFormatText", - "description": "Text response format for OpenAI-compatible chat completion requests." - }, "OpenaiChatCompletionRequest": { "type": "object", "properties": { @@ -8975,168 +8955,6 @@ "title": "OpenAIResponseInputMessageContentText", "description": "Text content for input messages in OpenAI response format." }, - "OpenAIResponseInputToolFileSearch": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "file_search", - "default": "file_search", - "description": "Tool type identifier, always \"file_search\"" - }, - "vector_store_ids": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of vector store identifiers to search within" - }, - "filters": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "(Optional) Additional filters to apply to the search" - }, - "max_num_results": { - "type": "integer", - "default": 10, - "description": "(Optional) Maximum number of search results to return (1-50)" - }, - "ranking_options": { - "type": "object", - "properties": { - "ranker": { - "type": "string", - "description": "(Optional) Name of the ranking algorithm to use" - }, - "score_threshold": { - "type": "number", - "default": 0.0, - "description": "(Optional) Minimum relevance score threshold for results" - } - }, - "additionalProperties": false, - "description": "(Optional) Options for ranking and scoring search results" - } - }, - "additionalProperties": false, - "required": [ - "type", - "vector_store_ids" - ], - "title": "OpenAIResponseInputToolFileSearch", - "description": "File search tool configuration for OpenAI response inputs." - }, - "OpenAIResponseInputToolFunction": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "function", - "default": "function", - "description": "Tool type identifier, always \"function\"" - }, - "name": { - "type": "string", - "description": "Name of the function that can be called" - }, - "description": { - "type": "string", - "description": "(Optional) Description of what the function does" - }, - "parameters": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "(Optional) JSON schema defining the function's parameters" - }, - "strict": { - "type": "boolean", - "description": "(Optional) Whether to enforce strict parameter validation" - } - }, - "additionalProperties": false, - "required": [ - "type", - "name" - ], - "title": "OpenAIResponseInputToolFunction", - "description": "Function tool configuration for OpenAI response inputs." - }, - "OpenAIResponseInputToolWebSearch": { - "type": "object", - "properties": { - "type": { - "oneOf": [ - { - "type": "string", - "const": "web_search" - }, - { - "type": "string", - "const": "web_search_preview" - }, - { - "type": "string", - "const": "web_search_preview_2025_03_11" - } - ], - "default": "web_search", - "description": "Web search tool type variant to use" - }, - "search_context_size": { - "type": "string", - "default": "medium", - "description": "(Optional) Size of search context, must be \"low\", \"medium\", or \"high\"" - } - }, - "additionalProperties": false, - "required": [ - "type" - ], - "title": "OpenAIResponseInputToolWebSearch", - "description": "Web search tool configuration for OpenAI response inputs." - }, "OpenAIResponseMCPApprovalRequest": { "type": "object", "properties": { @@ -9914,147 +9732,6 @@ "title": "ResponseShieldSpec", "description": "Specification for a shield to apply during response generation." }, - "OpenAIResponseInputTool": { - "oneOf": [ - { - "$ref": "#/components/schemas/OpenAIResponseInputToolWebSearch" - }, - { - "$ref": "#/components/schemas/OpenAIResponseInputToolFileSearch" - }, - { - "$ref": "#/components/schemas/OpenAIResponseInputToolFunction" - }, - { - "$ref": "#/components/schemas/OpenAIResponseInputToolMCP" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "web_search": "#/components/schemas/OpenAIResponseInputToolWebSearch", - "file_search": "#/components/schemas/OpenAIResponseInputToolFileSearch", - "function": "#/components/schemas/OpenAIResponseInputToolFunction", - "mcp": "#/components/schemas/OpenAIResponseInputToolMCP" - } - } - }, - "OpenAIResponseInputToolMCP": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "mcp", - "default": "mcp", - "description": "Tool type identifier, always \"mcp\"" - }, - "server_label": { - "type": "string", - "description": "Label to identify this MCP server" - }, - "server_url": { - "type": "string", - "description": "URL endpoint of the MCP server" - }, - "headers": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "(Optional) HTTP headers to include when connecting to the server" - }, - "require_approval": { - "oneOf": [ - { - "type": "string", - "const": "always" - }, - { - "type": "string", - "const": "never" - }, - { - "type": "object", - "properties": { - "always": { - "type": "array", - "items": { - "type": "string" - }, - "description": "(Optional) List of tool names that always require approval" - }, - "never": { - "type": "array", - "items": { - "type": "string" - }, - "description": "(Optional) List of tool names that never require approval" - } - }, - "additionalProperties": false, - "title": "ApprovalFilter", - "description": "Filter configuration for MCP tool approval requirements." - } - ], - "default": "never", - "description": "Approval requirement for tool calls (\"always\", \"never\", or filter)" - }, - "allowed_tools": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string" - } - }, - { - "type": "object", - "properties": { - "tool_names": { - "type": "array", - "items": { - "type": "string" - }, - "description": "(Optional) List of specific tool names that are allowed" - } - }, - "additionalProperties": false, - "title": "AllowedToolsFilter", - "description": "Filter configuration for restricting which MCP tools can be used." - } - ], - "description": "(Optional) Restriction on which tools can be used from this server" - } - }, - "additionalProperties": false, - "required": [ - "type", - "server_label", - "server_url", - "require_approval" - ], - "title": "OpenAIResponseInputToolMCP", - "description": "Model Context Protocol (MCP) tool configuration for OpenAI response inputs." - }, "CreateOpenaiResponseRequest": { "type": "object", "properties": { diff --git a/docs/static/deprecated-llama-stack-spec.yaml b/docs/static/deprecated-llama-stack-spec.yaml index 98af89fa8..862097ce6 100644 --- a/docs/static/deprecated-llama-stack-spec.yaml +++ b/docs/static/deprecated-llama-stack-spec.yaml @@ -2890,8 +2890,16 @@ components: AgentConfig: type: object properties: - sampling_params: - $ref: '#/components/schemas/SamplingParams' + max_output_tokens: + type: integer + temperature: + type: number + top_p: + type: number + stop: + type: array + items: + type: string input_shields: type: array items: @@ -2900,36 +2908,16 @@ components: type: array items: type: string - toolgroups: + tools: type: array items: - $ref: '#/components/schemas/AgentTool' + $ref: '#/components/schemas/OpenAIResponseInputTool' client_tools: type: array items: - $ref: '#/components/schemas/ToolDef' - tool_choice: - type: string - enum: - - auto - - required - - none - title: ToolChoice - description: >- - Whether tool use is required or automatic. This is a hint to the model - which may not be followed. It depends on the Instruction Following capabilities - of the model. - deprecated: true - tool_prompt_format: - type: string - enum: - - json - - function_tag - - python_list - title: ToolPromptFormat - description: >- - Prompt format for calling custom / zero shot tools. - deprecated: true + oneOf: + - $ref: '#/components/schemas/OpenAIResponseInputTool' + - $ref: '#/components/schemas/ToolDef' tool_config: $ref: '#/components/schemas/ToolConfig' max_infer_iters: @@ -2952,7 +2940,7 @@ components: description: >- Optional flag indicating whether session data has to be persisted response_format: - $ref: '#/components/schemas/ResponseFormat' + $ref: '#/components/schemas/OpenAIResponseFormatParam' description: Optional response format configuration additionalProperties: false required: @@ -2960,41 +2948,20 @@ components: - instructions title: AgentConfig description: Configuration for an agent. - AgentTool: - oneOf: - - type: string - - type: object - properties: - name: - type: string - args: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - additionalProperties: false - required: - - name - - args - title: AgentToolGroupWithArgs - GrammarResponseFormat: + OpenAIJSONSchema: type: object properties: - type: + name: type: string - enum: - - json_schema - - grammar + description: Name of the schema + description: + type: string + description: (Optional) Description of the schema + strict: + type: boolean description: >- - Must be "grammar" to identify this format type - const: grammar - default: grammar - bnf: + (Optional) Whether to enforce strict adherence to the schema + schema: type: object additionalProperties: oneOf: @@ -3004,113 +2971,284 @@ components: - type: string - type: array - type: object - description: >- - The BNF grammar specification the response should conform to + description: (Optional) The JSON schema definition additionalProperties: false required: - - type - - bnf - title: GrammarResponseFormat + - name + title: OpenAIJSONSchema description: >- - Configuration for grammar-guided response generation. - GreedySamplingStrategy: + JSON schema specification for OpenAI-compatible structured response format. + OpenAIResponseFormatJSONObject: type: object properties: type: type: string - const: greedy - default: greedy + const: json_object + default: json_object description: >- - Must be "greedy" to identify this sampling strategy + Must be "json_object" to indicate generic JSON object response format additionalProperties: false required: - type - title: GreedySamplingStrategy + title: OpenAIResponseFormatJSONObject description: >- - Greedy sampling strategy that selects the highest probability token at each - step. - JsonSchemaResponseFormat: + JSON object response format for OpenAI-compatible chat completion requests. + OpenAIResponseFormatJSONSchema: type: object properties: type: type: string - enum: - - json_schema - - grammar - description: >- - Must be "json_schema" to identify this format type const: json_schema default: json_schema - json_schema: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object description: >- - The JSON schema the response should conform to. In a Python SDK, this - is often a `pydantic` model. + Must be "json_schema" to indicate structured JSON response format + json_schema: + $ref: '#/components/schemas/OpenAIJSONSchema' + description: >- + The JSON schema specification for the response additionalProperties: false required: - type - json_schema - title: JsonSchemaResponseFormat + title: OpenAIResponseFormatJSONSchema description: >- - Configuration for JSON schema-guided response generation. - ResponseFormat: + JSON schema response format for OpenAI-compatible chat completion requests. + OpenAIResponseFormatParam: oneOf: - - $ref: '#/components/schemas/JsonSchemaResponseFormat' - - $ref: '#/components/schemas/GrammarResponseFormat' + - $ref: '#/components/schemas/OpenAIResponseFormatText' + - $ref: '#/components/schemas/OpenAIResponseFormatJSONSchema' + - $ref: '#/components/schemas/OpenAIResponseFormatJSONObject' discriminator: propertyName: type mapping: - json_schema: '#/components/schemas/JsonSchemaResponseFormat' - grammar: '#/components/schemas/GrammarResponseFormat' - SamplingParams: + text: '#/components/schemas/OpenAIResponseFormatText' + json_schema: '#/components/schemas/OpenAIResponseFormatJSONSchema' + json_object: '#/components/schemas/OpenAIResponseFormatJSONObject' + OpenAIResponseFormatText: type: object properties: - strategy: - oneOf: - - $ref: '#/components/schemas/GreedySamplingStrategy' - - $ref: '#/components/schemas/TopPSamplingStrategy' - - $ref: '#/components/schemas/TopKSamplingStrategy' - discriminator: - propertyName: type - mapping: - greedy: '#/components/schemas/GreedySamplingStrategy' - top_p: '#/components/schemas/TopPSamplingStrategy' - top_k: '#/components/schemas/TopKSamplingStrategy' - description: The sampling strategy. - max_tokens: - type: integer - default: 0 + type: + type: string + const: text + default: text description: >- - The maximum number of tokens that can be generated in the completion. - The token count of your prompt plus max_tokens cannot exceed the model's - context length. - repetition_penalty: - type: number - default: 1.0 + Must be "text" to indicate plain text response format + additionalProperties: false + required: + - type + title: OpenAIResponseFormatText + description: >- + Text response format for OpenAI-compatible chat completion requests. + OpenAIResponseInputTool: + oneOf: + - $ref: '#/components/schemas/OpenAIResponseInputToolWebSearch' + - $ref: '#/components/schemas/OpenAIResponseInputToolFileSearch' + - $ref: '#/components/schemas/OpenAIResponseInputToolFunction' + - $ref: '#/components/schemas/OpenAIResponseInputToolMCP' + discriminator: + propertyName: type + mapping: + web_search: '#/components/schemas/OpenAIResponseInputToolWebSearch' + file_search: '#/components/schemas/OpenAIResponseInputToolFileSearch' + function: '#/components/schemas/OpenAIResponseInputToolFunction' + mcp: '#/components/schemas/OpenAIResponseInputToolMCP' + OpenAIResponseInputToolFileSearch: + type: object + properties: + type: + type: string + const: file_search + default: file_search description: >- - Number between -2.0 and 2.0. Positive values penalize new tokens based - on whether they appear in the text so far, increasing the model's likelihood - to talk about new topics. - stop: + Tool type identifier, always "file_search" + vector_store_ids: type: array items: type: string description: >- - Up to 4 sequences where the API will stop generating further tokens. The - returned text will not contain the stop sequence. + List of vector store identifiers to search within + filters: + type: object + additionalProperties: + oneOf: + - type: 'null' + - type: boolean + - type: number + - type: string + - type: array + - type: object + description: >- + (Optional) Additional filters to apply to the search + max_num_results: + type: integer + default: 10 + description: >- + (Optional) Maximum number of search results to return (1-50) + ranking_options: + type: object + properties: + ranker: + type: string + description: >- + (Optional) Name of the ranking algorithm to use + score_threshold: + type: number + default: 0.0 + description: >- + (Optional) Minimum relevance score threshold for results + additionalProperties: false + description: >- + (Optional) Options for ranking and scoring search results additionalProperties: false required: - - strategy - title: SamplingParams - description: Sampling parameters. + - type + - vector_store_ids + title: OpenAIResponseInputToolFileSearch + description: >- + File search tool configuration for OpenAI response inputs. + OpenAIResponseInputToolFunction: + type: object + properties: + type: + type: string + const: function + default: function + description: Tool type identifier, always "function" + name: + type: string + description: Name of the function that can be called + description: + type: string + description: >- + (Optional) Description of what the function does + parameters: + type: object + additionalProperties: + oneOf: + - type: 'null' + - type: boolean + - type: number + - type: string + - type: array + - type: object + description: >- + (Optional) JSON schema defining the function's parameters + strict: + type: boolean + description: >- + (Optional) Whether to enforce strict parameter validation + additionalProperties: false + required: + - type + - name + title: OpenAIResponseInputToolFunction + description: >- + Function tool configuration for OpenAI response inputs. + OpenAIResponseInputToolMCP: + type: object + properties: + type: + type: string + const: mcp + default: mcp + description: Tool type identifier, always "mcp" + server_label: + type: string + description: Label to identify this MCP server + server_url: + type: string + description: URL endpoint of the MCP server + headers: + type: object + additionalProperties: + oneOf: + - type: 'null' + - type: boolean + - type: number + - type: string + - type: array + - type: object + description: >- + (Optional) HTTP headers to include when connecting to the server + require_approval: + oneOf: + - type: string + const: always + - type: string + const: never + - type: object + properties: + always: + type: array + items: + type: string + description: >- + (Optional) List of tool names that always require approval + never: + type: array + items: + type: string + description: >- + (Optional) List of tool names that never require approval + additionalProperties: false + title: ApprovalFilter + description: >- + Filter configuration for MCP tool approval requirements. + default: never + description: >- + Approval requirement for tool calls ("always", "never", or filter) + allowed_tools: + oneOf: + - type: array + items: + type: string + - type: object + properties: + tool_names: + type: array + items: + type: string + description: >- + (Optional) List of specific tool names that are allowed + additionalProperties: false + title: AllowedToolsFilter + description: >- + Filter configuration for restricting which MCP tools can be used. + description: >- + (Optional) Restriction on which tools can be used from this server + additionalProperties: false + required: + - type + - server_label + - server_url + - require_approval + title: OpenAIResponseInputToolMCP + description: >- + Model Context Protocol (MCP) tool configuration for OpenAI response inputs. + OpenAIResponseInputToolWebSearch: + type: object + properties: + type: + oneOf: + - type: string + const: web_search + - type: string + const: web_search_preview + - type: string + const: web_search_preview_2025_03_11 + default: web_search + description: Web search tool type variant to use + search_context_size: + type: string + default: medium + description: >- + (Optional) Size of search context, must be "low", "medium", or "high" + additionalProperties: false + required: + - type + title: OpenAIResponseInputToolWebSearch + description: >- + Web search tool configuration for OpenAI response inputs. ToolConfig: type: object properties: @@ -3215,51 +3353,6 @@ components: title: ToolDef description: >- Tool definition used in runtime contexts. - TopKSamplingStrategy: - type: object - properties: - type: - type: string - const: top_k - default: top_k - description: >- - Must be "top_k" to identify this sampling strategy - top_k: - type: integer - description: >- - Number of top tokens to consider for sampling. Must be at least 1 - additionalProperties: false - required: - - type - - top_k - title: TopKSamplingStrategy - description: >- - Top-k sampling strategy that restricts sampling to the k most likely tokens. - TopPSamplingStrategy: - type: object - properties: - type: - type: string - const: top_p - default: top_p - description: >- - Must be "top_p" to identify this sampling strategy - temperature: - type: number - description: >- - Controls randomness in sampling. Higher values increase randomness - top_p: - type: number - default: 0.95 - description: >- - Cumulative probability threshold for nucleus sampling. Defaults to 0.95 - additionalProperties: false - required: - - type - title: TopPSamplingStrategy - description: >- - Top-p (nucleus) sampling strategy that samples from the smallest set of tokens - with cumulative probability >= p. CreateAgentRequest: type: object properties: @@ -3326,75 +3419,6 @@ components: title: AgentSessionCreateResponse description: >- Response returned when creating a new agent session. - CompletionMessage: - type: object - properties: - role: - type: string - const: assistant - default: assistant - description: >- - Must be "assistant" to identify this as the model's response - content: - $ref: '#/components/schemas/InterleavedContent' - description: The content of the model's response - stop_reason: - type: string - enum: - - end_of_turn - - end_of_message - - out_of_tokens - description: >- - Reason why the model stopped generating. Options are: - `StopReason.end_of_turn`: - The model finished generating the entire response. - `StopReason.end_of_message`: - The model finished generating but generated a partial response -- usually, - a tool call. The user may call the tool and continue the conversation - with the tool's response. - `StopReason.out_of_tokens`: The model ran - out of token budget. - tool_calls: - type: array - items: - $ref: '#/components/schemas/ToolCall' - description: >- - List of tool calls. Each tool call is a ToolCall object. - additionalProperties: false - required: - - role - - content - - stop_reason - title: CompletionMessage - description: >- - A message containing the model's (assistant) response in a chat conversation. - ImageContentItem: - type: object - properties: - type: - type: string - const: image - default: image - description: >- - Discriminator type of the content item. Always "image" - image: - type: object - properties: - url: - $ref: '#/components/schemas/URL' - description: >- - A URL of the image or data URL in the format of data:image/{type};base64,{data}. - Note that URL could have length limits. - data: - type: string - contentEncoding: base64 - description: base64 encoded image data as string - additionalProperties: false - description: >- - Image as a base64 encoded string or an URL - additionalProperties: false - required: - - type - - image - title: ImageContentItem - description: A image content item InferenceStep: type: object properties: @@ -3424,8 +3448,10 @@ components: const: inference default: inference model_response: - $ref: '#/components/schemas/CompletionMessage' + $ref: '#/components/schemas/OpenAIAssistantMessageParam' description: The response from the LLM. + finish_reason: + type: string additionalProperties: false required: - turn_id @@ -3434,22 +3460,6 @@ components: - model_response title: InferenceStep description: An inference step in an agent turn. - InterleavedContent: - oneOf: - - type: string - - $ref: '#/components/schemas/InterleavedContentItem' - - type: array - items: - $ref: '#/components/schemas/InterleavedContentItem' - InterleavedContentItem: - oneOf: - - $ref: '#/components/schemas/ImageContentItem' - - $ref: '#/components/schemas/TextContentItem' - discriminator: - propertyName: type - mapping: - image: '#/components/schemas/ImageContentItem' - text: '#/components/schemas/TextContentItem' MemoryRetrievalStep: type: object properties: @@ -3483,7 +3493,11 @@ components: description: >- The IDs of the vector databases to retrieve context from. inserted_context: - $ref: '#/components/schemas/InterleavedContent' + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionContentPartParam' description: >- The context retrieved from the vector databases. additionalProperties: false @@ -3496,6 +3510,303 @@ components: title: MemoryRetrievalStep description: >- A memory retrieval step in an agent turn. + OpenAIAssistantMessageParam: + type: object + properties: + role: + type: string + const: assistant + default: assistant + description: >- + Must be "assistant" to identify this as the model's response + content: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' + description: The content of the model's response + name: + type: string + description: >- + (Optional) The name of the assistant message participant. + tool_calls: + type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionToolCall' + description: >- + List of tool calls. Each tool call is an OpenAIChatCompletionToolCall + object. + additionalProperties: false + required: + - role + title: OpenAIAssistantMessageParam + description: >- + A message containing the model's (assistant) response in an OpenAI-compatible + chat completion request. + "OpenAIChatCompletionContentPartImageParam": + type: object + properties: + type: + type: string + const: image_url + default: image_url + description: >- + Must be "image_url" to identify this as image content + image_url: + $ref: '#/components/schemas/OpenAIImageURL' + description: >- + Image URL specification and processing details + additionalProperties: false + required: + - type + - image_url + title: >- + OpenAIChatCompletionContentPartImageParam + description: >- + Image content part for OpenAI-compatible chat completion messages. + OpenAIChatCompletionContentPartParam: + oneOf: + - $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' + - $ref: '#/components/schemas/OpenAIChatCompletionContentPartImageParam' + - $ref: '#/components/schemas/OpenAIFile' + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' + image_url: '#/components/schemas/OpenAIChatCompletionContentPartImageParam' + file: '#/components/schemas/OpenAIFile' + OpenAIChatCompletionContentPartTextParam: + type: object + properties: + type: + type: string + const: text + default: text + description: >- + Must be "text" to identify this as text content + text: + type: string + description: The text content of the message + additionalProperties: false + required: + - type + - text + title: OpenAIChatCompletionContentPartTextParam + description: >- + Text content part for OpenAI-compatible chat completion messages. + OpenAIChatCompletionToolCall: + type: object + properties: + index: + type: integer + description: >- + (Optional) Index of the tool call in the list + id: + type: string + description: >- + (Optional) Unique identifier for the tool call + type: + type: string + const: function + default: function + description: >- + Must be "function" to identify this as a function call + function: + $ref: '#/components/schemas/OpenAIChatCompletionToolCallFunction' + description: (Optional) Function call details + additionalProperties: false + required: + - type + title: OpenAIChatCompletionToolCall + description: >- + Tool call specification for OpenAI-compatible chat completion responses. + OpenAIChatCompletionToolCallFunction: + type: object + properties: + name: + type: string + description: (Optional) Name of the function to call + arguments: + type: string + description: >- + (Optional) Arguments to pass to the function as a JSON string + additionalProperties: false + title: OpenAIChatCompletionToolCallFunction + description: >- + Function call details for OpenAI-compatible tool calls. + OpenAIDeveloperMessageParam: + type: object + properties: + role: + type: string + const: developer + default: developer + description: >- + Must be "developer" to identify this as a developer message + content: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' + description: The content of the developer message + name: + type: string + description: >- + (Optional) The name of the developer message participant. + additionalProperties: false + required: + - role + - content + title: OpenAIDeveloperMessageParam + description: >- + A message from the developer in an OpenAI-compatible chat completion request. + OpenAIFile: + type: object + properties: + type: + type: string + const: file + default: file + file: + $ref: '#/components/schemas/OpenAIFileFile' + additionalProperties: false + required: + - type + - file + title: OpenAIFile + OpenAIFileFile: + type: object + properties: + file_data: + type: string + file_id: + type: string + filename: + type: string + additionalProperties: false + title: OpenAIFileFile + OpenAIImageURL: + type: object + properties: + url: + type: string + description: >- + URL of the image to include in the message + detail: + type: string + description: >- + (Optional) Level of detail for image processing. Can be "low", "high", + or "auto" + additionalProperties: false + required: + - url + title: OpenAIImageURL + description: >- + Image URL specification for OpenAI-compatible chat completion messages. + OpenAIMessageParam: + oneOf: + - $ref: '#/components/schemas/OpenAIUserMessageParam' + - $ref: '#/components/schemas/OpenAISystemMessageParam' + - $ref: '#/components/schemas/OpenAIAssistantMessageParam' + - $ref: '#/components/schemas/OpenAIToolMessageParam' + - $ref: '#/components/schemas/OpenAIDeveloperMessageParam' + discriminator: + propertyName: role + mapping: + user: '#/components/schemas/OpenAIUserMessageParam' + system: '#/components/schemas/OpenAISystemMessageParam' + assistant: '#/components/schemas/OpenAIAssistantMessageParam' + tool: '#/components/schemas/OpenAIToolMessageParam' + developer: '#/components/schemas/OpenAIDeveloperMessageParam' + OpenAISystemMessageParam: + type: object + properties: + role: + type: string + const: system + default: system + description: >- + Must be "system" to identify this as a system message + content: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' + description: >- + The content of the "system prompt". If multiple system messages are provided, + they are concatenated. The underlying Llama Stack code may also add other + system messages (for example, for formatting tool definitions). + name: + type: string + description: >- + (Optional) The name of the system message participant. + additionalProperties: false + required: + - role + - content + title: OpenAISystemMessageParam + description: >- + A system message providing instructions or context to the model. + OpenAIToolMessageParam: + type: object + properties: + role: + type: string + const: tool + default: tool + description: >- + Must be "tool" to identify this as a tool response + tool_call_id: + type: string + description: >- + Unique identifier for the tool call this response is for + content: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' + description: The response content from the tool + additionalProperties: false + required: + - role + - tool_call_id + - content + title: OpenAIToolMessageParam + description: >- + A message representing the result of a tool invocation in an OpenAI-compatible + chat completion request. + OpenAIUserMessageParam: + type: object + properties: + role: + type: string + const: user + default: user + description: >- + Must be "user" to identify this as a user message + content: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionContentPartParam' + description: >- + The content of the message, which can include text and other media + name: + type: string + description: >- + (Optional) The name of the user message participant. + additionalProperties: false + required: + - role + - content + title: OpenAIUserMessageParam + description: >- + A message from the user in an OpenAI-compatible chat completion request. SafetyViolation: type: object properties: @@ -3593,47 +3904,6 @@ components: - step_type title: ShieldCallStep description: A shield call step in an agent turn. - TextContentItem: - type: object - properties: - type: - type: string - const: text - default: text - description: >- - Discriminator type of the content item. Always "text" - text: - type: string - description: Text content - additionalProperties: false - required: - - type - - text - title: TextContentItem - description: A text content item - ToolCall: - type: object - properties: - call_id: - type: string - tool_name: - oneOf: - - type: string - enum: - - brave_search - - wolfram_alpha - - photogen - - code_interpreter - title: BuiltinTool - - type: string - arguments: - type: string - additionalProperties: false - required: - - call_id - - tool_name - - arguments - title: ToolCall ToolExecutionStep: type: object properties: @@ -3665,12 +3935,12 @@ components: tool_calls: type: array items: - $ref: '#/components/schemas/ToolCall' + $ref: '#/components/schemas/OpenAIChatCompletionToolCall' description: The tool calls to execute. tool_responses: type: array items: - $ref: '#/components/schemas/ToolResponse' + $ref: '#/components/schemas/OpenAIToolMessageParam' description: The tool responses from the tool calls. additionalProperties: false required: @@ -3681,70 +3951,6 @@ components: - tool_responses title: ToolExecutionStep description: A tool execution step in an agent turn. - ToolResponse: - type: object - properties: - call_id: - type: string - description: >- - Unique identifier for the tool call this response is for - tool_name: - oneOf: - - type: string - enum: - - brave_search - - wolfram_alpha - - photogen - - code_interpreter - title: BuiltinTool - - type: string - description: Name of the tool that was invoked - content: - $ref: '#/components/schemas/InterleavedContent' - description: The response content from the tool - metadata: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - description: >- - (Optional) Additional metadata about the tool response - additionalProperties: false - required: - - call_id - - tool_name - - content - title: ToolResponse - description: Response from a tool invocation. - ToolResponseMessage: - type: object - properties: - role: - type: string - const: tool - default: tool - description: >- - Must be "tool" to identify this as a tool response - call_id: - type: string - description: >- - Unique identifier for the tool call this response is for - content: - $ref: '#/components/schemas/InterleavedContent' - description: The response content from the tool - additionalProperties: false - required: - - role - - call_id - - content - title: ToolResponseMessage - description: >- - A message representing the result of a tool invocation. Turn: type: object properties: @@ -3759,9 +3965,7 @@ components: input_messages: type: array items: - oneOf: - - $ref: '#/components/schemas/UserMessage' - - $ref: '#/components/schemas/ToolResponseMessage' + $ref: '#/components/schemas/OpenAIMessageParam' description: >- List of messages that initiated this turn steps: @@ -3782,9 +3986,11 @@ components: description: >- Ordered list of processing steps executed during this turn output_message: - $ref: '#/components/schemas/CompletionMessage' + $ref: '#/components/schemas/OpenAIAssistantMessageParam' description: >- The model's generated response containing content and metadata + finish_reason: + type: string output_attachments: type: array items: @@ -3793,10 +3999,9 @@ components: content: oneOf: - type: string - - $ref: '#/components/schemas/InterleavedContentItem' - type: array items: - $ref: '#/components/schemas/InterleavedContentItem' + $ref: '#/components/schemas/OpenAIChatCompletionContentPartParam' - $ref: '#/components/schemas/URL' description: The content of the attachment. mime_type: @@ -3841,31 +4046,6 @@ components: - uri title: URL description: A URL reference to external content. - UserMessage: - type: object - properties: - role: - type: string - const: user - default: user - description: >- - Must be "user" to identify this as a user message - content: - $ref: '#/components/schemas/InterleavedContent' - description: >- - The content of the message, which can include text and other media - context: - $ref: '#/components/schemas/InterleavedContent' - description: >- - (Optional) This field is used internally by Llama Stack to pass RAG context. - This field may be removed in the API in the future. - additionalProperties: false - required: - - role - - content - title: UserMessage - description: >- - A message from the user in a chat conversation. ViolationLevel: type: string enum: @@ -3880,9 +4060,7 @@ components: messages: type: array items: - oneOf: - - $ref: '#/components/schemas/UserMessage' - - $ref: '#/components/schemas/ToolResponseMessage' + $ref: '#/components/schemas/OpenAIMessageParam' description: List of messages to start the turn with. stream: type: boolean @@ -3897,10 +4075,9 @@ components: content: oneOf: - type: string - - $ref: '#/components/schemas/InterleavedContentItem' - type: array items: - $ref: '#/components/schemas/InterleavedContentItem' + $ref: '#/components/schemas/OpenAIChatCompletionContentPartParam' - $ref: '#/components/schemas/URL' description: The content of the document. mime_type: @@ -3914,13 +4091,13 @@ components: description: A document to be used by an agent. description: >- (Optional) List of documents to create the turn with. - toolgroups: + tools: type: array items: - $ref: '#/components/schemas/AgentTool' + $ref: '#/components/schemas/OpenAIResponseInputTool' description: >- - (Optional) List of toolgroups to create the turn with, will be used in - addition to the agent's config toolgroups for the request. + (Optional) List of tools to create the turn with, will be used in addition + to the agent's config tools for the request. tool_config: $ref: '#/components/schemas/ToolConfig' description: >- @@ -4234,6 +4411,29 @@ components: title: TextDelta description: >- A text content delta for streaming responses. + ToolCall: + type: object + properties: + call_id: + type: string + tool_name: + oneOf: + - type: string + enum: + - brave_search + - wolfram_alpha + - photogen + - code_interpreter + title: BuiltinTool + - type: string + arguments: + type: string + additionalProperties: false + required: + - call_id + - tool_name + - arguments + title: ToolCall ToolCallDelta: type: object properties: @@ -4271,7 +4471,7 @@ components: tool_responses: type: array items: - $ref: '#/components/schemas/ToolResponse' + $ref: '#/components/schemas/OpenAIToolMessageParam' description: >- The tool call responses to resume the turn with. stream: @@ -4704,6 +4904,68 @@ components: title: BenchmarkConfig description: >- A benchmark configuration for evaluation. + GreedySamplingStrategy: + type: object + properties: + type: + type: string + const: greedy + default: greedy + description: >- + Must be "greedy" to identify this sampling strategy + additionalProperties: false + required: + - type + title: GreedySamplingStrategy + description: >- + Greedy sampling strategy that selects the highest probability token at each + step. + ImageContentItem: + type: object + properties: + type: + type: string + const: image + default: image + description: >- + Discriminator type of the content item. Always "image" + image: + type: object + properties: + url: + $ref: '#/components/schemas/URL' + description: >- + A URL of the image or data URL in the format of data:image/{type};base64,{data}. + Note that URL could have length limits. + data: + type: string + contentEncoding: base64 + description: base64 encoded image data as string + additionalProperties: false + description: >- + Image as a base64 encoded string or an URL + additionalProperties: false + required: + - type + - image + title: ImageContentItem + description: A image content item + InterleavedContent: + oneOf: + - type: string + - $ref: '#/components/schemas/InterleavedContentItem' + - type: array + items: + $ref: '#/components/schemas/InterleavedContentItem' + InterleavedContentItem: + oneOf: + - $ref: '#/components/schemas/ImageContentItem' + - $ref: '#/components/schemas/TextContentItem' + discriminator: + propertyName: type + mapping: + image: '#/components/schemas/ImageContentItem' + text: '#/components/schemas/TextContentItem' LLMAsJudgeScoringFnParams: type: object properties: @@ -4796,6 +5058,47 @@ components: title: RegexParserScoringFnParams description: >- Parameters for regex parser scoring function configuration. + SamplingParams: + type: object + properties: + strategy: + oneOf: + - $ref: '#/components/schemas/GreedySamplingStrategy' + - $ref: '#/components/schemas/TopPSamplingStrategy' + - $ref: '#/components/schemas/TopKSamplingStrategy' + discriminator: + propertyName: type + mapping: + greedy: '#/components/schemas/GreedySamplingStrategy' + top_p: '#/components/schemas/TopPSamplingStrategy' + top_k: '#/components/schemas/TopKSamplingStrategy' + description: The sampling strategy. + max_tokens: + type: integer + default: 0 + description: >- + The maximum number of tokens that can be generated in the completion. + The token count of your prompt plus max_tokens cannot exceed the model's + context length. + repetition_penalty: + type: number + default: 1.0 + description: >- + Number between -2.0 and 2.0. Positive values penalize new tokens based + on whether they appear in the text so far, increasing the model's likelihood + to talk about new topics. + stop: + type: array + items: + type: string + description: >- + Up to 4 sequences where the API will stop generating further tokens. The + returned text will not contain the stop sequence. + additionalProperties: false + required: + - strategy + title: SamplingParams + description: Sampling parameters. ScoringFnParams: oneOf: - $ref: '#/components/schemas/LLMAsJudgeScoringFnParams' @@ -4838,6 +5141,69 @@ components: title: SystemMessage description: >- A system message providing instructions or context to the model. + TextContentItem: + type: object + properties: + type: + type: string + const: text + default: text + description: >- + Discriminator type of the content item. Always "text" + text: + type: string + description: Text content + additionalProperties: false + required: + - type + - text + title: TextContentItem + description: A text content item + TopKSamplingStrategy: + type: object + properties: + type: + type: string + const: top_k + default: top_k + description: >- + Must be "top_k" to identify this sampling strategy + top_k: + type: integer + description: >- + Number of top tokens to consider for sampling. Must be at least 1 + additionalProperties: false + required: + - type + - top_k + title: TopKSamplingStrategy + description: >- + Top-k sampling strategy that restricts sampling to the k most likely tokens. + TopPSamplingStrategy: + type: object + properties: + type: + type: string + const: top_p + default: top_p + description: >- + Must be "top_p" to identify this sampling strategy + temperature: + type: number + description: >- + Controls randomness in sampling. Higher values increase randomness + top_p: + type: number + default: 0.95 + description: >- + Cumulative probability threshold for nucleus sampling. Defaults to 0.95 + additionalProperties: false + required: + - type + title: TopPSamplingStrategy + description: >- + Top-p (nucleus) sampling strategy that samples from the smallest set of tokens + with cumulative probability >= p. EvaluateRowsRequest: type: object properties: @@ -5044,131 +5410,6 @@ components: title: ListOpenAIChatCompletionResponse description: >- Response from listing OpenAI-compatible chat completions. - OpenAIAssistantMessageParam: - type: object - properties: - role: - type: string - const: assistant - default: assistant - description: >- - Must be "assistant" to identify this as the model's response - content: - oneOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' - description: The content of the model's response - name: - type: string - description: >- - (Optional) The name of the assistant message participant. - tool_calls: - type: array - items: - $ref: '#/components/schemas/OpenAIChatCompletionToolCall' - description: >- - List of tool calls. Each tool call is an OpenAIChatCompletionToolCall - object. - additionalProperties: false - required: - - role - title: OpenAIAssistantMessageParam - description: >- - A message containing the model's (assistant) response in an OpenAI-compatible - chat completion request. - "OpenAIChatCompletionContentPartImageParam": - type: object - properties: - type: - type: string - const: image_url - default: image_url - description: >- - Must be "image_url" to identify this as image content - image_url: - $ref: '#/components/schemas/OpenAIImageURL' - description: >- - Image URL specification and processing details - additionalProperties: false - required: - - type - - image_url - title: >- - OpenAIChatCompletionContentPartImageParam - description: >- - Image content part for OpenAI-compatible chat completion messages. - OpenAIChatCompletionContentPartParam: - oneOf: - - $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' - - $ref: '#/components/schemas/OpenAIChatCompletionContentPartImageParam' - - $ref: '#/components/schemas/OpenAIFile' - discriminator: - propertyName: type - mapping: - text: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' - image_url: '#/components/schemas/OpenAIChatCompletionContentPartImageParam' - file: '#/components/schemas/OpenAIFile' - OpenAIChatCompletionContentPartTextParam: - type: object - properties: - type: - type: string - const: text - default: text - description: >- - Must be "text" to identify this as text content - text: - type: string - description: The text content of the message - additionalProperties: false - required: - - type - - text - title: OpenAIChatCompletionContentPartTextParam - description: >- - Text content part for OpenAI-compatible chat completion messages. - OpenAIChatCompletionToolCall: - type: object - properties: - index: - type: integer - description: >- - (Optional) Index of the tool call in the list - id: - type: string - description: >- - (Optional) Unique identifier for the tool call - type: - type: string - const: function - default: function - description: >- - Must be "function" to identify this as a function call - function: - $ref: '#/components/schemas/OpenAIChatCompletionToolCallFunction' - description: (Optional) Function call details - additionalProperties: false - required: - - type - title: OpenAIChatCompletionToolCall - description: >- - Tool call specification for OpenAI-compatible chat completion responses. - OpenAIChatCompletionToolCallFunction: - type: object - properties: - name: - type: string - description: (Optional) Name of the function to call - arguments: - type: string - description: >- - (Optional) Arguments to pass to the function as a JSON string - additionalProperties: false - title: OpenAIChatCompletionToolCallFunction - description: >- - Function call details for OpenAI-compatible tool calls. OpenAIChatCompletionUsage: type: object properties: @@ -5269,121 +5510,6 @@ components: description: >- The log probabilities for the tokens in the message from an OpenAI-compatible chat completion response. - OpenAIDeveloperMessageParam: - type: object - properties: - role: - type: string - const: developer - default: developer - description: >- - Must be "developer" to identify this as a developer message - content: - oneOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' - description: The content of the developer message - name: - type: string - description: >- - (Optional) The name of the developer message participant. - additionalProperties: false - required: - - role - - content - title: OpenAIDeveloperMessageParam - description: >- - A message from the developer in an OpenAI-compatible chat completion request. - OpenAIFile: - type: object - properties: - type: - type: string - const: file - default: file - file: - $ref: '#/components/schemas/OpenAIFileFile' - additionalProperties: false - required: - - type - - file - title: OpenAIFile - OpenAIFileFile: - type: object - properties: - file_data: - type: string - file_id: - type: string - filename: - type: string - additionalProperties: false - title: OpenAIFileFile - OpenAIImageURL: - type: object - properties: - url: - type: string - description: >- - URL of the image to include in the message - detail: - type: string - description: >- - (Optional) Level of detail for image processing. Can be "low", "high", - or "auto" - additionalProperties: false - required: - - url - title: OpenAIImageURL - description: >- - Image URL specification for OpenAI-compatible chat completion messages. - OpenAIMessageParam: - oneOf: - - $ref: '#/components/schemas/OpenAIUserMessageParam' - - $ref: '#/components/schemas/OpenAISystemMessageParam' - - $ref: '#/components/schemas/OpenAIAssistantMessageParam' - - $ref: '#/components/schemas/OpenAIToolMessageParam' - - $ref: '#/components/schemas/OpenAIDeveloperMessageParam' - discriminator: - propertyName: role - mapping: - user: '#/components/schemas/OpenAIUserMessageParam' - system: '#/components/schemas/OpenAISystemMessageParam' - assistant: '#/components/schemas/OpenAIAssistantMessageParam' - tool: '#/components/schemas/OpenAIToolMessageParam' - developer: '#/components/schemas/OpenAIDeveloperMessageParam' - OpenAISystemMessageParam: - type: object - properties: - role: - type: string - const: system - default: system - description: >- - Must be "system" to identify this as a system message - content: - oneOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' - description: >- - The content of the "system prompt". If multiple system messages are provided, - they are concatenated. The underlying Llama Stack code may also add other - system messages (for example, for formatting tool definitions). - name: - type: string - description: >- - (Optional) The name of the system message participant. - additionalProperties: false - required: - - role - - content - title: OpenAISystemMessageParam - description: >- - A system message providing instructions or context to the model. OpenAITokenLogProb: type: object properties: @@ -5408,35 +5534,6 @@ components: description: >- The log probability for a token from an OpenAI-compatible chat completion response. - OpenAIToolMessageParam: - type: object - properties: - role: - type: string - const: tool - default: tool - description: >- - Must be "tool" to identify this as a tool response - tool_call_id: - type: string - description: >- - Unique identifier for the tool call this response is for - content: - oneOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' - description: The response content from the tool - additionalProperties: false - required: - - role - - tool_call_id - - content - title: OpenAIToolMessageParam - description: >- - A message representing the result of a tool invocation in an OpenAI-compatible - chat completion request. OpenAITopLogProb: type: object properties: @@ -5456,125 +5553,6 @@ components: description: >- The top log probability for a token from an OpenAI-compatible chat completion response. - OpenAIUserMessageParam: - type: object - properties: - role: - type: string - const: user - default: user - description: >- - Must be "user" to identify this as a user message - content: - oneOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/OpenAIChatCompletionContentPartParam' - description: >- - The content of the message, which can include text and other media - name: - type: string - description: >- - (Optional) The name of the user message participant. - additionalProperties: false - required: - - role - - content - title: OpenAIUserMessageParam - description: >- - A message from the user in an OpenAI-compatible chat completion request. - OpenAIJSONSchema: - type: object - properties: - name: - type: string - description: Name of the schema - description: - type: string - description: (Optional) Description of the schema - strict: - type: boolean - description: >- - (Optional) Whether to enforce strict adherence to the schema - schema: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - description: (Optional) The JSON schema definition - additionalProperties: false - required: - - name - title: OpenAIJSONSchema - description: >- - JSON schema specification for OpenAI-compatible structured response format. - OpenAIResponseFormatJSONObject: - type: object - properties: - type: - type: string - const: json_object - default: json_object - description: >- - Must be "json_object" to indicate generic JSON object response format - additionalProperties: false - required: - - type - title: OpenAIResponseFormatJSONObject - description: >- - JSON object response format for OpenAI-compatible chat completion requests. - OpenAIResponseFormatJSONSchema: - type: object - properties: - type: - type: string - const: json_schema - default: json_schema - description: >- - Must be "json_schema" to indicate structured JSON response format - json_schema: - $ref: '#/components/schemas/OpenAIJSONSchema' - description: >- - The JSON schema specification for the response - additionalProperties: false - required: - - type - - json_schema - title: OpenAIResponseFormatJSONSchema - description: >- - JSON schema response format for OpenAI-compatible chat completion requests. - OpenAIResponseFormatParam: - oneOf: - - $ref: '#/components/schemas/OpenAIResponseFormatText' - - $ref: '#/components/schemas/OpenAIResponseFormatJSONSchema' - - $ref: '#/components/schemas/OpenAIResponseFormatJSONObject' - discriminator: - propertyName: type - mapping: - text: '#/components/schemas/OpenAIResponseFormatText' - json_schema: '#/components/schemas/OpenAIResponseFormatJSONSchema' - json_object: '#/components/schemas/OpenAIResponseFormatJSONObject' - OpenAIResponseFormatText: - type: object - properties: - type: - type: string - const: text - default: text - description: >- - Must be "text" to indicate plain text response format - additionalProperties: false - required: - - type - title: OpenAIResponseFormatText - description: >- - Text response format for OpenAI-compatible chat completion requests. OpenaiChatCompletionRequest: type: object properties: @@ -6661,122 +6639,6 @@ components: title: OpenAIResponseInputMessageContentText description: >- Text content for input messages in OpenAI response format. - OpenAIResponseInputToolFileSearch: - type: object - properties: - type: - type: string - const: file_search - default: file_search - description: >- - Tool type identifier, always "file_search" - vector_store_ids: - type: array - items: - type: string - description: >- - List of vector store identifiers to search within - filters: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - description: >- - (Optional) Additional filters to apply to the search - max_num_results: - type: integer - default: 10 - description: >- - (Optional) Maximum number of search results to return (1-50) - ranking_options: - type: object - properties: - ranker: - type: string - description: >- - (Optional) Name of the ranking algorithm to use - score_threshold: - type: number - default: 0.0 - description: >- - (Optional) Minimum relevance score threshold for results - additionalProperties: false - description: >- - (Optional) Options for ranking and scoring search results - additionalProperties: false - required: - - type - - vector_store_ids - title: OpenAIResponseInputToolFileSearch - description: >- - File search tool configuration for OpenAI response inputs. - OpenAIResponseInputToolFunction: - type: object - properties: - type: - type: string - const: function - default: function - description: Tool type identifier, always "function" - name: - type: string - description: Name of the function that can be called - description: - type: string - description: >- - (Optional) Description of what the function does - parameters: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - description: >- - (Optional) JSON schema defining the function's parameters - strict: - type: boolean - description: >- - (Optional) Whether to enforce strict parameter validation - additionalProperties: false - required: - - type - - name - title: OpenAIResponseInputToolFunction - description: >- - Function tool configuration for OpenAI response inputs. - OpenAIResponseInputToolWebSearch: - type: object - properties: - type: - oneOf: - - type: string - const: web_search - - type: string - const: web_search_preview - - type: string - const: web_search_preview_2025_03_11 - default: web_search - description: Web search tool type variant to use - search_context_size: - type: string - default: medium - description: >- - (Optional) Size of search context, must be "low", "medium", or "high" - additionalProperties: false - required: - - type - title: OpenAIResponseInputToolWebSearch - description: >- - Web search tool configuration for OpenAI response inputs. OpenAIResponseMCPApprovalRequest: type: object properties: @@ -7378,100 +7240,6 @@ components: title: ResponseShieldSpec description: >- Specification for a shield to apply during response generation. - OpenAIResponseInputTool: - oneOf: - - $ref: '#/components/schemas/OpenAIResponseInputToolWebSearch' - - $ref: '#/components/schemas/OpenAIResponseInputToolFileSearch' - - $ref: '#/components/schemas/OpenAIResponseInputToolFunction' - - $ref: '#/components/schemas/OpenAIResponseInputToolMCP' - discriminator: - propertyName: type - mapping: - web_search: '#/components/schemas/OpenAIResponseInputToolWebSearch' - file_search: '#/components/schemas/OpenAIResponseInputToolFileSearch' - function: '#/components/schemas/OpenAIResponseInputToolFunction' - mcp: '#/components/schemas/OpenAIResponseInputToolMCP' - OpenAIResponseInputToolMCP: - type: object - properties: - type: - type: string - const: mcp - default: mcp - description: Tool type identifier, always "mcp" - server_label: - type: string - description: Label to identify this MCP server - server_url: - type: string - description: URL endpoint of the MCP server - headers: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - description: >- - (Optional) HTTP headers to include when connecting to the server - require_approval: - oneOf: - - type: string - const: always - - type: string - const: never - - type: object - properties: - always: - type: array - items: - type: string - description: >- - (Optional) List of tool names that always require approval - never: - type: array - items: - type: string - description: >- - (Optional) List of tool names that never require approval - additionalProperties: false - title: ApprovalFilter - description: >- - Filter configuration for MCP tool approval requirements. - default: never - description: >- - Approval requirement for tool calls ("always", "never", or filter) - allowed_tools: - oneOf: - - type: array - items: - type: string - - type: object - properties: - tool_names: - type: array - items: - type: string - description: >- - (Optional) List of specific tool names that are allowed - additionalProperties: false - title: AllowedToolsFilter - description: >- - Filter configuration for restricting which MCP tools can be used. - description: >- - (Optional) Restriction on which tools can be used from this server - additionalProperties: false - required: - - type - - server_label - - server_url - - require_approval - title: OpenAIResponseInputToolMCP - description: >- - Model Context Protocol (MCP) tool configuration for OpenAI response inputs. CreateOpenaiResponseRequest: type: object properties: diff --git a/docs/static/experimental-llama-stack-spec.html b/docs/static/experimental-llama-stack-spec.html index a84226c05..baeaf7e61 100644 --- a/docs/static/experimental-llama-stack-spec.html +++ b/docs/static/experimental-llama-stack-spec.html @@ -2424,8 +2424,20 @@ "AgentConfig": { "type": "object", "properties": { - "sampling_params": { - "$ref": "#/components/schemas/SamplingParams" + "max_output_tokens": { + "type": "integer" + }, + "temperature": { + "type": "number" + }, + "top_p": { + "type": "number" + }, + "stop": { + "type": "array", + "items": { + "type": "string" + } }, "input_shields": { "type": "array", @@ -2439,40 +2451,25 @@ "type": "string" } }, - "toolgroups": { + "tools": { "type": "array", "items": { - "$ref": "#/components/schemas/AgentTool" + "$ref": "#/components/schemas/OpenAIResponseInputTool" } }, "client_tools": { "type": "array", "items": { - "$ref": "#/components/schemas/ToolDef" + "oneOf": [ + { + "$ref": "#/components/schemas/OpenAIResponseInputTool" + }, + { + "$ref": "#/components/schemas/ToolDef" + } + ] } }, - "tool_choice": { - "type": "string", - "enum": [ - "auto", - "required", - "none" - ], - "title": "ToolChoice", - "description": "Whether tool use is required or automatic. This is a hint to the model which may not be followed. It depends on the Instruction Following capabilities of the model.", - "deprecated": true - }, - "tool_prompt_format": { - "type": "string", - "enum": [ - "json", - "function_tag", - "python_list" - ], - "title": "ToolPromptFormat", - "description": "Prompt format for calling custom / zero shot tools.", - "deprecated": true - }, "tool_config": { "$ref": "#/components/schemas/ToolConfig" }, @@ -2498,7 +2495,7 @@ "description": "Optional flag indicating whether session data has to be persisted" }, "response_format": { - "$ref": "#/components/schemas/ResponseFormat", + "$ref": "#/components/schemas/OpenAIResponseFormatParam", "description": "Optional response format configuration" } }, @@ -2510,66 +2507,22 @@ "title": "AgentConfig", "description": "Configuration for an agent." }, - "AgentTool": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "args": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - } - } - }, - "additionalProperties": false, - "required": [ - "name", - "args" - ], - "title": "AgentToolGroupWithArgs" - } - ] - }, - "GrammarResponseFormat": { + "OpenAIJSONSchema": { "type": "object", "properties": { - "type": { + "name": { "type": "string", - "enum": [ - "json_schema", - "grammar" - ], - "description": "Must be \"grammar\" to identify this format type", - "const": "grammar", - "default": "grammar" + "description": "Name of the schema" }, - "bnf": { + "description": { + "type": "string", + "description": "(Optional) Description of the schema" + }, + "strict": { + "type": "boolean", + "description": "(Optional) Whether to enforce strict adherence to the schema" + }, + "schema": { "type": "object", "additionalProperties": { "oneOf": [ @@ -2593,72 +2546,45 @@ } ] }, - "description": "The BNF grammar specification the response should conform to" + "description": "(Optional) The JSON schema definition" } }, "additionalProperties": false, "required": [ - "type", - "bnf" + "name" ], - "title": "GrammarResponseFormat", - "description": "Configuration for grammar-guided response generation." + "title": "OpenAIJSONSchema", + "description": "JSON schema specification for OpenAI-compatible structured response format." }, - "GreedySamplingStrategy": { + "OpenAIResponseFormatJSONObject": { "type": "object", "properties": { "type": { "type": "string", - "const": "greedy", - "default": "greedy", - "description": "Must be \"greedy\" to identify this sampling strategy" + "const": "json_object", + "default": "json_object", + "description": "Must be \"json_object\" to indicate generic JSON object response format" } }, "additionalProperties": false, "required": [ "type" ], - "title": "GreedySamplingStrategy", - "description": "Greedy sampling strategy that selects the highest probability token at each step." + "title": "OpenAIResponseFormatJSONObject", + "description": "JSON object response format for OpenAI-compatible chat completion requests." }, - "JsonSchemaResponseFormat": { + "OpenAIResponseFormatJSONSchema": { "type": "object", "properties": { "type": { "type": "string", - "enum": [ - "json_schema", - "grammar" - ], - "description": "Must be \"json_schema\" to identify this format type", "const": "json_schema", - "default": "json_schema" + "default": "json_schema", + "description": "Must be \"json_schema\" to indicate structured JSON response format" }, "json_schema": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "The JSON schema the response should conform to. In a Python SDK, this is often a `pydantic` model." + "$ref": "#/components/schemas/OpenAIJSONSchema", + "description": "The JSON schema specification for the response" } }, "additionalProperties": false, @@ -2666,75 +2592,349 @@ "type", "json_schema" ], - "title": "JsonSchemaResponseFormat", - "description": "Configuration for JSON schema-guided response generation." + "title": "OpenAIResponseFormatJSONSchema", + "description": "JSON schema response format for OpenAI-compatible chat completion requests." }, - "ResponseFormat": { + "OpenAIResponseFormatParam": { "oneOf": [ { - "$ref": "#/components/schemas/JsonSchemaResponseFormat" + "$ref": "#/components/schemas/OpenAIResponseFormatText" }, { - "$ref": "#/components/schemas/GrammarResponseFormat" + "$ref": "#/components/schemas/OpenAIResponseFormatJSONSchema" + }, + { + "$ref": "#/components/schemas/OpenAIResponseFormatJSONObject" } ], "discriminator": { "propertyName": "type", "mapping": { - "json_schema": "#/components/schemas/JsonSchemaResponseFormat", - "grammar": "#/components/schemas/GrammarResponseFormat" + "text": "#/components/schemas/OpenAIResponseFormatText", + "json_schema": "#/components/schemas/OpenAIResponseFormatJSONSchema", + "json_object": "#/components/schemas/OpenAIResponseFormatJSONObject" } } }, - "SamplingParams": { + "OpenAIResponseFormatText": { "type": "object", "properties": { - "strategy": { - "oneOf": [ - { - "$ref": "#/components/schemas/GreedySamplingStrategy" - }, - { - "$ref": "#/components/schemas/TopPSamplingStrategy" - }, - { - "$ref": "#/components/schemas/TopKSamplingStrategy" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "greedy": "#/components/schemas/GreedySamplingStrategy", - "top_p": "#/components/schemas/TopPSamplingStrategy", - "top_k": "#/components/schemas/TopKSamplingStrategy" - } - }, - "description": "The sampling strategy." - }, - "max_tokens": { - "type": "integer", - "default": 0, - "description": "The maximum number of tokens that can be generated in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length." - }, - "repetition_penalty": { - "type": "number", - "default": 1.0, - "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics." - }, - "stop": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence." + "type": { + "type": "string", + "const": "text", + "default": "text", + "description": "Must be \"text\" to indicate plain text response format" } }, "additionalProperties": false, "required": [ - "strategy" + "type" ], - "title": "SamplingParams", - "description": "Sampling parameters." + "title": "OpenAIResponseFormatText", + "description": "Text response format for OpenAI-compatible chat completion requests." + }, + "OpenAIResponseInputTool": { + "oneOf": [ + { + "$ref": "#/components/schemas/OpenAIResponseInputToolWebSearch" + }, + { + "$ref": "#/components/schemas/OpenAIResponseInputToolFileSearch" + }, + { + "$ref": "#/components/schemas/OpenAIResponseInputToolFunction" + }, + { + "$ref": "#/components/schemas/OpenAIResponseInputToolMCP" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "web_search": "#/components/schemas/OpenAIResponseInputToolWebSearch", + "file_search": "#/components/schemas/OpenAIResponseInputToolFileSearch", + "function": "#/components/schemas/OpenAIResponseInputToolFunction", + "mcp": "#/components/schemas/OpenAIResponseInputToolMCP" + } + } + }, + "OpenAIResponseInputToolFileSearch": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file_search", + "default": "file_search", + "description": "Tool type identifier, always \"file_search\"" + }, + "vector_store_ids": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of vector store identifiers to search within" + }, + "filters": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "type": "null" + }, + { + "type": "boolean" + }, + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "array" + }, + { + "type": "object" + } + ] + }, + "description": "(Optional) Additional filters to apply to the search" + }, + "max_num_results": { + "type": "integer", + "default": 10, + "description": "(Optional) Maximum number of search results to return (1-50)" + }, + "ranking_options": { + "type": "object", + "properties": { + "ranker": { + "type": "string", + "description": "(Optional) Name of the ranking algorithm to use" + }, + "score_threshold": { + "type": "number", + "default": 0.0, + "description": "(Optional) Minimum relevance score threshold for results" + } + }, + "additionalProperties": false, + "description": "(Optional) Options for ranking and scoring search results" + } + }, + "additionalProperties": false, + "required": [ + "type", + "vector_store_ids" + ], + "title": "OpenAIResponseInputToolFileSearch", + "description": "File search tool configuration for OpenAI response inputs." + }, + "OpenAIResponseInputToolFunction": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "function", + "default": "function", + "description": "Tool type identifier, always \"function\"" + }, + "name": { + "type": "string", + "description": "Name of the function that can be called" + }, + "description": { + "type": "string", + "description": "(Optional) Description of what the function does" + }, + "parameters": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "type": "null" + }, + { + "type": "boolean" + }, + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "array" + }, + { + "type": "object" + } + ] + }, + "description": "(Optional) JSON schema defining the function's parameters" + }, + "strict": { + "type": "boolean", + "description": "(Optional) Whether to enforce strict parameter validation" + } + }, + "additionalProperties": false, + "required": [ + "type", + "name" + ], + "title": "OpenAIResponseInputToolFunction", + "description": "Function tool configuration for OpenAI response inputs." + }, + "OpenAIResponseInputToolMCP": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "mcp", + "default": "mcp", + "description": "Tool type identifier, always \"mcp\"" + }, + "server_label": { + "type": "string", + "description": "Label to identify this MCP server" + }, + "server_url": { + "type": "string", + "description": "URL endpoint of the MCP server" + }, + "headers": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "type": "null" + }, + { + "type": "boolean" + }, + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "array" + }, + { + "type": "object" + } + ] + }, + "description": "(Optional) HTTP headers to include when connecting to the server" + }, + "require_approval": { + "oneOf": [ + { + "type": "string", + "const": "always" + }, + { + "type": "string", + "const": "never" + }, + { + "type": "object", + "properties": { + "always": { + "type": "array", + "items": { + "type": "string" + }, + "description": "(Optional) List of tool names that always require approval" + }, + "never": { + "type": "array", + "items": { + "type": "string" + }, + "description": "(Optional) List of tool names that never require approval" + } + }, + "additionalProperties": false, + "title": "ApprovalFilter", + "description": "Filter configuration for MCP tool approval requirements." + } + ], + "default": "never", + "description": "Approval requirement for tool calls (\"always\", \"never\", or filter)" + }, + "allowed_tools": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object", + "properties": { + "tool_names": { + "type": "array", + "items": { + "type": "string" + }, + "description": "(Optional) List of specific tool names that are allowed" + } + }, + "additionalProperties": false, + "title": "AllowedToolsFilter", + "description": "Filter configuration for restricting which MCP tools can be used." + } + ], + "description": "(Optional) Restriction on which tools can be used from this server" + } + }, + "additionalProperties": false, + "required": [ + "type", + "server_label", + "server_url", + "require_approval" + ], + "title": "OpenAIResponseInputToolMCP", + "description": "Model Context Protocol (MCP) tool configuration for OpenAI response inputs." + }, + "OpenAIResponseInputToolWebSearch": { + "type": "object", + "properties": { + "type": { + "oneOf": [ + { + "type": "string", + "const": "web_search" + }, + { + "type": "string", + "const": "web_search_preview" + }, + { + "type": "string", + "const": "web_search_preview_2025_03_11" + } + ], + "default": "web_search", + "description": "Web search tool type variant to use" + }, + "search_context_size": { + "type": "string", + "default": "medium", + "description": "(Optional) Size of search context, must be \"low\", \"medium\", or \"high\"" + } + }, + "additionalProperties": false, + "required": [ + "type" + ], + "title": "OpenAIResponseInputToolWebSearch", + "description": "Web search tool configuration for OpenAI response inputs." }, "ToolConfig": { "type": "object", @@ -2882,54 +3082,6 @@ "title": "ToolDef", "description": "Tool definition used in runtime contexts." }, - "TopKSamplingStrategy": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "top_k", - "default": "top_k", - "description": "Must be \"top_k\" to identify this sampling strategy" - }, - "top_k": { - "type": "integer", - "description": "Number of top tokens to consider for sampling. Must be at least 1" - } - }, - "additionalProperties": false, - "required": [ - "type", - "top_k" - ], - "title": "TopKSamplingStrategy", - "description": "Top-k sampling strategy that restricts sampling to the k most likely tokens." - }, - "TopPSamplingStrategy": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "top_p", - "default": "top_p", - "description": "Must be \"top_p\" to identify this sampling strategy" - }, - "temperature": { - "type": "number", - "description": "Controls randomness in sampling. Higher values increase randomness" - }, - "top_p": { - "type": "number", - "default": 0.95, - "description": "Cumulative probability threshold for nucleus sampling. Defaults to 0.95" - } - }, - "additionalProperties": false, - "required": [ - "type" - ], - "title": "TopPSamplingStrategy", - "description": "Top-p (nucleus) sampling strategy that samples from the smallest set of tokens with cumulative probability >= p." - }, "CreateAgentRequest": { "type": "object", "properties": { @@ -3014,79 +3166,6 @@ "title": "AgentSessionCreateResponse", "description": "Response returned when creating a new agent session." }, - "CompletionMessage": { - "type": "object", - "properties": { - "role": { - "type": "string", - "const": "assistant", - "default": "assistant", - "description": "Must be \"assistant\" to identify this as the model's response" - }, - "content": { - "$ref": "#/components/schemas/InterleavedContent", - "description": "The content of the model's response" - }, - "stop_reason": { - "type": "string", - "enum": [ - "end_of_turn", - "end_of_message", - "out_of_tokens" - ], - "description": "Reason why the model stopped generating. Options are: - `StopReason.end_of_turn`: The model finished generating the entire response. - `StopReason.end_of_message`: The model finished generating but generated a partial response -- usually, a tool call. The user may call the tool and continue the conversation with the tool's response. - `StopReason.out_of_tokens`: The model ran out of token budget." - }, - "tool_calls": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ToolCall" - }, - "description": "List of tool calls. Each tool call is a ToolCall object." - } - }, - "additionalProperties": false, - "required": [ - "role", - "content", - "stop_reason" - ], - "title": "CompletionMessage", - "description": "A message containing the model's (assistant) response in a chat conversation." - }, - "ImageContentItem": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "image", - "default": "image", - "description": "Discriminator type of the content item. Always \"image\"" - }, - "image": { - "type": "object", - "properties": { - "url": { - "$ref": "#/components/schemas/URL", - "description": "A URL of the image or data URL in the format of data:image/{type};base64,{data}. Note that URL could have length limits." - }, - "data": { - "type": "string", - "contentEncoding": "base64", - "description": "base64 encoded image data as string" - } - }, - "additionalProperties": false, - "description": "Image as a base64 encoded string or an URL" - } - }, - "additionalProperties": false, - "required": [ - "type", - "image" - ], - "title": "ImageContentItem", - "description": "A image content item" - }, "InferenceStep": { "type": "object", "properties": { @@ -3122,8 +3201,11 @@ "default": "inference" }, "model_response": { - "$ref": "#/components/schemas/CompletionMessage", + "$ref": "#/components/schemas/OpenAIAssistantMessageParam", "description": "The response from the LLM." + }, + "finish_reason": { + "type": "string" } }, "additionalProperties": false, @@ -3136,39 +3218,6 @@ "title": "InferenceStep", "description": "An inference step in an agent turn." }, - "InterleavedContent": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/components/schemas/InterleavedContentItem" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/InterleavedContentItem" - } - } - ] - }, - "InterleavedContentItem": { - "oneOf": [ - { - "$ref": "#/components/schemas/ImageContentItem" - }, - { - "$ref": "#/components/schemas/TextContentItem" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "image": "#/components/schemas/ImageContentItem", - "text": "#/components/schemas/TextContentItem" - } - } - }, "MemoryRetrievalStep": { "type": "object", "properties": { @@ -3208,7 +3257,17 @@ "description": "The IDs of the vector databases to retrieve context from." }, "inserted_context": { - "$ref": "#/components/schemas/InterleavedContent", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartParam" + } + } + ], "description": "The context retrieved from the vector databases." } }, @@ -3223,6 +3282,386 @@ "title": "MemoryRetrievalStep", "description": "A memory retrieval step in an agent turn." }, + "OpenAIAssistantMessageParam": { + "type": "object", + "properties": { + "role": { + "type": "string", + "const": "assistant", + "default": "assistant", + "description": "Must be \"assistant\" to identify this as the model's response" + }, + "content": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" + } + } + ], + "description": "The content of the model's response" + }, + "name": { + "type": "string", + "description": "(Optional) The name of the assistant message participant." + }, + "tool_calls": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionToolCall" + }, + "description": "List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object." + } + }, + "additionalProperties": false, + "required": [ + "role" + ], + "title": "OpenAIAssistantMessageParam", + "description": "A message containing the model's (assistant) response in an OpenAI-compatible chat completion request." + }, + "OpenAIChatCompletionContentPartImageParam": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "image_url", + "default": "image_url", + "description": "Must be \"image_url\" to identify this as image content" + }, + "image_url": { + "$ref": "#/components/schemas/OpenAIImageURL", + "description": "Image URL specification and processing details" + } + }, + "additionalProperties": false, + "required": [ + "type", + "image_url" + ], + "title": "OpenAIChatCompletionContentPartImageParam", + "description": "Image content part for OpenAI-compatible chat completion messages." + }, + "OpenAIChatCompletionContentPartParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" + }, + { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartImageParam" + }, + { + "$ref": "#/components/schemas/OpenAIFile" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "text": "#/components/schemas/OpenAIChatCompletionContentPartTextParam", + "image_url": "#/components/schemas/OpenAIChatCompletionContentPartImageParam", + "file": "#/components/schemas/OpenAIFile" + } + } + }, + "OpenAIChatCompletionContentPartTextParam": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text", + "default": "text", + "description": "Must be \"text\" to identify this as text content" + }, + "text": { + "type": "string", + "description": "The text content of the message" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ], + "title": "OpenAIChatCompletionContentPartTextParam", + "description": "Text content part for OpenAI-compatible chat completion messages." + }, + "OpenAIChatCompletionToolCall": { + "type": "object", + "properties": { + "index": { + "type": "integer", + "description": "(Optional) Index of the tool call in the list" + }, + "id": { + "type": "string", + "description": "(Optional) Unique identifier for the tool call" + }, + "type": { + "type": "string", + "const": "function", + "default": "function", + "description": "Must be \"function\" to identify this as a function call" + }, + "function": { + "$ref": "#/components/schemas/OpenAIChatCompletionToolCallFunction", + "description": "(Optional) Function call details" + } + }, + "additionalProperties": false, + "required": [ + "type" + ], + "title": "OpenAIChatCompletionToolCall", + "description": "Tool call specification for OpenAI-compatible chat completion responses." + }, + "OpenAIChatCompletionToolCallFunction": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "(Optional) Name of the function to call" + }, + "arguments": { + "type": "string", + "description": "(Optional) Arguments to pass to the function as a JSON string" + } + }, + "additionalProperties": false, + "title": "OpenAIChatCompletionToolCallFunction", + "description": "Function call details for OpenAI-compatible tool calls." + }, + "OpenAIDeveloperMessageParam": { + "type": "object", + "properties": { + "role": { + "type": "string", + "const": "developer", + "default": "developer", + "description": "Must be \"developer\" to identify this as a developer message" + }, + "content": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" + } + } + ], + "description": "The content of the developer message" + }, + "name": { + "type": "string", + "description": "(Optional) The name of the developer message participant." + } + }, + "additionalProperties": false, + "required": [ + "role", + "content" + ], + "title": "OpenAIDeveloperMessageParam", + "description": "A message from the developer in an OpenAI-compatible chat completion request." + }, + "OpenAIFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "default": "file" + }, + "file": { + "$ref": "#/components/schemas/OpenAIFileFile" + } + }, + "additionalProperties": false, + "required": [ + "type", + "file" + ], + "title": "OpenAIFile" + }, + "OpenAIFileFile": { + "type": "object", + "properties": { + "file_data": { + "type": "string" + }, + "file_id": { + "type": "string" + }, + "filename": { + "type": "string" + } + }, + "additionalProperties": false, + "title": "OpenAIFileFile" + }, + "OpenAIImageURL": { + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "URL of the image to include in the message" + }, + "detail": { + "type": "string", + "description": "(Optional) Level of detail for image processing. Can be \"low\", \"high\", or \"auto\"" + } + }, + "additionalProperties": false, + "required": [ + "url" + ], + "title": "OpenAIImageURL", + "description": "Image URL specification for OpenAI-compatible chat completion messages." + }, + "OpenAIMessageParam": { + "oneOf": [ + { + "$ref": "#/components/schemas/OpenAIUserMessageParam" + }, + { + "$ref": "#/components/schemas/OpenAISystemMessageParam" + }, + { + "$ref": "#/components/schemas/OpenAIAssistantMessageParam" + }, + { + "$ref": "#/components/schemas/OpenAIToolMessageParam" + }, + { + "$ref": "#/components/schemas/OpenAIDeveloperMessageParam" + } + ], + "discriminator": { + "propertyName": "role", + "mapping": { + "user": "#/components/schemas/OpenAIUserMessageParam", + "system": "#/components/schemas/OpenAISystemMessageParam", + "assistant": "#/components/schemas/OpenAIAssistantMessageParam", + "tool": "#/components/schemas/OpenAIToolMessageParam", + "developer": "#/components/schemas/OpenAIDeveloperMessageParam" + } + } + }, + "OpenAISystemMessageParam": { + "type": "object", + "properties": { + "role": { + "type": "string", + "const": "system", + "default": "system", + "description": "Must be \"system\" to identify this as a system message" + }, + "content": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" + } + } + ], + "description": "The content of the \"system prompt\". If multiple system messages are provided, they are concatenated. The underlying Llama Stack code may also add other system messages (for example, for formatting tool definitions)." + }, + "name": { + "type": "string", + "description": "(Optional) The name of the system message participant." + } + }, + "additionalProperties": false, + "required": [ + "role", + "content" + ], + "title": "OpenAISystemMessageParam", + "description": "A system message providing instructions or context to the model." + }, + "OpenAIToolMessageParam": { + "type": "object", + "properties": { + "role": { + "type": "string", + "const": "tool", + "default": "tool", + "description": "Must be \"tool\" to identify this as a tool response" + }, + "tool_call_id": { + "type": "string", + "description": "Unique identifier for the tool call this response is for" + }, + "content": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartTextParam" + } + } + ], + "description": "The response content from the tool" + } + }, + "additionalProperties": false, + "required": [ + "role", + "tool_call_id", + "content" + ], + "title": "OpenAIToolMessageParam", + "description": "A message representing the result of a tool invocation in an OpenAI-compatible chat completion request." + }, + "OpenAIUserMessageParam": { + "type": "object", + "properties": { + "role": { + "type": "string", + "const": "user", + "default": "user", + "description": "Must be \"user\" to identify this as a user message" + }, + "content": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartParam" + } + } + ], + "description": "The content of the message, which can include text and other media" + }, + "name": { + "type": "string", + "description": "(Optional) The name of the user message participant." + } + }, + "additionalProperties": false, + "required": [ + "role", + "content" + ], + "title": "OpenAIUserMessageParam", + "description": "A message from the user in an OpenAI-compatible chat completion request." + }, "SafetyViolation": { "type": "object", "properties": { @@ -3351,63 +3790,6 @@ "title": "ShieldCallStep", "description": "A shield call step in an agent turn." }, - "TextContentItem": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "text", - "default": "text", - "description": "Discriminator type of the content item. Always \"text\"" - }, - "text": { - "type": "string", - "description": "Text content" - } - }, - "additionalProperties": false, - "required": [ - "type", - "text" - ], - "title": "TextContentItem", - "description": "A text content item" - }, - "ToolCall": { - "type": "object", - "properties": { - "call_id": { - "type": "string" - }, - "tool_name": { - "oneOf": [ - { - "type": "string", - "enum": [ - "brave_search", - "wolfram_alpha", - "photogen", - "code_interpreter" - ], - "title": "BuiltinTool" - }, - { - "type": "string" - } - ] - }, - "arguments": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "call_id", - "tool_name", - "arguments" - ], - "title": "ToolCall" - }, "ToolExecutionStep": { "type": "object", "properties": { @@ -3445,14 +3827,14 @@ "tool_calls": { "type": "array", "items": { - "$ref": "#/components/schemas/ToolCall" + "$ref": "#/components/schemas/OpenAIChatCompletionToolCall" }, "description": "The tool calls to execute." }, "tool_responses": { "type": "array", "items": { - "$ref": "#/components/schemas/ToolResponse" + "$ref": "#/components/schemas/OpenAIToolMessageParam" }, "description": "The tool responses from the tool calls." } @@ -3468,98 +3850,6 @@ "title": "ToolExecutionStep", "description": "A tool execution step in an agent turn." }, - "ToolResponse": { - "type": "object", - "properties": { - "call_id": { - "type": "string", - "description": "Unique identifier for the tool call this response is for" - }, - "tool_name": { - "oneOf": [ - { - "type": "string", - "enum": [ - "brave_search", - "wolfram_alpha", - "photogen", - "code_interpreter" - ], - "title": "BuiltinTool" - }, - { - "type": "string" - } - ], - "description": "Name of the tool that was invoked" - }, - "content": { - "$ref": "#/components/schemas/InterleavedContent", - "description": "The response content from the tool" - }, - "metadata": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "(Optional) Additional metadata about the tool response" - } - }, - "additionalProperties": false, - "required": [ - "call_id", - "tool_name", - "content" - ], - "title": "ToolResponse", - "description": "Response from a tool invocation." - }, - "ToolResponseMessage": { - "type": "object", - "properties": { - "role": { - "type": "string", - "const": "tool", - "default": "tool", - "description": "Must be \"tool\" to identify this as a tool response" - }, - "call_id": { - "type": "string", - "description": "Unique identifier for the tool call this response is for" - }, - "content": { - "$ref": "#/components/schemas/InterleavedContent", - "description": "The response content from the tool" - } - }, - "additionalProperties": false, - "required": [ - "role", - "call_id", - "content" - ], - "title": "ToolResponseMessage", - "description": "A message representing the result of a tool invocation." - }, "Turn": { "type": "object", "properties": { @@ -3574,14 +3864,7 @@ "input_messages": { "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserMessage" - }, - { - "$ref": "#/components/schemas/ToolResponseMessage" - } - ] + "$ref": "#/components/schemas/OpenAIMessageParam" }, "description": "List of messages that initiated this turn" }, @@ -3615,9 +3898,12 @@ "description": "Ordered list of processing steps executed during this turn" }, "output_message": { - "$ref": "#/components/schemas/CompletionMessage", + "$ref": "#/components/schemas/OpenAIAssistantMessageParam", "description": "The model's generated response containing content and metadata" }, + "finish_reason": { + "type": "string" + }, "output_attachments": { "type": "array", "items": { @@ -3628,13 +3914,10 @@ { "type": "string" }, - { - "$ref": "#/components/schemas/InterleavedContentItem" - }, { "type": "array", "items": { - "$ref": "#/components/schemas/InterleavedContentItem" + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartParam" } }, { @@ -3696,32 +3979,6 @@ "title": "URL", "description": "A URL reference to external content." }, - "UserMessage": { - "type": "object", - "properties": { - "role": { - "type": "string", - "const": "user", - "default": "user", - "description": "Must be \"user\" to identify this as a user message" - }, - "content": { - "$ref": "#/components/schemas/InterleavedContent", - "description": "The content of the message, which can include text and other media" - }, - "context": { - "$ref": "#/components/schemas/InterleavedContent", - "description": "(Optional) This field is used internally by Llama Stack to pass RAG context. This field may be removed in the API in the future." - } - }, - "additionalProperties": false, - "required": [ - "role", - "content" - ], - "title": "UserMessage", - "description": "A message from the user in a chat conversation." - }, "ViolationLevel": { "type": "string", "enum": [ @@ -3738,14 +3995,7 @@ "messages": { "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserMessage" - }, - { - "$ref": "#/components/schemas/ToolResponseMessage" - } - ] + "$ref": "#/components/schemas/OpenAIMessageParam" }, "description": "List of messages to start the turn with." }, @@ -3763,13 +4013,10 @@ { "type": "string" }, - { - "$ref": "#/components/schemas/InterleavedContentItem" - }, { "type": "array", "items": { - "$ref": "#/components/schemas/InterleavedContentItem" + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartParam" } }, { @@ -3793,12 +4040,12 @@ }, "description": "(Optional) List of documents to create the turn with." }, - "toolgroups": { + "tools": { "type": "array", "items": { - "$ref": "#/components/schemas/AgentTool" + "$ref": "#/components/schemas/OpenAIResponseInputTool" }, - "description": "(Optional) List of toolgroups to create the turn with, will be used in addition to the agent's config toolgroups for the request." + "description": "(Optional) List of tools to create the turn with, will be used in addition to the agent's config tools for the request." }, "tool_config": { "$ref": "#/components/schemas/ToolConfig", @@ -4205,6 +4452,41 @@ "title": "TextDelta", "description": "A text content delta for streaming responses." }, + "ToolCall": { + "type": "object", + "properties": { + "call_id": { + "type": "string" + }, + "tool_name": { + "oneOf": [ + { + "type": "string", + "enum": [ + "brave_search", + "wolfram_alpha", + "photogen", + "code_interpreter" + ], + "title": "BuiltinTool" + }, + { + "type": "string" + } + ] + }, + "arguments": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "call_id", + "tool_name", + "arguments" + ], + "title": "ToolCall" + }, "ToolCallDelta": { "type": "object", "properties": { @@ -4251,7 +4533,7 @@ "tool_responses": { "type": "array", "items": { - "$ref": "#/components/schemas/ToolResponse" + "$ref": "#/components/schemas/OpenAIToolMessageParam" }, "description": "The tool call responses to resume the turn with." }, @@ -4558,6 +4840,90 @@ "title": "BenchmarkConfig", "description": "A benchmark configuration for evaluation." }, + "GreedySamplingStrategy": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "greedy", + "default": "greedy", + "description": "Must be \"greedy\" to identify this sampling strategy" + } + }, + "additionalProperties": false, + "required": [ + "type" + ], + "title": "GreedySamplingStrategy", + "description": "Greedy sampling strategy that selects the highest probability token at each step." + }, + "ImageContentItem": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "image", + "default": "image", + "description": "Discriminator type of the content item. Always \"image\"" + }, + "image": { + "type": "object", + "properties": { + "url": { + "$ref": "#/components/schemas/URL", + "description": "A URL of the image or data URL in the format of data:image/{type};base64,{data}. Note that URL could have length limits." + }, + "data": { + "type": "string", + "contentEncoding": "base64", + "description": "base64 encoded image data as string" + } + }, + "additionalProperties": false, + "description": "Image as a base64 encoded string or an URL" + } + }, + "additionalProperties": false, + "required": [ + "type", + "image" + ], + "title": "ImageContentItem", + "description": "A image content item" + }, + "InterleavedContent": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/components/schemas/InterleavedContentItem" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/InterleavedContentItem" + } + } + ] + }, + "InterleavedContentItem": { + "oneOf": [ + { + "$ref": "#/components/schemas/ImageContentItem" + }, + { + "$ref": "#/components/schemas/TextContentItem" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "image": "#/components/schemas/ImageContentItem", + "text": "#/components/schemas/TextContentItem" + } + } + }, "LLMAsJudgeScoringFnParams": { "type": "object", "properties": { @@ -4663,6 +5029,56 @@ "title": "RegexParserScoringFnParams", "description": "Parameters for regex parser scoring function configuration." }, + "SamplingParams": { + "type": "object", + "properties": { + "strategy": { + "oneOf": [ + { + "$ref": "#/components/schemas/GreedySamplingStrategy" + }, + { + "$ref": "#/components/schemas/TopPSamplingStrategy" + }, + { + "$ref": "#/components/schemas/TopKSamplingStrategy" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "greedy": "#/components/schemas/GreedySamplingStrategy", + "top_p": "#/components/schemas/TopPSamplingStrategy", + "top_k": "#/components/schemas/TopKSamplingStrategy" + } + }, + "description": "The sampling strategy." + }, + "max_tokens": { + "type": "integer", + "default": 0, + "description": "The maximum number of tokens that can be generated in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length." + }, + "repetition_penalty": { + "type": "number", + "default": 1.0, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics." + }, + "stop": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence." + } + }, + "additionalProperties": false, + "required": [ + "strategy" + ], + "title": "SamplingParams", + "description": "Sampling parameters." + }, "ScoringFnParams": { "oneOf": [ { @@ -4716,6 +5132,76 @@ "title": "SystemMessage", "description": "A system message providing instructions or context to the model." }, + "TextContentItem": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text", + "default": "text", + "description": "Discriminator type of the content item. Always \"text\"" + }, + "text": { + "type": "string", + "description": "Text content" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ], + "title": "TextContentItem", + "description": "A text content item" + }, + "TopKSamplingStrategy": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "top_k", + "default": "top_k", + "description": "Must be \"top_k\" to identify this sampling strategy" + }, + "top_k": { + "type": "integer", + "description": "Number of top tokens to consider for sampling. Must be at least 1" + } + }, + "additionalProperties": false, + "required": [ + "type", + "top_k" + ], + "title": "TopKSamplingStrategy", + "description": "Top-k sampling strategy that restricts sampling to the k most likely tokens." + }, + "TopPSamplingStrategy": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "top_p", + "default": "top_p", + "description": "Must be \"top_p\" to identify this sampling strategy" + }, + "temperature": { + "type": "number", + "description": "Controls randomness in sampling. Higher values increase randomness" + }, + "top_p": { + "type": "number", + "default": 0.95, + "description": "Cumulative probability threshold for nucleus sampling. Defaults to 0.95" + } + }, + "additionalProperties": false, + "required": [ + "type" + ], + "title": "TopPSamplingStrategy", + "description": "Top-p (nucleus) sampling strategy that samples from the smallest set of tokens with cumulative probability >= p." + }, "EvaluateRowsRequest": { "type": "object", "properties": { @@ -4924,69 +5410,6 @@ "title": "Job", "description": "A job execution instance with status tracking." }, - "OpenAIChatCompletionContentPartImageParam": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "image_url", - "default": "image_url", - "description": "Must be \"image_url\" to identify this as image content" - }, - "image_url": { - "$ref": "#/components/schemas/OpenAIImageURL", - "description": "Image URL specification and processing details" - } - }, - "additionalProperties": false, - "required": [ - "type", - "image_url" - ], - "title": "OpenAIChatCompletionContentPartImageParam", - "description": "Image content part for OpenAI-compatible chat completion messages." - }, - "OpenAIChatCompletionContentPartTextParam": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "text", - "default": "text", - "description": "Must be \"text\" to identify this as text content" - }, - "text": { - "type": "string", - "description": "The text content of the message" - } - }, - "additionalProperties": false, - "required": [ - "type", - "text" - ], - "title": "OpenAIChatCompletionContentPartTextParam", - "description": "Text content part for OpenAI-compatible chat completion messages." - }, - "OpenAIImageURL": { - "type": "object", - "properties": { - "url": { - "type": "string", - "description": "URL of the image to include in the message" - }, - "detail": { - "type": "string", - "description": "(Optional) Level of detail for image processing. Can be \"low\", \"high\", or \"auto\"" - } - }, - "additionalProperties": false, - "required": [ - "url" - ], - "title": "OpenAIImageURL", - "description": "Image URL specification for OpenAI-compatible chat completion messages." - }, "RerankRequest": { "type": "object", "properties": { diff --git a/docs/static/experimental-llama-stack-spec.yaml b/docs/static/experimental-llama-stack-spec.yaml index a08c0cc87..58c696462 100644 --- a/docs/static/experimental-llama-stack-spec.yaml +++ b/docs/static/experimental-llama-stack-spec.yaml @@ -1730,8 +1730,16 @@ components: AgentConfig: type: object properties: - sampling_params: - $ref: '#/components/schemas/SamplingParams' + max_output_tokens: + type: integer + temperature: + type: number + top_p: + type: number + stop: + type: array + items: + type: string input_shields: type: array items: @@ -1740,36 +1748,16 @@ components: type: array items: type: string - toolgroups: + tools: type: array items: - $ref: '#/components/schemas/AgentTool' + $ref: '#/components/schemas/OpenAIResponseInputTool' client_tools: type: array items: - $ref: '#/components/schemas/ToolDef' - tool_choice: - type: string - enum: - - auto - - required - - none - title: ToolChoice - description: >- - Whether tool use is required or automatic. This is a hint to the model - which may not be followed. It depends on the Instruction Following capabilities - of the model. - deprecated: true - tool_prompt_format: - type: string - enum: - - json - - function_tag - - python_list - title: ToolPromptFormat - description: >- - Prompt format for calling custom / zero shot tools. - deprecated: true + oneOf: + - $ref: '#/components/schemas/OpenAIResponseInputTool' + - $ref: '#/components/schemas/ToolDef' tool_config: $ref: '#/components/schemas/ToolConfig' max_infer_iters: @@ -1792,7 +1780,7 @@ components: description: >- Optional flag indicating whether session data has to be persisted response_format: - $ref: '#/components/schemas/ResponseFormat' + $ref: '#/components/schemas/OpenAIResponseFormatParam' description: Optional response format configuration additionalProperties: false required: @@ -1800,41 +1788,20 @@ components: - instructions title: AgentConfig description: Configuration for an agent. - AgentTool: - oneOf: - - type: string - - type: object - properties: - name: - type: string - args: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - additionalProperties: false - required: - - name - - args - title: AgentToolGroupWithArgs - GrammarResponseFormat: + OpenAIJSONSchema: type: object properties: - type: + name: type: string - enum: - - json_schema - - grammar + description: Name of the schema + description: + type: string + description: (Optional) Description of the schema + strict: + type: boolean description: >- - Must be "grammar" to identify this format type - const: grammar - default: grammar - bnf: + (Optional) Whether to enforce strict adherence to the schema + schema: type: object additionalProperties: oneOf: @@ -1844,113 +1811,284 @@ components: - type: string - type: array - type: object - description: >- - The BNF grammar specification the response should conform to + description: (Optional) The JSON schema definition additionalProperties: false required: - - type - - bnf - title: GrammarResponseFormat + - name + title: OpenAIJSONSchema description: >- - Configuration for grammar-guided response generation. - GreedySamplingStrategy: + JSON schema specification for OpenAI-compatible structured response format. + OpenAIResponseFormatJSONObject: type: object properties: type: type: string - const: greedy - default: greedy + const: json_object + default: json_object description: >- - Must be "greedy" to identify this sampling strategy + Must be "json_object" to indicate generic JSON object response format additionalProperties: false required: - type - title: GreedySamplingStrategy + title: OpenAIResponseFormatJSONObject description: >- - Greedy sampling strategy that selects the highest probability token at each - step. - JsonSchemaResponseFormat: + JSON object response format for OpenAI-compatible chat completion requests. + OpenAIResponseFormatJSONSchema: type: object properties: type: type: string - enum: - - json_schema - - grammar - description: >- - Must be "json_schema" to identify this format type const: json_schema default: json_schema - json_schema: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object description: >- - The JSON schema the response should conform to. In a Python SDK, this - is often a `pydantic` model. + Must be "json_schema" to indicate structured JSON response format + json_schema: + $ref: '#/components/schemas/OpenAIJSONSchema' + description: >- + The JSON schema specification for the response additionalProperties: false required: - type - json_schema - title: JsonSchemaResponseFormat + title: OpenAIResponseFormatJSONSchema description: >- - Configuration for JSON schema-guided response generation. - ResponseFormat: + JSON schema response format for OpenAI-compatible chat completion requests. + OpenAIResponseFormatParam: oneOf: - - $ref: '#/components/schemas/JsonSchemaResponseFormat' - - $ref: '#/components/schemas/GrammarResponseFormat' + - $ref: '#/components/schemas/OpenAIResponseFormatText' + - $ref: '#/components/schemas/OpenAIResponseFormatJSONSchema' + - $ref: '#/components/schemas/OpenAIResponseFormatJSONObject' discriminator: propertyName: type mapping: - json_schema: '#/components/schemas/JsonSchemaResponseFormat' - grammar: '#/components/schemas/GrammarResponseFormat' - SamplingParams: + text: '#/components/schemas/OpenAIResponseFormatText' + json_schema: '#/components/schemas/OpenAIResponseFormatJSONSchema' + json_object: '#/components/schemas/OpenAIResponseFormatJSONObject' + OpenAIResponseFormatText: type: object properties: - strategy: - oneOf: - - $ref: '#/components/schemas/GreedySamplingStrategy' - - $ref: '#/components/schemas/TopPSamplingStrategy' - - $ref: '#/components/schemas/TopKSamplingStrategy' - discriminator: - propertyName: type - mapping: - greedy: '#/components/schemas/GreedySamplingStrategy' - top_p: '#/components/schemas/TopPSamplingStrategy' - top_k: '#/components/schemas/TopKSamplingStrategy' - description: The sampling strategy. - max_tokens: - type: integer - default: 0 + type: + type: string + const: text + default: text description: >- - The maximum number of tokens that can be generated in the completion. - The token count of your prompt plus max_tokens cannot exceed the model's - context length. - repetition_penalty: - type: number - default: 1.0 + Must be "text" to indicate plain text response format + additionalProperties: false + required: + - type + title: OpenAIResponseFormatText + description: >- + Text response format for OpenAI-compatible chat completion requests. + OpenAIResponseInputTool: + oneOf: + - $ref: '#/components/schemas/OpenAIResponseInputToolWebSearch' + - $ref: '#/components/schemas/OpenAIResponseInputToolFileSearch' + - $ref: '#/components/schemas/OpenAIResponseInputToolFunction' + - $ref: '#/components/schemas/OpenAIResponseInputToolMCP' + discriminator: + propertyName: type + mapping: + web_search: '#/components/schemas/OpenAIResponseInputToolWebSearch' + file_search: '#/components/schemas/OpenAIResponseInputToolFileSearch' + function: '#/components/schemas/OpenAIResponseInputToolFunction' + mcp: '#/components/schemas/OpenAIResponseInputToolMCP' + OpenAIResponseInputToolFileSearch: + type: object + properties: + type: + type: string + const: file_search + default: file_search description: >- - Number between -2.0 and 2.0. Positive values penalize new tokens based - on whether they appear in the text so far, increasing the model's likelihood - to talk about new topics. - stop: + Tool type identifier, always "file_search" + vector_store_ids: type: array items: type: string description: >- - Up to 4 sequences where the API will stop generating further tokens. The - returned text will not contain the stop sequence. + List of vector store identifiers to search within + filters: + type: object + additionalProperties: + oneOf: + - type: 'null' + - type: boolean + - type: number + - type: string + - type: array + - type: object + description: >- + (Optional) Additional filters to apply to the search + max_num_results: + type: integer + default: 10 + description: >- + (Optional) Maximum number of search results to return (1-50) + ranking_options: + type: object + properties: + ranker: + type: string + description: >- + (Optional) Name of the ranking algorithm to use + score_threshold: + type: number + default: 0.0 + description: >- + (Optional) Minimum relevance score threshold for results + additionalProperties: false + description: >- + (Optional) Options for ranking and scoring search results additionalProperties: false required: - - strategy - title: SamplingParams - description: Sampling parameters. + - type + - vector_store_ids + title: OpenAIResponseInputToolFileSearch + description: >- + File search tool configuration for OpenAI response inputs. + OpenAIResponseInputToolFunction: + type: object + properties: + type: + type: string + const: function + default: function + description: Tool type identifier, always "function" + name: + type: string + description: Name of the function that can be called + description: + type: string + description: >- + (Optional) Description of what the function does + parameters: + type: object + additionalProperties: + oneOf: + - type: 'null' + - type: boolean + - type: number + - type: string + - type: array + - type: object + description: >- + (Optional) JSON schema defining the function's parameters + strict: + type: boolean + description: >- + (Optional) Whether to enforce strict parameter validation + additionalProperties: false + required: + - type + - name + title: OpenAIResponseInputToolFunction + description: >- + Function tool configuration for OpenAI response inputs. + OpenAIResponseInputToolMCP: + type: object + properties: + type: + type: string + const: mcp + default: mcp + description: Tool type identifier, always "mcp" + server_label: + type: string + description: Label to identify this MCP server + server_url: + type: string + description: URL endpoint of the MCP server + headers: + type: object + additionalProperties: + oneOf: + - type: 'null' + - type: boolean + - type: number + - type: string + - type: array + - type: object + description: >- + (Optional) HTTP headers to include when connecting to the server + require_approval: + oneOf: + - type: string + const: always + - type: string + const: never + - type: object + properties: + always: + type: array + items: + type: string + description: >- + (Optional) List of tool names that always require approval + never: + type: array + items: + type: string + description: >- + (Optional) List of tool names that never require approval + additionalProperties: false + title: ApprovalFilter + description: >- + Filter configuration for MCP tool approval requirements. + default: never + description: >- + Approval requirement for tool calls ("always", "never", or filter) + allowed_tools: + oneOf: + - type: array + items: + type: string + - type: object + properties: + tool_names: + type: array + items: + type: string + description: >- + (Optional) List of specific tool names that are allowed + additionalProperties: false + title: AllowedToolsFilter + description: >- + Filter configuration for restricting which MCP tools can be used. + description: >- + (Optional) Restriction on which tools can be used from this server + additionalProperties: false + required: + - type + - server_label + - server_url + - require_approval + title: OpenAIResponseInputToolMCP + description: >- + Model Context Protocol (MCP) tool configuration for OpenAI response inputs. + OpenAIResponseInputToolWebSearch: + type: object + properties: + type: + oneOf: + - type: string + const: web_search + - type: string + const: web_search_preview + - type: string + const: web_search_preview_2025_03_11 + default: web_search + description: Web search tool type variant to use + search_context_size: + type: string + default: medium + description: >- + (Optional) Size of search context, must be "low", "medium", or "high" + additionalProperties: false + required: + - type + title: OpenAIResponseInputToolWebSearch + description: >- + Web search tool configuration for OpenAI response inputs. ToolConfig: type: object properties: @@ -2055,51 +2193,6 @@ components: title: ToolDef description: >- Tool definition used in runtime contexts. - TopKSamplingStrategy: - type: object - properties: - type: - type: string - const: top_k - default: top_k - description: >- - Must be "top_k" to identify this sampling strategy - top_k: - type: integer - description: >- - Number of top tokens to consider for sampling. Must be at least 1 - additionalProperties: false - required: - - type - - top_k - title: TopKSamplingStrategy - description: >- - Top-k sampling strategy that restricts sampling to the k most likely tokens. - TopPSamplingStrategy: - type: object - properties: - type: - type: string - const: top_p - default: top_p - description: >- - Must be "top_p" to identify this sampling strategy - temperature: - type: number - description: >- - Controls randomness in sampling. Higher values increase randomness - top_p: - type: number - default: 0.95 - description: >- - Cumulative probability threshold for nucleus sampling. Defaults to 0.95 - additionalProperties: false - required: - - type - title: TopPSamplingStrategy - description: >- - Top-p (nucleus) sampling strategy that samples from the smallest set of tokens - with cumulative probability >= p. CreateAgentRequest: type: object properties: @@ -2166,75 +2259,6 @@ components: title: AgentSessionCreateResponse description: >- Response returned when creating a new agent session. - CompletionMessage: - type: object - properties: - role: - type: string - const: assistant - default: assistant - description: >- - Must be "assistant" to identify this as the model's response - content: - $ref: '#/components/schemas/InterleavedContent' - description: The content of the model's response - stop_reason: - type: string - enum: - - end_of_turn - - end_of_message - - out_of_tokens - description: >- - Reason why the model stopped generating. Options are: - `StopReason.end_of_turn`: - The model finished generating the entire response. - `StopReason.end_of_message`: - The model finished generating but generated a partial response -- usually, - a tool call. The user may call the tool and continue the conversation - with the tool's response. - `StopReason.out_of_tokens`: The model ran - out of token budget. - tool_calls: - type: array - items: - $ref: '#/components/schemas/ToolCall' - description: >- - List of tool calls. Each tool call is a ToolCall object. - additionalProperties: false - required: - - role - - content - - stop_reason - title: CompletionMessage - description: >- - A message containing the model's (assistant) response in a chat conversation. - ImageContentItem: - type: object - properties: - type: - type: string - const: image - default: image - description: >- - Discriminator type of the content item. Always "image" - image: - type: object - properties: - url: - $ref: '#/components/schemas/URL' - description: >- - A URL of the image or data URL in the format of data:image/{type};base64,{data}. - Note that URL could have length limits. - data: - type: string - contentEncoding: base64 - description: base64 encoded image data as string - additionalProperties: false - description: >- - Image as a base64 encoded string or an URL - additionalProperties: false - required: - - type - - image - title: ImageContentItem - description: A image content item InferenceStep: type: object properties: @@ -2264,8 +2288,10 @@ components: const: inference default: inference model_response: - $ref: '#/components/schemas/CompletionMessage' + $ref: '#/components/schemas/OpenAIAssistantMessageParam' description: The response from the LLM. + finish_reason: + type: string additionalProperties: false required: - turn_id @@ -2274,22 +2300,6 @@ components: - model_response title: InferenceStep description: An inference step in an agent turn. - InterleavedContent: - oneOf: - - type: string - - $ref: '#/components/schemas/InterleavedContentItem' - - type: array - items: - $ref: '#/components/schemas/InterleavedContentItem' - InterleavedContentItem: - oneOf: - - $ref: '#/components/schemas/ImageContentItem' - - $ref: '#/components/schemas/TextContentItem' - discriminator: - propertyName: type - mapping: - image: '#/components/schemas/ImageContentItem' - text: '#/components/schemas/TextContentItem' MemoryRetrievalStep: type: object properties: @@ -2323,7 +2333,11 @@ components: description: >- The IDs of the vector databases to retrieve context from. inserted_context: - $ref: '#/components/schemas/InterleavedContent' + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionContentPartParam' description: >- The context retrieved from the vector databases. additionalProperties: false @@ -2336,6 +2350,303 @@ components: title: MemoryRetrievalStep description: >- A memory retrieval step in an agent turn. + OpenAIAssistantMessageParam: + type: object + properties: + role: + type: string + const: assistant + default: assistant + description: >- + Must be "assistant" to identify this as the model's response + content: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' + description: The content of the model's response + name: + type: string + description: >- + (Optional) The name of the assistant message participant. + tool_calls: + type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionToolCall' + description: >- + List of tool calls. Each tool call is an OpenAIChatCompletionToolCall + object. + additionalProperties: false + required: + - role + title: OpenAIAssistantMessageParam + description: >- + A message containing the model's (assistant) response in an OpenAI-compatible + chat completion request. + "OpenAIChatCompletionContentPartImageParam": + type: object + properties: + type: + type: string + const: image_url + default: image_url + description: >- + Must be "image_url" to identify this as image content + image_url: + $ref: '#/components/schemas/OpenAIImageURL' + description: >- + Image URL specification and processing details + additionalProperties: false + required: + - type + - image_url + title: >- + OpenAIChatCompletionContentPartImageParam + description: >- + Image content part for OpenAI-compatible chat completion messages. + OpenAIChatCompletionContentPartParam: + oneOf: + - $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' + - $ref: '#/components/schemas/OpenAIChatCompletionContentPartImageParam' + - $ref: '#/components/schemas/OpenAIFile' + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' + image_url: '#/components/schemas/OpenAIChatCompletionContentPartImageParam' + file: '#/components/schemas/OpenAIFile' + OpenAIChatCompletionContentPartTextParam: + type: object + properties: + type: + type: string + const: text + default: text + description: >- + Must be "text" to identify this as text content + text: + type: string + description: The text content of the message + additionalProperties: false + required: + - type + - text + title: OpenAIChatCompletionContentPartTextParam + description: >- + Text content part for OpenAI-compatible chat completion messages. + OpenAIChatCompletionToolCall: + type: object + properties: + index: + type: integer + description: >- + (Optional) Index of the tool call in the list + id: + type: string + description: >- + (Optional) Unique identifier for the tool call + type: + type: string + const: function + default: function + description: >- + Must be "function" to identify this as a function call + function: + $ref: '#/components/schemas/OpenAIChatCompletionToolCallFunction' + description: (Optional) Function call details + additionalProperties: false + required: + - type + title: OpenAIChatCompletionToolCall + description: >- + Tool call specification for OpenAI-compatible chat completion responses. + OpenAIChatCompletionToolCallFunction: + type: object + properties: + name: + type: string + description: (Optional) Name of the function to call + arguments: + type: string + description: >- + (Optional) Arguments to pass to the function as a JSON string + additionalProperties: false + title: OpenAIChatCompletionToolCallFunction + description: >- + Function call details for OpenAI-compatible tool calls. + OpenAIDeveloperMessageParam: + type: object + properties: + role: + type: string + const: developer + default: developer + description: >- + Must be "developer" to identify this as a developer message + content: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' + description: The content of the developer message + name: + type: string + description: >- + (Optional) The name of the developer message participant. + additionalProperties: false + required: + - role + - content + title: OpenAIDeveloperMessageParam + description: >- + A message from the developer in an OpenAI-compatible chat completion request. + OpenAIFile: + type: object + properties: + type: + type: string + const: file + default: file + file: + $ref: '#/components/schemas/OpenAIFileFile' + additionalProperties: false + required: + - type + - file + title: OpenAIFile + OpenAIFileFile: + type: object + properties: + file_data: + type: string + file_id: + type: string + filename: + type: string + additionalProperties: false + title: OpenAIFileFile + OpenAIImageURL: + type: object + properties: + url: + type: string + description: >- + URL of the image to include in the message + detail: + type: string + description: >- + (Optional) Level of detail for image processing. Can be "low", "high", + or "auto" + additionalProperties: false + required: + - url + title: OpenAIImageURL + description: >- + Image URL specification for OpenAI-compatible chat completion messages. + OpenAIMessageParam: + oneOf: + - $ref: '#/components/schemas/OpenAIUserMessageParam' + - $ref: '#/components/schemas/OpenAISystemMessageParam' + - $ref: '#/components/schemas/OpenAIAssistantMessageParam' + - $ref: '#/components/schemas/OpenAIToolMessageParam' + - $ref: '#/components/schemas/OpenAIDeveloperMessageParam' + discriminator: + propertyName: role + mapping: + user: '#/components/schemas/OpenAIUserMessageParam' + system: '#/components/schemas/OpenAISystemMessageParam' + assistant: '#/components/schemas/OpenAIAssistantMessageParam' + tool: '#/components/schemas/OpenAIToolMessageParam' + developer: '#/components/schemas/OpenAIDeveloperMessageParam' + OpenAISystemMessageParam: + type: object + properties: + role: + type: string + const: system + default: system + description: >- + Must be "system" to identify this as a system message + content: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' + description: >- + The content of the "system prompt". If multiple system messages are provided, + they are concatenated. The underlying Llama Stack code may also add other + system messages (for example, for formatting tool definitions). + name: + type: string + description: >- + (Optional) The name of the system message participant. + additionalProperties: false + required: + - role + - content + title: OpenAISystemMessageParam + description: >- + A system message providing instructions or context to the model. + OpenAIToolMessageParam: + type: object + properties: + role: + type: string + const: tool + default: tool + description: >- + Must be "tool" to identify this as a tool response + tool_call_id: + type: string + description: >- + Unique identifier for the tool call this response is for + content: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionContentPartTextParam' + description: The response content from the tool + additionalProperties: false + required: + - role + - tool_call_id + - content + title: OpenAIToolMessageParam + description: >- + A message representing the result of a tool invocation in an OpenAI-compatible + chat completion request. + OpenAIUserMessageParam: + type: object + properties: + role: + type: string + const: user + default: user + description: >- + Must be "user" to identify this as a user message + content: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionContentPartParam' + description: >- + The content of the message, which can include text and other media + name: + type: string + description: >- + (Optional) The name of the user message participant. + additionalProperties: false + required: + - role + - content + title: OpenAIUserMessageParam + description: >- + A message from the user in an OpenAI-compatible chat completion request. SafetyViolation: type: object properties: @@ -2433,47 +2744,6 @@ components: - step_type title: ShieldCallStep description: A shield call step in an agent turn. - TextContentItem: - type: object - properties: - type: - type: string - const: text - default: text - description: >- - Discriminator type of the content item. Always "text" - text: - type: string - description: Text content - additionalProperties: false - required: - - type - - text - title: TextContentItem - description: A text content item - ToolCall: - type: object - properties: - call_id: - type: string - tool_name: - oneOf: - - type: string - enum: - - brave_search - - wolfram_alpha - - photogen - - code_interpreter - title: BuiltinTool - - type: string - arguments: - type: string - additionalProperties: false - required: - - call_id - - tool_name - - arguments - title: ToolCall ToolExecutionStep: type: object properties: @@ -2505,12 +2775,12 @@ components: tool_calls: type: array items: - $ref: '#/components/schemas/ToolCall' + $ref: '#/components/schemas/OpenAIChatCompletionToolCall' description: The tool calls to execute. tool_responses: type: array items: - $ref: '#/components/schemas/ToolResponse' + $ref: '#/components/schemas/OpenAIToolMessageParam' description: The tool responses from the tool calls. additionalProperties: false required: @@ -2521,70 +2791,6 @@ components: - tool_responses title: ToolExecutionStep description: A tool execution step in an agent turn. - ToolResponse: - type: object - properties: - call_id: - type: string - description: >- - Unique identifier for the tool call this response is for - tool_name: - oneOf: - - type: string - enum: - - brave_search - - wolfram_alpha - - photogen - - code_interpreter - title: BuiltinTool - - type: string - description: Name of the tool that was invoked - content: - $ref: '#/components/schemas/InterleavedContent' - description: The response content from the tool - metadata: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - description: >- - (Optional) Additional metadata about the tool response - additionalProperties: false - required: - - call_id - - tool_name - - content - title: ToolResponse - description: Response from a tool invocation. - ToolResponseMessage: - type: object - properties: - role: - type: string - const: tool - default: tool - description: >- - Must be "tool" to identify this as a tool response - call_id: - type: string - description: >- - Unique identifier for the tool call this response is for - content: - $ref: '#/components/schemas/InterleavedContent' - description: The response content from the tool - additionalProperties: false - required: - - role - - call_id - - content - title: ToolResponseMessage - description: >- - A message representing the result of a tool invocation. Turn: type: object properties: @@ -2599,9 +2805,7 @@ components: input_messages: type: array items: - oneOf: - - $ref: '#/components/schemas/UserMessage' - - $ref: '#/components/schemas/ToolResponseMessage' + $ref: '#/components/schemas/OpenAIMessageParam' description: >- List of messages that initiated this turn steps: @@ -2622,9 +2826,11 @@ components: description: >- Ordered list of processing steps executed during this turn output_message: - $ref: '#/components/schemas/CompletionMessage' + $ref: '#/components/schemas/OpenAIAssistantMessageParam' description: >- The model's generated response containing content and metadata + finish_reason: + type: string output_attachments: type: array items: @@ -2633,10 +2839,9 @@ components: content: oneOf: - type: string - - $ref: '#/components/schemas/InterleavedContentItem' - type: array items: - $ref: '#/components/schemas/InterleavedContentItem' + $ref: '#/components/schemas/OpenAIChatCompletionContentPartParam' - $ref: '#/components/schemas/URL' description: The content of the attachment. mime_type: @@ -2681,31 +2886,6 @@ components: - uri title: URL description: A URL reference to external content. - UserMessage: - type: object - properties: - role: - type: string - const: user - default: user - description: >- - Must be "user" to identify this as a user message - content: - $ref: '#/components/schemas/InterleavedContent' - description: >- - The content of the message, which can include text and other media - context: - $ref: '#/components/schemas/InterleavedContent' - description: >- - (Optional) This field is used internally by Llama Stack to pass RAG context. - This field may be removed in the API in the future. - additionalProperties: false - required: - - role - - content - title: UserMessage - description: >- - A message from the user in a chat conversation. ViolationLevel: type: string enum: @@ -2720,9 +2900,7 @@ components: messages: type: array items: - oneOf: - - $ref: '#/components/schemas/UserMessage' - - $ref: '#/components/schemas/ToolResponseMessage' + $ref: '#/components/schemas/OpenAIMessageParam' description: List of messages to start the turn with. stream: type: boolean @@ -2737,10 +2915,9 @@ components: content: oneOf: - type: string - - $ref: '#/components/schemas/InterleavedContentItem' - type: array items: - $ref: '#/components/schemas/InterleavedContentItem' + $ref: '#/components/schemas/OpenAIChatCompletionContentPartParam' - $ref: '#/components/schemas/URL' description: The content of the document. mime_type: @@ -2754,13 +2931,13 @@ components: description: A document to be used by an agent. description: >- (Optional) List of documents to create the turn with. - toolgroups: + tools: type: array items: - $ref: '#/components/schemas/AgentTool' + $ref: '#/components/schemas/OpenAIResponseInputTool' description: >- - (Optional) List of toolgroups to create the turn with, will be used in - addition to the agent's config toolgroups for the request. + (Optional) List of tools to create the turn with, will be used in addition + to the agent's config tools for the request. tool_config: $ref: '#/components/schemas/ToolConfig' description: >- @@ -3074,6 +3251,29 @@ components: title: TextDelta description: >- A text content delta for streaming responses. + ToolCall: + type: object + properties: + call_id: + type: string + tool_name: + oneOf: + - type: string + enum: + - brave_search + - wolfram_alpha + - photogen + - code_interpreter + title: BuiltinTool + - type: string + arguments: + type: string + additionalProperties: false + required: + - call_id + - tool_name + - arguments + title: ToolCall ToolCallDelta: type: object properties: @@ -3111,7 +3311,7 @@ components: tool_responses: type: array items: - $ref: '#/components/schemas/ToolResponse' + $ref: '#/components/schemas/OpenAIToolMessageParam' description: >- The tool call responses to resume the turn with. stream: @@ -3335,6 +3535,68 @@ components: title: BenchmarkConfig description: >- A benchmark configuration for evaluation. + GreedySamplingStrategy: + type: object + properties: + type: + type: string + const: greedy + default: greedy + description: >- + Must be "greedy" to identify this sampling strategy + additionalProperties: false + required: + - type + title: GreedySamplingStrategy + description: >- + Greedy sampling strategy that selects the highest probability token at each + step. + ImageContentItem: + type: object + properties: + type: + type: string + const: image + default: image + description: >- + Discriminator type of the content item. Always "image" + image: + type: object + properties: + url: + $ref: '#/components/schemas/URL' + description: >- + A URL of the image or data URL in the format of data:image/{type};base64,{data}. + Note that URL could have length limits. + data: + type: string + contentEncoding: base64 + description: base64 encoded image data as string + additionalProperties: false + description: >- + Image as a base64 encoded string or an URL + additionalProperties: false + required: + - type + - image + title: ImageContentItem + description: A image content item + InterleavedContent: + oneOf: + - type: string + - $ref: '#/components/schemas/InterleavedContentItem' + - type: array + items: + $ref: '#/components/schemas/InterleavedContentItem' + InterleavedContentItem: + oneOf: + - $ref: '#/components/schemas/ImageContentItem' + - $ref: '#/components/schemas/TextContentItem' + discriminator: + propertyName: type + mapping: + image: '#/components/schemas/ImageContentItem' + text: '#/components/schemas/TextContentItem' LLMAsJudgeScoringFnParams: type: object properties: @@ -3427,6 +3689,47 @@ components: title: RegexParserScoringFnParams description: >- Parameters for regex parser scoring function configuration. + SamplingParams: + type: object + properties: + strategy: + oneOf: + - $ref: '#/components/schemas/GreedySamplingStrategy' + - $ref: '#/components/schemas/TopPSamplingStrategy' + - $ref: '#/components/schemas/TopKSamplingStrategy' + discriminator: + propertyName: type + mapping: + greedy: '#/components/schemas/GreedySamplingStrategy' + top_p: '#/components/schemas/TopPSamplingStrategy' + top_k: '#/components/schemas/TopKSamplingStrategy' + description: The sampling strategy. + max_tokens: + type: integer + default: 0 + description: >- + The maximum number of tokens that can be generated in the completion. + The token count of your prompt plus max_tokens cannot exceed the model's + context length. + repetition_penalty: + type: number + default: 1.0 + description: >- + Number between -2.0 and 2.0. Positive values penalize new tokens based + on whether they appear in the text so far, increasing the model's likelihood + to talk about new topics. + stop: + type: array + items: + type: string + description: >- + Up to 4 sequences where the API will stop generating further tokens. The + returned text will not contain the stop sequence. + additionalProperties: false + required: + - strategy + title: SamplingParams + description: Sampling parameters. ScoringFnParams: oneOf: - $ref: '#/components/schemas/LLMAsJudgeScoringFnParams' @@ -3469,6 +3772,69 @@ components: title: SystemMessage description: >- A system message providing instructions or context to the model. + TextContentItem: + type: object + properties: + type: + type: string + const: text + default: text + description: >- + Discriminator type of the content item. Always "text" + text: + type: string + description: Text content + additionalProperties: false + required: + - type + - text + title: TextContentItem + description: A text content item + TopKSamplingStrategy: + type: object + properties: + type: + type: string + const: top_k + default: top_k + description: >- + Must be "top_k" to identify this sampling strategy + top_k: + type: integer + description: >- + Number of top tokens to consider for sampling. Must be at least 1 + additionalProperties: false + required: + - type + - top_k + title: TopKSamplingStrategy + description: >- + Top-k sampling strategy that restricts sampling to the k most likely tokens. + TopPSamplingStrategy: + type: object + properties: + type: + type: string + const: top_p + default: top_p + description: >- + Must be "top_p" to identify this sampling strategy + temperature: + type: number + description: >- + Controls randomness in sampling. Higher values increase randomness + top_p: + type: number + default: 0.95 + description: >- + Cumulative probability threshold for nucleus sampling. Defaults to 0.95 + additionalProperties: false + required: + - type + title: TopPSamplingStrategy + description: >- + Top-p (nucleus) sampling strategy that samples from the smallest set of tokens + with cumulative probability >= p. EvaluateRowsRequest: type: object properties: @@ -3593,64 +3959,6 @@ components: title: Job description: >- A job execution instance with status tracking. - "OpenAIChatCompletionContentPartImageParam": - type: object - properties: - type: - type: string - const: image_url - default: image_url - description: >- - Must be "image_url" to identify this as image content - image_url: - $ref: '#/components/schemas/OpenAIImageURL' - description: >- - Image URL specification and processing details - additionalProperties: false - required: - - type - - image_url - title: >- - OpenAIChatCompletionContentPartImageParam - description: >- - Image content part for OpenAI-compatible chat completion messages. - OpenAIChatCompletionContentPartTextParam: - type: object - properties: - type: - type: string - const: text - default: text - description: >- - Must be "text" to identify this as text content - text: - type: string - description: The text content of the message - additionalProperties: false - required: - - type - - text - title: OpenAIChatCompletionContentPartTextParam - description: >- - Text content part for OpenAI-compatible chat completion messages. - OpenAIImageURL: - type: object - properties: - url: - type: string - description: >- - URL of the image to include in the message - detail: - type: string - description: >- - (Optional) Level of detail for image processing. Can be "low", "high", - or "auto" - additionalProperties: false - required: - - url - title: OpenAIImageURL - description: >- - Image URL specification for OpenAI-compatible chat completion messages. RerankRequest: type: object properties: diff --git a/docs/static/stainless-llama-stack-spec.html b/docs/static/stainless-llama-stack-spec.html index 25fa2bc03..3d31023fc 100644 --- a/docs/static/stainless-llama-stack-spec.html +++ b/docs/static/stainless-llama-stack-spec.html @@ -15576,8 +15576,20 @@ "AgentConfig": { "type": "object", "properties": { - "sampling_params": { - "$ref": "#/components/schemas/SamplingParams" + "max_output_tokens": { + "type": "integer" + }, + "temperature": { + "type": "number" + }, + "top_p": { + "type": "number" + }, + "stop": { + "type": "array", + "items": { + "type": "string" + } }, "input_shields": { "type": "array", @@ -15591,40 +15603,25 @@ "type": "string" } }, - "toolgroups": { + "tools": { "type": "array", "items": { - "$ref": "#/components/schemas/AgentTool" + "$ref": "#/components/schemas/OpenAIResponseInputTool" } }, "client_tools": { "type": "array", "items": { - "$ref": "#/components/schemas/ToolDef" + "oneOf": [ + { + "$ref": "#/components/schemas/OpenAIResponseInputTool" + }, + { + "$ref": "#/components/schemas/ToolDef" + } + ] } }, - "tool_choice": { - "type": "string", - "enum": [ - "auto", - "required", - "none" - ], - "title": "ToolChoice", - "description": "Whether tool use is required or automatic. This is a hint to the model which may not be followed. It depends on the Instruction Following capabilities of the model.", - "deprecated": true - }, - "tool_prompt_format": { - "type": "string", - "enum": [ - "json", - "function_tag", - "python_list" - ], - "title": "ToolPromptFormat", - "description": "Prompt format for calling custom / zero shot tools.", - "deprecated": true - }, "tool_config": { "$ref": "#/components/schemas/ToolConfig" }, @@ -15650,7 +15647,7 @@ "description": "Optional flag indicating whether session data has to be persisted" }, "response_format": { - "$ref": "#/components/schemas/ResponseFormat", + "$ref": "#/components/schemas/OpenAIResponseFormatParam", "description": "Optional response format configuration" } }, @@ -15662,232 +15659,6 @@ "title": "AgentConfig", "description": "Configuration for an agent." }, - "AgentTool": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "args": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - } - } - }, - "additionalProperties": false, - "required": [ - "name", - "args" - ], - "title": "AgentToolGroupWithArgs" - } - ] - }, - "GrammarResponseFormat": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "json_schema", - "grammar" - ], - "description": "Must be \"grammar\" to identify this format type", - "const": "grammar", - "default": "grammar" - }, - "bnf": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "The BNF grammar specification the response should conform to" - } - }, - "additionalProperties": false, - "required": [ - "type", - "bnf" - ], - "title": "GrammarResponseFormat", - "description": "Configuration for grammar-guided response generation." - }, - "GreedySamplingStrategy": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "greedy", - "default": "greedy", - "description": "Must be \"greedy\" to identify this sampling strategy" - } - }, - "additionalProperties": false, - "required": [ - "type" - ], - "title": "GreedySamplingStrategy", - "description": "Greedy sampling strategy that selects the highest probability token at each step." - }, - "JsonSchemaResponseFormat": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "json_schema", - "grammar" - ], - "description": "Must be \"json_schema\" to identify this format type", - "const": "json_schema", - "default": "json_schema" - }, - "json_schema": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "The JSON schema the response should conform to. In a Python SDK, this is often a `pydantic` model." - } - }, - "additionalProperties": false, - "required": [ - "type", - "json_schema" - ], - "title": "JsonSchemaResponseFormat", - "description": "Configuration for JSON schema-guided response generation." - }, - "ResponseFormat": { - "oneOf": [ - { - "$ref": "#/components/schemas/JsonSchemaResponseFormat" - }, - { - "$ref": "#/components/schemas/GrammarResponseFormat" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "json_schema": "#/components/schemas/JsonSchemaResponseFormat", - "grammar": "#/components/schemas/GrammarResponseFormat" - } - } - }, - "SamplingParams": { - "type": "object", - "properties": { - "strategy": { - "oneOf": [ - { - "$ref": "#/components/schemas/GreedySamplingStrategy" - }, - { - "$ref": "#/components/schemas/TopPSamplingStrategy" - }, - { - "$ref": "#/components/schemas/TopKSamplingStrategy" - } - ], - "discriminator": { - "propertyName": "type", - "mapping": { - "greedy": "#/components/schemas/GreedySamplingStrategy", - "top_p": "#/components/schemas/TopPSamplingStrategy", - "top_k": "#/components/schemas/TopKSamplingStrategy" - } - }, - "description": "The sampling strategy." - }, - "max_tokens": { - "type": "integer", - "default": 0, - "description": "The maximum number of tokens that can be generated in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length." - }, - "repetition_penalty": { - "type": "number", - "default": 1.0, - "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics." - }, - "stop": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence." - } - }, - "additionalProperties": false, - "required": [ - "strategy" - ], - "title": "SamplingParams", - "description": "Sampling parameters." - }, "ToolConfig": { "type": "object", "properties": { @@ -15933,54 +15704,6 @@ "title": "ToolConfig", "description": "Configuration for tool use." }, - "TopKSamplingStrategy": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "top_k", - "default": "top_k", - "description": "Must be \"top_k\" to identify this sampling strategy" - }, - "top_k": { - "type": "integer", - "description": "Number of top tokens to consider for sampling. Must be at least 1" - } - }, - "additionalProperties": false, - "required": [ - "type", - "top_k" - ], - "title": "TopKSamplingStrategy", - "description": "Top-k sampling strategy that restricts sampling to the k most likely tokens." - }, - "TopPSamplingStrategy": { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "top_p", - "default": "top_p", - "description": "Must be \"top_p\" to identify this sampling strategy" - }, - "temperature": { - "type": "number", - "description": "Controls randomness in sampling. Higher values increase randomness" - }, - "top_p": { - "type": "number", - "default": 0.95, - "description": "Cumulative probability threshold for nucleus sampling. Defaults to 0.95" - } - }, - "additionalProperties": false, - "required": [ - "type" - ], - "title": "TopPSamplingStrategy", - "description": "Top-p (nucleus) sampling strategy that samples from the smallest set of tokens with cumulative probability >= p." - }, "CreateAgentRequest": { "type": "object", "properties": { @@ -16100,8 +15823,11 @@ "default": "inference" }, "model_response": { - "$ref": "#/components/schemas/CompletionMessage", + "$ref": "#/components/schemas/OpenAIAssistantMessageParam", "description": "The response from the LLM." + }, + "finish_reason": { + "type": "string" } }, "additionalProperties": false, @@ -16153,7 +15879,17 @@ "description": "The IDs of the vector databases to retrieve context from." }, "inserted_context": { - "$ref": "#/components/schemas/InterleavedContent", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartParam" + } + } + ], "description": "The context retrieved from the vector databases." } }, @@ -16287,14 +16023,14 @@ "tool_calls": { "type": "array", "items": { - "$ref": "#/components/schemas/ToolCall" + "$ref": "#/components/schemas/OpenAIChatCompletionToolCall" }, "description": "The tool calls to execute." }, "tool_responses": { "type": "array", "items": { - "$ref": "#/components/schemas/ToolResponse" + "$ref": "#/components/schemas/OpenAIToolMessageParam" }, "description": "The tool responses from the tool calls." } @@ -16310,71 +16046,6 @@ "title": "ToolExecutionStep", "description": "A tool execution step in an agent turn." }, - "ToolResponse": { - "type": "object", - "properties": { - "call_id": { - "type": "string", - "description": "Unique identifier for the tool call this response is for" - }, - "tool_name": { - "oneOf": [ - { - "type": "string", - "enum": [ - "brave_search", - "wolfram_alpha", - "photogen", - "code_interpreter" - ], - "title": "BuiltinTool" - }, - { - "type": "string" - } - ], - "description": "Name of the tool that was invoked" - }, - "content": { - "$ref": "#/components/schemas/InterleavedContent", - "description": "The response content from the tool" - }, - "metadata": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "(Optional) Additional metadata about the tool response" - } - }, - "additionalProperties": false, - "required": [ - "call_id", - "tool_name", - "content" - ], - "title": "ToolResponse", - "description": "Response from a tool invocation." - }, "Turn": { "type": "object", "properties": { @@ -16389,14 +16060,7 @@ "input_messages": { "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserMessage" - }, - { - "$ref": "#/components/schemas/ToolResponseMessage" - } - ] + "$ref": "#/components/schemas/OpenAIMessageParam" }, "description": "List of messages that initiated this turn" }, @@ -16430,9 +16094,12 @@ "description": "Ordered list of processing steps executed during this turn" }, "output_message": { - "$ref": "#/components/schemas/CompletionMessage", + "$ref": "#/components/schemas/OpenAIAssistantMessageParam", "description": "The model's generated response containing content and metadata" }, + "finish_reason": { + "type": "string" + }, "output_attachments": { "type": "array", "items": { @@ -16443,13 +16110,10 @@ { "type": "string" }, - { - "$ref": "#/components/schemas/InterleavedContentItem" - }, { "type": "array", "items": { - "$ref": "#/components/schemas/InterleavedContentItem" + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartParam" } }, { @@ -16502,14 +16166,7 @@ "messages": { "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/UserMessage" - }, - { - "$ref": "#/components/schemas/ToolResponseMessage" - } - ] + "$ref": "#/components/schemas/OpenAIMessageParam" }, "description": "List of messages to start the turn with." }, @@ -16527,13 +16184,10 @@ { "type": "string" }, - { - "$ref": "#/components/schemas/InterleavedContentItem" - }, { "type": "array", "items": { - "$ref": "#/components/schemas/InterleavedContentItem" + "$ref": "#/components/schemas/OpenAIChatCompletionContentPartParam" } }, { @@ -16557,12 +16211,12 @@ }, "description": "(Optional) List of documents to create the turn with." }, - "toolgroups": { + "tools": { "type": "array", "items": { - "$ref": "#/components/schemas/AgentTool" + "$ref": "#/components/schemas/OpenAIResponseInputTool" }, - "description": "(Optional) List of toolgroups to create the turn with, will be used in addition to the agent's config toolgroups for the request." + "description": "(Optional) List of tools to create the turn with, will be used in addition to the agent's config tools for the request." }, "tool_config": { "$ref": "#/components/schemas/ToolConfig", @@ -17015,7 +16669,7 @@ "tool_responses": { "type": "array", "items": { - "$ref": "#/components/schemas/ToolResponse" + "$ref": "#/components/schemas/OpenAIToolMessageParam" }, "description": "The tool call responses to resume the turn with." }, @@ -17285,6 +16939,23 @@ "title": "BenchmarkConfig", "description": "A benchmark configuration for evaluation." }, + "GreedySamplingStrategy": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "greedy", + "default": "greedy", + "description": "Must be \"greedy\" to identify this sampling strategy" + } + }, + "additionalProperties": false, + "required": [ + "type" + ], + "title": "GreedySamplingStrategy", + "description": "Greedy sampling strategy that selects the highest probability token at each step." + }, "ModelCandidate": { "type": "object", "properties": { @@ -17315,6 +16986,104 @@ "title": "ModelCandidate", "description": "A model candidate for evaluation." }, + "SamplingParams": { + "type": "object", + "properties": { + "strategy": { + "oneOf": [ + { + "$ref": "#/components/schemas/GreedySamplingStrategy" + }, + { + "$ref": "#/components/schemas/TopPSamplingStrategy" + }, + { + "$ref": "#/components/schemas/TopKSamplingStrategy" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "greedy": "#/components/schemas/GreedySamplingStrategy", + "top_p": "#/components/schemas/TopPSamplingStrategy", + "top_k": "#/components/schemas/TopKSamplingStrategy" + } + }, + "description": "The sampling strategy." + }, + "max_tokens": { + "type": "integer", + "default": 0, + "description": "The maximum number of tokens that can be generated in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length." + }, + "repetition_penalty": { + "type": "number", + "default": 1.0, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics." + }, + "stop": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence." + } + }, + "additionalProperties": false, + "required": [ + "strategy" + ], + "title": "SamplingParams", + "description": "Sampling parameters." + }, + "TopKSamplingStrategy": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "top_k", + "default": "top_k", + "description": "Must be \"top_k\" to identify this sampling strategy" + }, + "top_k": { + "type": "integer", + "description": "Number of top tokens to consider for sampling. Must be at least 1" + } + }, + "additionalProperties": false, + "required": [ + "type", + "top_k" + ], + "title": "TopKSamplingStrategy", + "description": "Top-k sampling strategy that restricts sampling to the k most likely tokens." + }, + "TopPSamplingStrategy": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "top_p", + "default": "top_p", + "description": "Must be \"top_p\" to identify this sampling strategy" + }, + "temperature": { + "type": "number", + "description": "Controls randomness in sampling. Higher values increase randomness" + }, + "top_p": { + "type": "number", + "default": 0.95, + "description": "Cumulative probability threshold for nucleus sampling. Defaults to 0.95" + } + }, + "additionalProperties": false, + "required": [ + "type" + ], + "title": "TopPSamplingStrategy", + "description": "Top-p (nucleus) sampling strategy that samples from the smallest set of tokens with cumulative probability >= p." + }, "EvaluateRowsRequest": { "type": "object", "properties": { diff --git a/docs/static/stainless-llama-stack-spec.yaml b/docs/static/stainless-llama-stack-spec.yaml index df0112be7..7d2f88b77 100644 --- a/docs/static/stainless-llama-stack-spec.yaml +++ b/docs/static/stainless-llama-stack-spec.yaml @@ -11663,8 +11663,16 @@ components: AgentConfig: type: object properties: - sampling_params: - $ref: '#/components/schemas/SamplingParams' + max_output_tokens: + type: integer + temperature: + type: number + top_p: + type: number + stop: + type: array + items: + type: string input_shields: type: array items: @@ -11673,36 +11681,16 @@ components: type: array items: type: string - toolgroups: + tools: type: array items: - $ref: '#/components/schemas/AgentTool' + $ref: '#/components/schemas/OpenAIResponseInputTool' client_tools: type: array items: - $ref: '#/components/schemas/ToolDef' - tool_choice: - type: string - enum: - - auto - - required - - none - title: ToolChoice - description: >- - Whether tool use is required or automatic. This is a hint to the model - which may not be followed. It depends on the Instruction Following capabilities - of the model. - deprecated: true - tool_prompt_format: - type: string - enum: - - json - - function_tag - - python_list - title: ToolPromptFormat - description: >- - Prompt format for calling custom / zero shot tools. - deprecated: true + oneOf: + - $ref: '#/components/schemas/OpenAIResponseInputTool' + - $ref: '#/components/schemas/ToolDef' tool_config: $ref: '#/components/schemas/ToolConfig' max_infer_iters: @@ -11725,7 +11713,7 @@ components: description: >- Optional flag indicating whether session data has to be persisted response_format: - $ref: '#/components/schemas/ResponseFormat' + $ref: '#/components/schemas/OpenAIResponseFormatParam' description: Optional response format configuration additionalProperties: false required: @@ -11733,157 +11721,6 @@ components: - instructions title: AgentConfig description: Configuration for an agent. - AgentTool: - oneOf: - - type: string - - type: object - properties: - name: - type: string - args: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - additionalProperties: false - required: - - name - - args - title: AgentToolGroupWithArgs - GrammarResponseFormat: - type: object - properties: - type: - type: string - enum: - - json_schema - - grammar - description: >- - Must be "grammar" to identify this format type - const: grammar - default: grammar - bnf: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - description: >- - The BNF grammar specification the response should conform to - additionalProperties: false - required: - - type - - bnf - title: GrammarResponseFormat - description: >- - Configuration for grammar-guided response generation. - GreedySamplingStrategy: - type: object - properties: - type: - type: string - const: greedy - default: greedy - description: >- - Must be "greedy" to identify this sampling strategy - additionalProperties: false - required: - - type - title: GreedySamplingStrategy - description: >- - Greedy sampling strategy that selects the highest probability token at each - step. - JsonSchemaResponseFormat: - type: object - properties: - type: - type: string - enum: - - json_schema - - grammar - description: >- - Must be "json_schema" to identify this format type - const: json_schema - default: json_schema - json_schema: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - description: >- - The JSON schema the response should conform to. In a Python SDK, this - is often a `pydantic` model. - additionalProperties: false - required: - - type - - json_schema - title: JsonSchemaResponseFormat - description: >- - Configuration for JSON schema-guided response generation. - ResponseFormat: - oneOf: - - $ref: '#/components/schemas/JsonSchemaResponseFormat' - - $ref: '#/components/schemas/GrammarResponseFormat' - discriminator: - propertyName: type - mapping: - json_schema: '#/components/schemas/JsonSchemaResponseFormat' - grammar: '#/components/schemas/GrammarResponseFormat' - SamplingParams: - type: object - properties: - strategy: - oneOf: - - $ref: '#/components/schemas/GreedySamplingStrategy' - - $ref: '#/components/schemas/TopPSamplingStrategy' - - $ref: '#/components/schemas/TopKSamplingStrategy' - discriminator: - propertyName: type - mapping: - greedy: '#/components/schemas/GreedySamplingStrategy' - top_p: '#/components/schemas/TopPSamplingStrategy' - top_k: '#/components/schemas/TopKSamplingStrategy' - description: The sampling strategy. - max_tokens: - type: integer - default: 0 - description: >- - The maximum number of tokens that can be generated in the completion. - The token count of your prompt plus max_tokens cannot exceed the model's - context length. - repetition_penalty: - type: number - default: 1.0 - description: >- - Number between -2.0 and 2.0. Positive values penalize new tokens based - on whether they appear in the text so far, increasing the model's likelihood - to talk about new topics. - stop: - type: array - items: - type: string - description: >- - Up to 4 sequences where the API will stop generating further tokens. The - returned text will not contain the stop sequence. - additionalProperties: false - required: - - strategy - title: SamplingParams - description: Sampling parameters. ToolConfig: type: object properties: @@ -11932,51 +11769,6 @@ components: additionalProperties: false title: ToolConfig description: Configuration for tool use. - TopKSamplingStrategy: - type: object - properties: - type: - type: string - const: top_k - default: top_k - description: >- - Must be "top_k" to identify this sampling strategy - top_k: - type: integer - description: >- - Number of top tokens to consider for sampling. Must be at least 1 - additionalProperties: false - required: - - type - - top_k - title: TopKSamplingStrategy - description: >- - Top-k sampling strategy that restricts sampling to the k most likely tokens. - TopPSamplingStrategy: - type: object - properties: - type: - type: string - const: top_p - default: top_p - description: >- - Must be "top_p" to identify this sampling strategy - temperature: - type: number - description: >- - Controls randomness in sampling. Higher values increase randomness - top_p: - type: number - default: 0.95 - description: >- - Cumulative probability threshold for nucleus sampling. Defaults to 0.95 - additionalProperties: false - required: - - type - title: TopPSamplingStrategy - description: >- - Top-p (nucleus) sampling strategy that samples from the smallest set of tokens - with cumulative probability >= p. CreateAgentRequest: type: object properties: @@ -12072,8 +11864,10 @@ components: const: inference default: inference model_response: - $ref: '#/components/schemas/CompletionMessage' + $ref: '#/components/schemas/OpenAIAssistantMessageParam' description: The response from the LLM. + finish_reason: + type: string additionalProperties: false required: - turn_id @@ -12115,7 +11909,11 @@ components: description: >- The IDs of the vector databases to retrieve context from. inserted_context: - $ref: '#/components/schemas/InterleavedContent' + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/OpenAIChatCompletionContentPartParam' description: >- The context retrieved from the vector databases. additionalProperties: false @@ -12226,12 +12024,12 @@ components: tool_calls: type: array items: - $ref: '#/components/schemas/ToolCall' + $ref: '#/components/schemas/OpenAIChatCompletionToolCall' description: The tool calls to execute. tool_responses: type: array items: - $ref: '#/components/schemas/ToolResponse' + $ref: '#/components/schemas/OpenAIToolMessageParam' description: The tool responses from the tool calls. additionalProperties: false required: @@ -12242,46 +12040,6 @@ components: - tool_responses title: ToolExecutionStep description: A tool execution step in an agent turn. - ToolResponse: - type: object - properties: - call_id: - type: string - description: >- - Unique identifier for the tool call this response is for - tool_name: - oneOf: - - type: string - enum: - - brave_search - - wolfram_alpha - - photogen - - code_interpreter - title: BuiltinTool - - type: string - description: Name of the tool that was invoked - content: - $ref: '#/components/schemas/InterleavedContent' - description: The response content from the tool - metadata: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - description: >- - (Optional) Additional metadata about the tool response - additionalProperties: false - required: - - call_id - - tool_name - - content - title: ToolResponse - description: Response from a tool invocation. Turn: type: object properties: @@ -12296,9 +12054,7 @@ components: input_messages: type: array items: - oneOf: - - $ref: '#/components/schemas/UserMessage' - - $ref: '#/components/schemas/ToolResponseMessage' + $ref: '#/components/schemas/OpenAIMessageParam' description: >- List of messages that initiated this turn steps: @@ -12319,9 +12075,11 @@ components: description: >- Ordered list of processing steps executed during this turn output_message: - $ref: '#/components/schemas/CompletionMessage' + $ref: '#/components/schemas/OpenAIAssistantMessageParam' description: >- The model's generated response containing content and metadata + finish_reason: + type: string output_attachments: type: array items: @@ -12330,10 +12088,9 @@ components: content: oneOf: - type: string - - $ref: '#/components/schemas/InterleavedContentItem' - type: array items: - $ref: '#/components/schemas/InterleavedContentItem' + $ref: '#/components/schemas/OpenAIChatCompletionContentPartParam' - $ref: '#/components/schemas/URL' description: The content of the attachment. mime_type: @@ -12373,9 +12130,7 @@ components: messages: type: array items: - oneOf: - - $ref: '#/components/schemas/UserMessage' - - $ref: '#/components/schemas/ToolResponseMessage' + $ref: '#/components/schemas/OpenAIMessageParam' description: List of messages to start the turn with. stream: type: boolean @@ -12390,10 +12145,9 @@ components: content: oneOf: - type: string - - $ref: '#/components/schemas/InterleavedContentItem' - type: array items: - $ref: '#/components/schemas/InterleavedContentItem' + $ref: '#/components/schemas/OpenAIChatCompletionContentPartParam' - $ref: '#/components/schemas/URL' description: The content of the document. mime_type: @@ -12407,13 +12161,13 @@ components: description: A document to be used by an agent. description: >- (Optional) List of documents to create the turn with. - toolgroups: + tools: type: array items: - $ref: '#/components/schemas/AgentTool' + $ref: '#/components/schemas/OpenAIResponseInputTool' description: >- - (Optional) List of toolgroups to create the turn with, will be used in - addition to the agent's config toolgroups for the request. + (Optional) List of tools to create the turn with, will be used in addition + to the agent's config tools for the request. tool_config: $ref: '#/components/schemas/ToolConfig' description: >- @@ -12764,7 +12518,7 @@ components: tool_responses: type: array items: - $ref: '#/components/schemas/ToolResponse' + $ref: '#/components/schemas/OpenAIToolMessageParam' description: >- The tool call responses to resume the turn with. stream: @@ -12955,6 +12709,22 @@ components: title: BenchmarkConfig description: >- A benchmark configuration for evaluation. + GreedySamplingStrategy: + type: object + properties: + type: + type: string + const: greedy + default: greedy + description: >- + Must be "greedy" to identify this sampling strategy + additionalProperties: false + required: + - type + title: GreedySamplingStrategy + description: >- + Greedy sampling strategy that selects the highest probability token at each + step. ModelCandidate: type: object properties: @@ -12980,6 +12750,92 @@ components: - sampling_params title: ModelCandidate description: A model candidate for evaluation. + SamplingParams: + type: object + properties: + strategy: + oneOf: + - $ref: '#/components/schemas/GreedySamplingStrategy' + - $ref: '#/components/schemas/TopPSamplingStrategy' + - $ref: '#/components/schemas/TopKSamplingStrategy' + discriminator: + propertyName: type + mapping: + greedy: '#/components/schemas/GreedySamplingStrategy' + top_p: '#/components/schemas/TopPSamplingStrategy' + top_k: '#/components/schemas/TopKSamplingStrategy' + description: The sampling strategy. + max_tokens: + type: integer + default: 0 + description: >- + The maximum number of tokens that can be generated in the completion. + The token count of your prompt plus max_tokens cannot exceed the model's + context length. + repetition_penalty: + type: number + default: 1.0 + description: >- + Number between -2.0 and 2.0. Positive values penalize new tokens based + on whether they appear in the text so far, increasing the model's likelihood + to talk about new topics. + stop: + type: array + items: + type: string + description: >- + Up to 4 sequences where the API will stop generating further tokens. The + returned text will not contain the stop sequence. + additionalProperties: false + required: + - strategy + title: SamplingParams + description: Sampling parameters. + TopKSamplingStrategy: + type: object + properties: + type: + type: string + const: top_k + default: top_k + description: >- + Must be "top_k" to identify this sampling strategy + top_k: + type: integer + description: >- + Number of top tokens to consider for sampling. Must be at least 1 + additionalProperties: false + required: + - type + - top_k + title: TopKSamplingStrategy + description: >- + Top-k sampling strategy that restricts sampling to the k most likely tokens. + TopPSamplingStrategy: + type: object + properties: + type: + type: string + const: top_p + default: top_p + description: >- + Must be "top_p" to identify this sampling strategy + temperature: + type: number + description: >- + Controls randomness in sampling. Higher values increase randomness + top_p: + type: number + default: 0.95 + description: >- + Cumulative probability threshold for nucleus sampling. Defaults to 0.95 + additionalProperties: false + required: + - type + title: TopPSamplingStrategy + description: >- + Top-p (nucleus) sampling strategy that samples from the smallest set of tokens + with cumulative probability >= p. EvaluateRowsRequest: type: object properties: diff --git a/llama_stack/apis/agents/agents.py b/llama_stack/apis/agents/agents.py index 17b166ba2..f668a87dc 100644 --- a/llama_stack/apis/agents/agents.py +++ b/llama_stack/apis/agents/agents.py @@ -20,9 +20,7 @@ from llama_stack.apis.inference import ( OpenAIMessageParam, OpenAIResponseFormatParam, OpenAIToolMessageParam, - ToolChoice, ToolConfig, - ToolPromptFormat, ) from llama_stack.apis.safety import SafetyViolation from llama_stack.apis.tools import ToolDef @@ -107,7 +105,6 @@ class StepType(StrEnum): memory_retrieval = "memory_retrieval" -@json_schema_type @json_schema_type class InferenceStep(StepCommon): """An inference step in an agent turn. @@ -208,15 +205,6 @@ class Session(BaseModel): started_at: datetime -class AgentToolGroupWithArgs(BaseModel): - name: str - args: dict[str, Any] - - -AgentToolGroup = str | AgentToolGroupWithArgs -register_schema(AgentToolGroup, name="AgentTool") - - class AgentConfigCommon(BaseModel): max_output_tokens: int | None = None temperature: float | None = None @@ -225,7 +213,7 @@ class AgentConfigCommon(BaseModel): input_shields: list[str] | None = Field(default_factory=list) output_shields: list[str] | None = Field(default_factory=list) - toolgroups: list[AgentToolGroup] | None = Field(default_factory=list) + tools: list[OpenAIResponseInputTool] | None = Field(default_factory=list) client_tools: list[OpenAIResponseInputTool | ToolDef] | None = Field(default_factory=list) tool_config: ToolConfig | None = Field(default=None) @@ -419,7 +407,7 @@ class AgentTurnCreateRequest(AgentConfigOverridablePerTurn): :param session_id: Unique identifier for the conversation session :param messages: List of messages to start the turn with :param documents: (Optional) List of documents to provide to the agent - :param toolgroups: (Optional) List of tool groups to make available for this turn + :param tools: (Optional) List of tools to make available for this turn :param stream: (Optional) Whether to stream the response :param tool_config: (Optional) Tool configuration to override agent defaults """ @@ -430,7 +418,7 @@ class AgentTurnCreateRequest(AgentConfigOverridablePerTurn): messages: list[OpenAIMessageParam] documents: list[Document] | None = None - toolgroups: list[AgentToolGroup] | None = Field(default_factory=lambda: []) + tools: list[OpenAIResponseInputTool] | None = Field(default_factory=lambda: []) stream: bool | None = False tool_config: ToolConfig | None = None @@ -524,7 +512,7 @@ class Agents(Protocol): messages: list[OpenAIMessageParam], stream: bool | None = False, documents: list[Document] | None = None, - toolgroups: list[AgentToolGroup] | None = None, + tools: list[OpenAIResponseInputTool] | None = None, tool_config: ToolConfig | None = None, ) -> Turn | AsyncIterator[AgentTurnResponseStreamChunk]: """Create a new turn for an agent. @@ -534,7 +522,7 @@ class Agents(Protocol): :param messages: List of messages to start the turn with. :param stream: (Optional) If True, generate an SSE event stream of the response. Defaults to False. :param documents: (Optional) List of documents to create the turn with. - :param toolgroups: (Optional) List of toolgroups to create the turn with, will be used in addition to the agent's config toolgroups for the request. + :param tools: (Optional) List of tools to create the turn with, will be used in addition to the agent's config tools for the request. :param tool_config: (Optional) The tool configuration to create the turn with, will be used to override the agent's tool_config. :returns: If stream=False, returns a Turn object. If stream=True, returns an SSE event stream of AgentTurnResponseStreamChunk. diff --git a/llama_stack/core/library_client.py b/llama_stack/core/library_client.py index 0d9f9f134..7cccfe574 100644 --- a/llama_stack/core/library_client.py +++ b/llama_stack/core/library_client.py @@ -100,8 +100,6 @@ def convert_to_pydantic(annotation: Any, value: Any) -> Any: return TypeAdapter(annotation).validate_python(value) except Exception as e: - # TODO: this is workardound for having Union[str, AgentToolGroup] in API schema. - # We should get rid of any non-discriminated unions in the API schema. if origin is Union: for union_type in get_args(annotation): try: diff --git a/llama_stack/providers/inline/agents/meta_reference/agent_instance.py b/llama_stack/providers/inline/agents/meta_reference/agent_instance.py index 1e7f1a9f6..91a578836 100644 --- a/llama_stack/providers/inline/agents/meta_reference/agent_instance.py +++ b/llama_stack/providers/inline/agents/meta_reference/agent_instance.py @@ -10,16 +10,13 @@ import re import uuid import warnings from collections.abc import AsyncGenerator -from typing import Any from datetime import UTC, datetime +from typing import Any import httpx from llama_stack.apis.agents import ( AgentConfig, - OpenAIResponseInputTool, - AgentToolGroup, - AgentToolGroupWithArgs, AgentTurnCreateRequest, AgentTurnResponseEvent, AgentTurnResponseEventType, @@ -33,12 +30,19 @@ from llama_stack.apis.agents import ( Attachment, Document, InferenceStep, + OpenAIResponseInputTool, ShieldCallStep, Step, StepType, ToolExecutionStep, Turn, ) +from llama_stack.apis.agents.openai_responses import ( + OpenAIResponseInputToolFileSearch, + OpenAIResponseInputToolFunction, + OpenAIResponseInputToolMCP, + OpenAIResponseInputToolWebSearch, +) from llama_stack.apis.common.content_types import URL, ToolCallDelta, ToolCallParseStatus from llama_stack.apis.common.errors import SessionNotFoundError from llama_stack.apis.inference import ( @@ -47,13 +51,12 @@ from llama_stack.apis.inference import ( Inference, Message, OpenAIAssistantMessageParam, - OpenAIDeveloperMessageParam, OpenAIChatCompletionContentPartImageParam, OpenAIChatCompletionContentPartTextParam, OpenAIChatCompletionMessageContent, OpenAIChatCompletionToolCall, OpenAIChatCompletionToolCallFunction, - OpenAIImageURL, + OpenAIDeveloperMessageParam, OpenAIMessageParam, OpenAISystemMessageParam, OpenAIToolMessageParam, @@ -123,7 +126,9 @@ def _openai_tool_call_to_legacy(tool_call: OpenAIChatCompletionToolCall) -> Tool def _legacy_tool_call_to_openai(tool_call: ToolCall, index: int | None = None) -> OpenAIChatCompletionToolCall: - function_name = tool_call.tool_name if not isinstance(tool_call.tool_name, BuiltinTool) else tool_call.tool_name.value + function_name = ( + tool_call.tool_name if not isinstance(tool_call.tool_name, BuiltinTool) else tool_call.tool_name.value + ) return OpenAIChatCompletionToolCall( index=index, id=tool_call.call_id, @@ -178,9 +183,9 @@ def _coerce_to_text(content: Any) -> str: if isinstance(content, list): return "\n".join(_coerce_to_text(item) for item in content) if hasattr(content, "text"): - return getattr(content, "text") + return content.text if hasattr(content, "image"): - image = getattr(content, "image") + image = content.image if hasattr(image, "url") and image.url: return getattr(image.url, "uri", "") return str(content) @@ -200,10 +205,7 @@ def _openai_message_param_to_legacy(message: OpenAIMessageParam) -> Message: # Map developer messages to user role for legacy compatibility return UserMessage(content=_openai_message_content_to_text(message.content)) if isinstance(message, OpenAIAssistantMessageParam): - tool_calls = [ - _openai_tool_call_to_legacy(tool_call) - for tool_call in message.tool_calls or [] - ] + tool_calls = [_openai_tool_call_to_legacy(tool_call) for tool_call in message.tool_calls or []] return CompletionMessage( content=_openai_message_content_to_text(message.content) if message.content is not None else "", stop_reason=StopReason.end_of_turn, @@ -279,6 +281,10 @@ class ChatAgent(ShieldRunnerMixin): self.created_at = created_at self.telemetry_enabled = telemetry_enabled + self.tool_defs: list[ToolDefinition] = [] + self.tool_name_to_args: dict[str | BuiltinTool, dict[str, Any]] = {} + self.client_tools_config: list[OpenAIResponseInputTool | ToolDef] = [] + ShieldRunnerMixin.__init__( self, safety_api, @@ -367,7 +373,7 @@ class ChatAgent(ShieldRunnerMixin): if self.agent_config.name: span.set_attribute("agent_name", self.agent_config.name) - await self._initialize_tools(request.toolgroups) + await self._initialize_tools(request.tools) async for chunk in self._run_turn(request, turn_id): yield chunk @@ -682,12 +688,11 @@ class ChatAgent(ShieldRunnerMixin): # Build a map of custom tools to their definitions for faster lookup client_tools: dict[str, OpenAIResponseInputTool | ToolDef] = {} - if self.agent_config.client_tools: - for tool in self.agent_config.client_tools: - if isinstance(tool, ToolDef) and tool.name: - client_tools[tool.name] = tool - elif getattr(tool, "type", None) == "function" and getattr(tool, "name", None): - client_tools[tool.name] = tool + for tool in self.client_tools_config or []: + if isinstance(tool, ToolDef) and tool.name: + client_tools[tool.name] = tool + elif getattr(tool, "type", None) == "function" and getattr(tool, "name", None): + client_tools[tool.name] = tool while True: step_id = str(uuid.uuid4()) inference_start_time = datetime.now(UTC).isoformat() @@ -987,91 +992,124 @@ class ChatAgent(ShieldRunnerMixin): async def _initialize_tools( self, - toolgroups_for_turn: list[AgentToolGroup] | None = None, + tools_for_turn: list[OpenAIResponseInputTool] | None = None, ) -> None: - toolgroup_to_args = {} - for toolgroup in (self.agent_config.toolgroups or []) + (toolgroups_for_turn or []): - if isinstance(toolgroup, AgentToolGroupWithArgs): - tool_group_name, _ = self._parse_toolgroup_name(toolgroup.name) - toolgroup_to_args[tool_group_name] = toolgroup.args - - # Determine which tools to include - tool_groups_to_include = toolgroups_for_turn or self.agent_config.toolgroups or [] - agent_config_toolgroups = [] - for toolgroup in tool_groups_to_include: - name = toolgroup.name if isinstance(toolgroup, AgentToolGroupWithArgs) else toolgroup - if name not in agent_config_toolgroups: - agent_config_toolgroups.append(name) - - toolgroup_to_args = toolgroup_to_args or {} - tool_name_to_def: dict[str | BuiltinTool, ToolDefinition] = {} tool_name_to_args: dict[str | BuiltinTool, dict[str, Any]] = {} + client_tools_map: dict[str, OpenAIResponseInputTool | ToolDef] = {} + + def add_tool_definition(identifier: str | BuiltinTool, tool_definition: ToolDefinition) -> None: + if identifier in tool_name_to_def: + raise ValueError(f"Tool {identifier} already exists") + tool_name_to_def[identifier] = tool_definition + + def add_client_tool(tool: OpenAIResponseInputTool | ToolDef) -> None: + name = getattr(tool, "name", None) + if isinstance(tool, ToolDef): + name = tool.name + if not name: + raise ValueError("Client tools must have a name") + if name not in client_tools_map: + client_tools_map[name] = tool + tool_definition = _client_tool_to_tool_definition(tool) + add_tool_definition(tool_definition.tool_name, tool_definition) if self.agent_config.client_tools: for tool in self.agent_config.client_tools: - tool_definition = _client_tool_to_tool_definition(tool) - if tool_name_to_def.get(tool_definition.tool_name): - raise ValueError(f"Tool {tool_definition.tool_name} already exists") - tool_name_to_def[tool_definition.tool_name] = tool_definition - for toolgroup_name_with_maybe_tool_name in agent_config_toolgroups: - toolgroup_name, input_tool_name = self._parse_toolgroup_name(toolgroup_name_with_maybe_tool_name) - tools = await self.tool_groups_api.list_tools(toolgroup_id=toolgroup_name) - if not tools.data: - available_tool_groups = ", ".join( - [t.identifier for t in (await self.tool_groups_api.list_tool_groups()).data] - ) - raise ValueError(f"Toolgroup {toolgroup_name} not found, available toolgroups: {available_tool_groups}") - if input_tool_name is not None and not any(tool.name == input_tool_name for tool in tools.data): - raise ValueError( - f"Tool {input_tool_name} not found in toolgroup {toolgroup_name}. Available tools: {', '.join([tool.name for tool in tools.data])}" - ) + add_client_tool(tool) - for tool_def in tools.data: - if toolgroup_name.startswith("builtin") and toolgroup_name != RAG_TOOL_GROUP: - identifier: str | BuiltinTool | None = tool_def.name - if identifier == "web_search": - identifier = BuiltinTool.brave_search - else: - identifier = BuiltinTool(identifier) - else: - # add if tool_name is unspecified or the tool_def identifier is the same as the tool_name - if input_tool_name in (None, tool_def.name): - identifier = tool_def.name - else: - identifier = None + effective_tools = tools_for_turn + if effective_tools is None: + effective_tools = self.agent_config.tools - if tool_name_to_def.get(identifier, None): - raise ValueError(f"Tool {identifier} already exists") - if identifier: - tool_name_to_def[identifier] = ToolDefinition( + for tool in effective_tools or []: + if isinstance(tool, OpenAIResponseInputToolFunction): + add_client_tool(tool) + continue + + resolved_tools = await self._resolve_response_tool(tool) + for identifier, definition, args in resolved_tools: + add_tool_definition(identifier, definition) + if args: + existing_args = tool_name_to_args.get(identifier, {}) + tool_name_to_args[identifier] = {**existing_args, **args} + + self.tool_defs = list(tool_name_to_def.values()) + self.tool_name_to_args = tool_name_to_args + self.client_tools_config = list(client_tools_map.values()) + + async def _resolve_response_tool( + self, + tool: OpenAIResponseInputTool, + ) -> list[tuple[str | BuiltinTool, ToolDefinition, dict[str, Any]]]: + if isinstance(tool, OpenAIResponseInputToolWebSearch): + tool_def = await self.tool_groups_api.get_tool(WEB_SEARCH_TOOL) + if tool_def is None: + raise ValueError("web_search tool is not registered") + identifier: str | BuiltinTool = BuiltinTool.brave_search + return [ + ( + identifier, + ToolDefinition( tool_name=identifier, description=tool_def.description, input_schema=tool_def.input_schema, + ), + {}, + ) + ] + + if isinstance(tool, OpenAIResponseInputToolFileSearch): + tool_def = await self.tool_groups_api.get_tool(MEMORY_QUERY_TOOL) + if tool_def is None: + raise ValueError("knowledge_search tool is not registered") + args: dict[str, Any] = { + "vector_db_ids": tool.vector_store_ids, + } + if tool.filters is not None: + args["filters"] = tool.filters + if tool.max_num_results is not None: + args["max_num_results"] = tool.max_num_results + if tool.ranking_options is not None: + args["ranking_options"] = tool.ranking_options.model_dump() + + return [ + ( + tool_def.name, + ToolDefinition( + tool_name=tool_def.name, + description=tool_def.description, + input_schema=tool_def.input_schema, + ), + args, + ) + ] + + if isinstance(tool, OpenAIResponseInputToolMCP): + toolgroup_id = tool.server_label + if not toolgroup_id.startswith("mcp::"): + toolgroup_id = f"mcp::{toolgroup_id}" + tools = await self.tool_groups_api.list_tools(toolgroup_id=toolgroup_id) + if not tools.data: + raise ValueError( + f"No tools registered for MCP server '{tool.server_label}'. Ensure the toolgroup '{toolgroup_id}' is registered." + ) + resolved: list[tuple[str | BuiltinTool, ToolDefinition, dict[str, Any]]] = [] + for tool_def in tools.data: + resolved.append( + ( + tool_def.name, + ToolDefinition( + tool_name=tool_def.name, + description=tool_def.description, + input_schema=tool_def.input_schema, + ), + {}, ) - tool_name_to_args[identifier] = toolgroup_to_args.get(toolgroup_name, {}) + ) + return resolved - self.tool_defs, self.tool_name_to_args = ( - list(tool_name_to_def.values()), - tool_name_to_args, - ) - - def _parse_toolgroup_name(self, toolgroup_name_with_maybe_tool_name: str) -> tuple[str, str | None]: - """Parse a toolgroup name into its components. - - Args: - toolgroup_name: The toolgroup name to parse (e.g. "builtin::rag/knowledge_search") - - Returns: - A tuple of (tool_type, tool_group, tool_name) - """ - split_names = toolgroup_name_with_maybe_tool_name.split("/") - if len(split_names) == 2: - # e.g. "builtin::rag" - tool_group, tool_name = split_names - else: - tool_group, tool_name = split_names[0], None - return tool_group, tool_name + raise ValueError(f"Unsupported tool type '{getattr(tool, 'type', None)}' in agent configuration") async def execute_tool_call_maybe( self, diff --git a/llama_stack/providers/inline/agents/meta_reference/agents.py b/llama_stack/providers/inline/agents/meta_reference/agents.py index bfa04600e..b3aa2418c 100644 --- a/llama_stack/providers/inline/agents/meta_reference/agents.py +++ b/llama_stack/providers/inline/agents/meta_reference/agents.py @@ -15,7 +15,6 @@ from llama_stack.apis.agents import ( Agents, AgentSessionCreateResponse, AgentStepResponse, - AgentToolGroup, AgentTurnCreateRequest, AgentTurnResumeRequest, Document, @@ -32,9 +31,9 @@ from llama_stack.apis.agents.openai_responses import OpenAIResponseText from llama_stack.apis.common.responses import PaginatedResponse from llama_stack.apis.inference import ( Inference, - ToolConfig, OpenAIMessageParam, OpenAIToolMessageParam, + ToolConfig, ) from llama_stack.apis.safety import Safety from llama_stack.apis.tools import ToolGroups, ToolRuntime @@ -156,7 +155,7 @@ class MetaReferenceAgentsImpl(Agents): agent_id: str, session_id: str, messages: list[OpenAIMessageParam], - toolgroups: list[AgentToolGroup] | None = None, + tools: list[OpenAIResponseInputTool] | None = None, documents: list[Document] | None = None, stream: bool | None = False, tool_config: ToolConfig | None = None, @@ -166,7 +165,7 @@ class MetaReferenceAgentsImpl(Agents): session_id=session_id, messages=messages, stream=True, - toolgroups=toolgroups, + tools=tools, documents=documents, tool_config=tool_config, ) diff --git a/tests/integration/agents/test_agents.py b/tests/integration/agents/test_agents.py index 51cc0d764..6935ad1d8 100644 --- a/tests/integration/agents/test_agents.py +++ b/tests/integration/agents/test_agents.py @@ -12,12 +12,8 @@ import requests from llama_stack_client import Agent, AgentEventLogger, Document from llama_stack_client.types.shared_params.agent_config import AgentConfig, ToolConfig -from llama_stack.apis.agents.agents import ( - AgentConfig as Server__AgentConfig, -) -from llama_stack.apis.agents.agents import ( - ToolChoice, -) +from llama_stack.apis.agents.agents import AgentConfig as Server__AgentConfig +from llama_stack.apis.inference import ToolChoice def get_boiling_point(liquid_name: str, celcius: bool = True) -> int: @@ -187,7 +183,7 @@ def test_tool_config(agent_config): temperature=1.0, top_p=0.9, max_output_tokens=512, - toolgroups=[], + tools=[], enable_session_persistence=False, ) agent_config = AgentConfig( diff --git a/tests/unit/providers/agent/test_meta_reference_agent.py b/tests/unit/providers/agent/test_meta_reference_agent.py index b11c52b84..d505658cf 100644 --- a/tests/unit/providers/agent/test_meta_reference_agent.py +++ b/tests/unit/providers/agent/test_meta_reference_agent.py @@ -74,7 +74,13 @@ def sample_agent_config(): max_output_tokens=0, input_shields=["string"], output_shields=["string"], - toolgroups=["mcp::my_mcp_server"], + tools=[ + { + "type": "mcp", + "server_label": "my_mcp_server", + "server_url": "http://example.com/mcp", + } + ], client_tools=[ { "type": "function",