diff --git a/docs/static/llama-stack-spec.html b/docs/static/llama-stack-spec.html index 00d46e469..f8f5702f0 100644 --- a/docs/static/llama-stack-spec.html +++ b/docs/static/llama-stack-spec.html @@ -2394,11 +2394,11 @@ "get": { "responses": { "200": { - "description": "A Tool.", + "description": "A ToolDef.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Tool" + "$ref": "#/components/schemas/ToolDef" } } } @@ -4447,11 +4447,11 @@ "get": { "responses": { "200": { - "description": "A ListToolsResponse.", + "description": "A ListToolDefsResponse.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ListToolsResponse" + "$ref": "#/components/schemas/ListToolDefsResponse" } } } @@ -7375,6 +7375,10 @@ "ToolDef": { "type": "object", "properties": { + "toolgroup_id": { + "type": "string", + "description": "(Optional) ID of the tool group this tool belongs to" + }, "name": { "type": "string", "description": "Name of the tool" @@ -8071,79 +8075,6 @@ ] }, "arguments": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "boolean" - }, - { - "type": "null" - }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "boolean" - }, - { - "type": "null" - } - ] - } - }, - { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "boolean" - }, - { - "type": "null" - } - ] - } - } - ] - } - } - ] - }, - "arguments_json": { "type": "string" } }, @@ -13032,133 +12963,6 @@ "title": "QuerySpanTreeResponse", "description": "Response containing a tree structure of spans." }, - "Tool": { - "type": "object", - "properties": { - "identifier": { - "type": "string" - }, - "provider_resource_id": { - "type": "string" - }, - "provider_id": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "model", - "shield", - "vector_db", - "dataset", - "scoring_function", - "benchmark", - "tool", - "tool_group", - "prompt" - ], - "const": "tool", - "default": "tool", - "description": "Type of resource, always 'tool'" - }, - "toolgroup_id": { - "type": "string", - "description": "ID of the tool group this tool belongs to" - }, - "description": { - "type": "string", - "description": "Human-readable description of what the tool does" - }, - "input_schema": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "JSON Schema for the tool's input parameters" - }, - "output_schema": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "JSON Schema for the tool's output" - }, - "metadata": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - }, - "description": "(Optional) Additional metadata about the tool" - } - }, - "additionalProperties": false, - "required": [ - "identifier", - "provider_id", - "type", - "toolgroup_id", - "description" - ], - "title": "Tool", - "description": "A tool that can be invoked by agents." - }, "ToolGroup": { "type": "object", "properties": { @@ -14437,24 +14241,6 @@ "title": "ListToolGroupsResponse", "description": "Response containing a list of tool groups." }, - "ListToolsResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Tool" - }, - "description": "List of tools" - } - }, - "additionalProperties": false, - "required": [ - "data" - ], - "title": "ListToolsResponse", - "description": "Response containing a list of tools." - }, "ListVectorDBsResponse": { "type": "object", "properties": { diff --git a/docs/static/llama-stack-spec.yaml b/docs/static/llama-stack-spec.yaml index 8a5cd8891..004fde350 100644 --- a/docs/static/llama-stack-spec.yaml +++ b/docs/static/llama-stack-spec.yaml @@ -1674,11 +1674,11 @@ paths: get: responses: '200': - description: A Tool. + description: A ToolDef. content: application/json: schema: - $ref: '#/components/schemas/Tool' + $ref: '#/components/schemas/ToolDef' '400': $ref: '#/components/responses/BadRequest400' '429': @@ -3154,11 +3154,11 @@ paths: get: responses: '200': - description: A ListToolsResponse. + description: A ListToolDefsResponse. content: application/json: schema: - $ref: '#/components/schemas/ListToolsResponse' + $ref: '#/components/schemas/ListToolDefsResponse' '400': $ref: '#/components/responses/BadRequest400' '429': @@ -5315,6 +5315,10 @@ components: ToolDef: type: object properties: + toolgroup_id: + type: string + description: >- + (Optional) ID of the tool group this tool belongs to name: type: string description: Name of the tool @@ -5842,33 +5846,6 @@ components: title: BuiltinTool - type: string arguments: - oneOf: - - type: string - - type: object - additionalProperties: - oneOf: - - type: string - - type: integer - - type: number - - type: boolean - - type: 'null' - - type: array - items: - oneOf: - - type: string - - type: integer - - type: number - - type: boolean - - type: 'null' - - type: object - additionalProperties: - oneOf: - - type: string - - type: integer - - type: number - - type: boolean - - type: 'null' - arguments_json: type: string additionalProperties: false required: @@ -9582,82 +9559,6 @@ components: title: QuerySpanTreeResponse description: >- Response containing a tree structure of spans. - Tool: - type: object - properties: - identifier: - type: string - provider_resource_id: - type: string - provider_id: - type: string - type: - type: string - enum: - - model - - shield - - vector_db - - dataset - - scoring_function - - benchmark - - tool - - tool_group - - prompt - const: tool - default: tool - description: Type of resource, always 'tool' - toolgroup_id: - type: string - description: >- - ID of the tool group this tool belongs to - description: - type: string - description: >- - Human-readable description of what the tool does - input_schema: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - description: >- - JSON Schema for the tool's input parameters - output_schema: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - description: JSON Schema for the tool's output - metadata: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - description: >- - (Optional) Additional metadata about the tool - additionalProperties: false - required: - - identifier - - provider_id - - type - - toolgroup_id - - description - title: Tool - description: A tool that can be invoked by agents. ToolGroup: type: object properties: @@ -10645,19 +10546,6 @@ components: title: ListToolGroupsResponse description: >- Response containing a list of tool groups. - ListToolsResponse: - type: object - properties: - data: - type: array - items: - $ref: '#/components/schemas/Tool' - description: List of tools - additionalProperties: false - required: - - data - title: ListToolsResponse - description: Response containing a list of tools. ListVectorDBsResponse: type: object properties: diff --git a/llama_stack/apis/tools/tools.py b/llama_stack/apis/tools/tools.py index 33bd95e51..7a2027ade 100644 --- a/llama_stack/apis/tools/tools.py +++ b/llama_stack/apis/tools/tools.py @@ -19,48 +19,6 @@ from llama_stack.schema_utils import json_schema_type, webmethod from .rag_tool import RAGToolRuntime -@json_schema_type -class ToolParameter(BaseModel): - """Parameter definition for a tool. - - :param name: Name of the parameter - :param parameter_type: Type of the parameter (e.g., string, integer) - :param description: Human-readable description of what the parameter does - :param required: Whether this parameter is required for tool invocation - :param items: Type of the elements when parameter_type is array - :param title: (Optional) Title of the parameter - :param default: (Optional) Default value for the parameter if not provided - """ - - name: str - parameter_type: str - description: str - required: bool = Field(default=True) - items: dict | None = None - title: str | None = None - default: Any | None = None - - -@json_schema_type -class Tool(Resource): - """A tool that can be invoked by agents. - - :param type: Type of resource, always 'tool' - :param toolgroup_id: ID of the tool group this tool belongs to - :param description: Human-readable description of what the tool does - :param input_schema: JSON Schema for the tool's input parameters - :param output_schema: JSON Schema for the tool's output - :param metadata: (Optional) Additional metadata about the tool - """ - - type: Literal[ResourceType.tool] = ResourceType.tool - toolgroup_id: str - description: str - input_schema: dict[str, Any] | None = None - output_schema: dict[str, Any] | None = None - metadata: dict[str, Any] | None = None - - @json_schema_type class ToolDef(BaseModel): """Tool definition used in runtime contexts. @@ -70,8 +28,10 @@ class ToolDef(BaseModel): :param input_schema: (Optional) JSON Schema for tool inputs (MCP inputSchema) :param output_schema: (Optional) JSON Schema for tool outputs (MCP outputSchema) :param metadata: (Optional) Additional metadata about the tool + :param toolgroup_id: (Optional) ID of the tool group this tool belongs to """ + toolgroup_id: str | None = None name: str description: str | None = None input_schema: dict[str, Any] | None = None @@ -126,7 +86,7 @@ class ToolInvocationResult(BaseModel): class ToolStore(Protocol): - async def get_tool(self, tool_name: str) -> Tool: ... + async def get_tool(self, tool_name: str) -> ToolDef: ... async def get_tool_group(self, toolgroup_id: str) -> ToolGroup: ... @@ -139,15 +99,6 @@ class ListToolGroupsResponse(BaseModel): data: list[ToolGroup] -class ListToolsResponse(BaseModel): - """Response containing a list of tools. - - :param data: List of tools - """ - - data: list[Tool] - - class ListToolDefsResponse(BaseModel): """Response containing a list of tool definitions. @@ -198,11 +149,11 @@ class ToolGroups(Protocol): ... @webmethod(route="/tools", method="GET", level=LLAMA_STACK_API_V1) - async def list_tools(self, toolgroup_id: str | None = None) -> ListToolsResponse: + async def list_tools(self, toolgroup_id: str | None = None) -> ListToolDefsResponse: """List tools with optional tool group. :param toolgroup_id: The ID of the tool group to list tools for. - :returns: A ListToolsResponse. + :returns: A ListToolDefsResponse. """ ... @@ -210,11 +161,11 @@ class ToolGroups(Protocol): async def get_tool( self, tool_name: str, - ) -> Tool: + ) -> ToolDef: """Get a tool by its name. :param tool_name: The name of the tool to get. - :returns: A Tool. + :returns: A ToolDef. """ ... diff --git a/llama_stack/core/datatypes.py b/llama_stack/core/datatypes.py index 6a297f012..930cf2646 100644 --- a/llama_stack/core/datatypes.py +++ b/llama_stack/core/datatypes.py @@ -22,7 +22,7 @@ from llama_stack.apis.safety import Safety from llama_stack.apis.scoring import Scoring from llama_stack.apis.scoring_functions import ScoringFn, ScoringFnInput from llama_stack.apis.shields import Shield, ShieldInput -from llama_stack.apis.tools import Tool, ToolGroup, ToolGroupInput, ToolRuntime +from llama_stack.apis.tools import ToolGroup, ToolGroupInput, ToolRuntime from llama_stack.apis.vector_dbs import VectorDB, VectorDBInput from llama_stack.apis.vector_io import VectorIO from llama_stack.core.access_control.datatypes import AccessRule @@ -84,15 +84,11 @@ class BenchmarkWithOwner(Benchmark, ResourceWithOwner): pass -class ToolWithOwner(Tool, ResourceWithOwner): - pass - - class ToolGroupWithOwner(ToolGroup, ResourceWithOwner): pass -RoutableObject = Model | Shield | VectorDB | Dataset | ScoringFn | Benchmark | Tool | ToolGroup +RoutableObject = Model | Shield | VectorDB | Dataset | ScoringFn | Benchmark | ToolGroup RoutableObjectWithProvider = Annotated[ ModelWithOwner @@ -101,7 +97,6 @@ RoutableObjectWithProvider = Annotated[ | DatasetWithOwner | ScoringFnWithOwner | BenchmarkWithOwner - | ToolWithOwner | ToolGroupWithOwner, Field(discriminator="type"), ] diff --git a/llama_stack/core/routers/tool_runtime.py b/llama_stack/core/routers/tool_runtime.py index fd606f33b..ad82293e5 100644 --- a/llama_stack/core/routers/tool_runtime.py +++ b/llama_stack/core/routers/tool_runtime.py @@ -11,7 +11,7 @@ from llama_stack.apis.common.content_types import ( InterleavedContent, ) from llama_stack.apis.tools import ( - ListToolsResponse, + ListToolDefsResponse, RAGDocument, RAGQueryConfig, RAGQueryResult, @@ -86,6 +86,6 @@ class ToolRuntimeRouter(ToolRuntime): async def list_runtime_tools( self, tool_group_id: str | None = None, mcp_endpoint: URL | None = None - ) -> ListToolsResponse: + ) -> ListToolDefsResponse: logger.debug(f"ToolRuntimeRouter.list_runtime_tools: {tool_group_id}") return await self.routing_table.list_tools(tool_group_id) diff --git a/llama_stack/core/routing_tables/toolgroups.py b/llama_stack/core/routing_tables/toolgroups.py index d38009fd4..2d47bbb17 100644 --- a/llama_stack/core/routing_tables/toolgroups.py +++ b/llama_stack/core/routing_tables/toolgroups.py @@ -8,7 +8,7 @@ from typing import Any from llama_stack.apis.common.content_types import URL from llama_stack.apis.common.errors import ToolGroupNotFoundError -from llama_stack.apis.tools import ListToolGroupsResponse, ListToolsResponse, Tool, ToolGroup, ToolGroups +from llama_stack.apis.tools import ListToolDefsResponse, ListToolGroupsResponse, ToolDef, ToolGroup, ToolGroups from llama_stack.core.datatypes import AuthenticationRequiredError, ToolGroupWithOwner from llama_stack.log import get_logger @@ -27,7 +27,7 @@ def parse_toolgroup_from_toolgroup_name_pair(toolgroup_name_with_maybe_tool_name class ToolGroupsRoutingTable(CommonRoutingTableImpl, ToolGroups): - toolgroups_to_tools: dict[str, list[Tool]] = {} + toolgroups_to_tools: dict[str, list[ToolDef]] = {} tool_to_toolgroup: dict[str, str] = {} # overridden @@ -43,7 +43,7 @@ class ToolGroupsRoutingTable(CommonRoutingTableImpl, ToolGroups): routing_key = self.tool_to_toolgroup[routing_key] return await super().get_provider_impl(routing_key, provider_id) - async def list_tools(self, toolgroup_id: str | None = None) -> ListToolsResponse: + async def list_tools(self, toolgroup_id: str | None = None) -> ListToolDefsResponse: if toolgroup_id: if group_id := parse_toolgroup_from_toolgroup_name_pair(toolgroup_id): toolgroup_id = group_id @@ -68,31 +68,19 @@ class ToolGroupsRoutingTable(CommonRoutingTableImpl, ToolGroups): continue all_tools.extend(self.toolgroups_to_tools[toolgroup.identifier]) - return ListToolsResponse(data=all_tools) + return ListToolDefsResponse(data=all_tools) async def _index_tools(self, toolgroup: ToolGroup): provider_impl = await super().get_provider_impl(toolgroup.identifier, toolgroup.provider_id) tooldefs_response = await provider_impl.list_runtime_tools(toolgroup.identifier, toolgroup.mcp_endpoint) - # TODO: kill this Tool vs ToolDef distinction tooldefs = tooldefs_response.data - tools = [] for t in tooldefs: - tools.append( - Tool( - identifier=t.name, - toolgroup_id=toolgroup.identifier, - description=t.description or "", - input_schema=t.input_schema, - output_schema=t.output_schema, - metadata=t.metadata, - provider_id=toolgroup.provider_id, - ) - ) + t.toolgroup_id = toolgroup.identifier - self.toolgroups_to_tools[toolgroup.identifier] = tools - for tool in tools: - self.tool_to_toolgroup[tool.identifier] = toolgroup.identifier + self.toolgroups_to_tools[toolgroup.identifier] = tooldefs + for tool in tooldefs: + self.tool_to_toolgroup[tool.name] = toolgroup.identifier async def list_tool_groups(self) -> ListToolGroupsResponse: return ListToolGroupsResponse(data=await self.get_all_with_type("tool_group")) @@ -103,12 +91,12 @@ class ToolGroupsRoutingTable(CommonRoutingTableImpl, ToolGroups): raise ToolGroupNotFoundError(toolgroup_id) return tool_group - async def get_tool(self, tool_name: str) -> Tool: + async def get_tool(self, tool_name: str) -> ToolDef: if tool_name in self.tool_to_toolgroup: toolgroup_id = self.tool_to_toolgroup[tool_name] tools = self.toolgroups_to_tools[toolgroup_id] for tool in tools: - if tool.identifier == tool_name: + if tool.name == tool_name: return tool raise ValueError(f"Tool '{tool_name}' not found") @@ -133,7 +121,6 @@ class ToolGroupsRoutingTable(CommonRoutingTableImpl, ToolGroups): # baked in some of the code and tests right now. if not toolgroup.mcp_endpoint: await self._index_tools(toolgroup) - return toolgroup async def unregister_toolgroup(self, toolgroup_id: str) -> None: await self.unregister_object(await self.get_tool_group(toolgroup_id)) diff --git a/llama_stack/core/store/registry.py b/llama_stack/core/store/registry.py index 5f4abe9aa..624dbd176 100644 --- a/llama_stack/core/store/registry.py +++ b/llama_stack/core/store/registry.py @@ -36,7 +36,7 @@ class DistributionRegistry(Protocol): REGISTER_PREFIX = "distributions:registry" -KEY_VERSION = "v9" +KEY_VERSION = "v10" KEY_FORMAT = f"{REGISTER_PREFIX}:{KEY_VERSION}::" + "{type}:{identifier}" diff --git a/llama_stack/core/ui/page/playground/tools.py b/llama_stack/core/ui/page/playground/tools.py index 602c9eea1..4ee9d2204 100644 --- a/llama_stack/core/ui/page/playground/tools.py +++ b/llama_stack/core/ui/page/playground/tools.py @@ -81,7 +81,7 @@ def tool_chat_page(): for toolgroup_id in toolgroup_selection: tools = client.tools.list(toolgroup_id=toolgroup_id) - grouped_tools[toolgroup_id] = [tool.identifier for tool in tools] + grouped_tools[toolgroup_id] = [tool.name for tool in tools] total_tools += len(tools) st.markdown(f"Active Tools: 🛠 {total_tools}") diff --git a/llama_stack/models/llama/datatypes.py b/llama_stack/models/llama/datatypes.py index 52fcbbb7c..7cb7aa7bd 100644 --- a/llama_stack/models/llama/datatypes.py +++ b/llama_stack/models/llama/datatypes.py @@ -37,14 +37,7 @@ RecursiveType = Primitive | list[Primitive] | dict[str, Primitive] class ToolCall(BaseModel): call_id: str tool_name: BuiltinTool | str - # Plan is to deprecate the Dict in favor of a JSON string - # that is parsed on the client side instead of trying to manage - # the recursive type here. - # Making this a union so that client side can start prepping for this change. - # Eventually, we will remove both the Dict and arguments_json field, - # and arguments will just be a str - arguments: str | dict[str, RecursiveType] - arguments_json: str | None = None + arguments: str @field_validator("tool_name", mode="before") @classmethod diff --git a/llama_stack/models/llama/llama3/chat_format.py b/llama_stack/models/llama/llama3/chat_format.py index 1f88a1699..d65865cb5 100644 --- a/llama_stack/models/llama/llama3/chat_format.py +++ b/llama_stack/models/llama/llama3/chat_format.py @@ -232,8 +232,7 @@ class ChatFormat: ToolCall( call_id=call_id, tool_name=tool_name, - arguments=tool_arguments, - arguments_json=json.dumps(tool_arguments), + arguments=json.dumps(tool_arguments), ) ) content = "" diff --git a/llama_stack/models/llama/llama4/chat_format.py b/llama_stack/models/llama/llama4/chat_format.py index 96ebd0881..3864f6438 100644 --- a/llama_stack/models/llama/llama4/chat_format.py +++ b/llama_stack/models/llama/llama4/chat_format.py @@ -298,8 +298,7 @@ class ChatFormat: ToolCall( call_id=call_id, tool_name=tool_name, - arguments=tool_arguments, - arguments_json=json.dumps(tool_arguments), + arguments=json.dumps(tool_arguments), ) ) content = "" 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 7837a5476..318290f07 100644 --- a/llama_stack/providers/inline/agents/meta_reference/agent_instance.py +++ b/llama_stack/providers/inline/agents/meta_reference/agent_instance.py @@ -804,61 +804,34 @@ class ChatAgent(ShieldRunnerMixin): [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.identifier == input_tool_name for tool in tools.data): + 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.identifier for tool in tools.data])}" + f"Tool {input_tool_name} not found in toolgroup {toolgroup_name}. Available tools: {', '.join([tool.name for tool in tools.data])}" ) for tool_def in tools.data: if toolgroup_name.startswith("builtin") and toolgroup_name != RAG_TOOL_GROUP: - identifier: str | BuiltinTool | None = tool_def.identifier + 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.identifier): - identifier = tool_def.identifier + if input_tool_name in (None, tool_def.name): + identifier = tool_def.name else: identifier = None if tool_name_to_def.get(identifier, None): raise ValueError(f"Tool {identifier} already exists") if identifier: - # Build JSON Schema from tool parameters - properties = {} - required = [] - - for param in tool_def.parameters: - param_schema = { - "type": param.parameter_type, - "description": param.description, - } - if param.default is not None: - param_schema["default"] = param.default - if param.items is not None: - param_schema["items"] = param.items - if param.title is not None: - param_schema["title"] = param.title - - properties[param.name] = param_schema - - if param.required: - required.append(param.name) - - input_schema = { - "type": "object", - "properties": properties, - "required": required, - } - - tool_name_to_def[tool_def.identifier] = ToolDefinition( + tool_name_to_def[identifier] = ToolDefinition( tool_name=identifier, description=tool_def.description, - input_schema=input_schema, + input_schema=tool_def.input_schema, ) - tool_name_to_args[tool_def.identifier] = toolgroup_to_args.get(toolgroup_name, {}) + tool_name_to_args[identifier] = toolgroup_to_args.get(toolgroup_name, {}) self.tool_defs, self.tool_name_to_args = ( list(tool_name_to_def.values()), diff --git a/llama_stack/providers/inline/tool_runtime/rag/memory.py b/llama_stack/providers/inline/tool_runtime/rag/memory.py index bc68f198d..c8499a9b8 100644 --- a/llama_stack/providers/inline/tool_runtime/rag/memory.py +++ b/llama_stack/providers/inline/tool_runtime/rag/memory.py @@ -33,7 +33,6 @@ from llama_stack.apis.tools import ( ToolDef, ToolGroup, ToolInvocationResult, - ToolParameter, ToolRuntime, ) from llama_stack.apis.vector_io import ( @@ -301,13 +300,16 @@ class MemoryToolRuntimeImpl(ToolGroupsProtocolPrivate, ToolRuntime, RAGToolRunti ToolDef( name="knowledge_search", description="Search for information in a database.", - parameters=[ - ToolParameter( - name="query", - description="The query to search for. Can be a natural language sentence or keywords.", - parameter_type="string", - ), - ], + input_schema={ + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "The query to search for. Can be a natural language sentence or keywords.", + } + }, + "required": ["query"], + }, ), ] ) diff --git a/llama_stack/providers/remote/inference/vllm/vllm.py b/llama_stack/providers/remote/inference/vllm/vllm.py index 90ec37a34..89727552e 100644 --- a/llama_stack/providers/remote/inference/vllm/vllm.py +++ b/llama_stack/providers/remote/inference/vllm/vllm.py @@ -99,8 +99,7 @@ def _convert_to_vllm_tool_calls_in_response( ToolCall( call_id=call.id, tool_name=call.function.name, - arguments=json.loads(call.function.arguments), - arguments_json=call.function.arguments, + arguments=call.function.arguments, ) for call in tool_calls ] @@ -160,7 +159,6 @@ def _process_vllm_chat_completion_end_of_stream( for _index, tool_call_buf in sorted(tool_call_bufs.items()): args_str = tool_call_buf.arguments or "{}" try: - args = json.loads(args_str) chunks.append( ChatCompletionResponseStreamChunk( event=ChatCompletionResponseEvent( @@ -169,8 +167,7 @@ def _process_vllm_chat_completion_end_of_stream( tool_call=ToolCall( call_id=tool_call_buf.call_id, tool_name=tool_call_buf.tool_name, - arguments=args, - arguments_json=args_str, + arguments=args_str, ), parse_status=ToolCallParseStatus.succeeded, ), diff --git a/llama_stack/providers/remote/tool_runtime/bing_search/bing_search.py b/llama_stack/providers/remote/tool_runtime/bing_search/bing_search.py index e40903969..9a98964b7 100644 --- a/llama_stack/providers/remote/tool_runtime/bing_search/bing_search.py +++ b/llama_stack/providers/remote/tool_runtime/bing_search/bing_search.py @@ -15,7 +15,6 @@ from llama_stack.apis.tools import ( ToolDef, ToolGroup, ToolInvocationResult, - ToolParameter, ToolRuntime, ) from llama_stack.core.request_headers import NeedsRequestProviderData @@ -57,13 +56,16 @@ class BingSearchToolRuntimeImpl(ToolGroupsProtocolPrivate, ToolRuntime, NeedsReq ToolDef( name="web_search", description="Search the web using Bing Search API", - parameters=[ - ToolParameter( - name="query", - description="The query to search for", - parameter_type="string", - ) - ], + input_schema={ + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "The query to search for", + } + }, + "required": ["query"], + }, ) ] ) diff --git a/llama_stack/providers/remote/tool_runtime/brave_search/brave_search.py b/llama_stack/providers/remote/tool_runtime/brave_search/brave_search.py index ba3b910d5..02e5b5c69 100644 --- a/llama_stack/providers/remote/tool_runtime/brave_search/brave_search.py +++ b/llama_stack/providers/remote/tool_runtime/brave_search/brave_search.py @@ -14,7 +14,6 @@ from llama_stack.apis.tools import ( ToolDef, ToolGroup, ToolInvocationResult, - ToolParameter, ToolRuntime, ) from llama_stack.core.request_headers import NeedsRequestProviderData @@ -56,13 +55,16 @@ class BraveSearchToolRuntimeImpl(ToolGroupsProtocolPrivate, ToolRuntime, NeedsRe ToolDef( name="web_search", description="Search the web for information", - parameters=[ - ToolParameter( - name="query", - description="The query to search for", - parameter_type="string", - ) - ], + input_schema={ + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "The query to search for", + } + }, + "required": ["query"], + }, built_in_type=BuiltinTool.brave_search, ) ] diff --git a/llama_stack/providers/remote/tool_runtime/tavily_search/tavily_search.py b/llama_stack/providers/remote/tool_runtime/tavily_search/tavily_search.py index 976ec9c57..ca629fced 100644 --- a/llama_stack/providers/remote/tool_runtime/tavily_search/tavily_search.py +++ b/llama_stack/providers/remote/tool_runtime/tavily_search/tavily_search.py @@ -15,7 +15,6 @@ from llama_stack.apis.tools import ( ToolDef, ToolGroup, ToolInvocationResult, - ToolParameter, ToolRuntime, ) from llama_stack.core.request_headers import NeedsRequestProviderData @@ -56,13 +55,16 @@ class TavilySearchToolRuntimeImpl(ToolGroupsProtocolPrivate, ToolRuntime, NeedsR ToolDef( name="web_search", description="Search the web for information", - parameters=[ - ToolParameter( - name="query", - description="The query to search for", - parameter_type="string", - ) - ], + input_schema={ + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "The query to search for", + } + }, + "required": ["query"], + }, ) ] ) diff --git a/llama_stack/providers/remote/tool_runtime/wolfram_alpha/wolfram_alpha.py b/llama_stack/providers/remote/tool_runtime/wolfram_alpha/wolfram_alpha.py index f12a44958..410e34195 100644 --- a/llama_stack/providers/remote/tool_runtime/wolfram_alpha/wolfram_alpha.py +++ b/llama_stack/providers/remote/tool_runtime/wolfram_alpha/wolfram_alpha.py @@ -15,7 +15,6 @@ from llama_stack.apis.tools import ( ToolDef, ToolGroup, ToolInvocationResult, - ToolParameter, ToolRuntime, ) from llama_stack.core.request_headers import NeedsRequestProviderData @@ -57,13 +56,16 @@ class WolframAlphaToolRuntimeImpl(ToolGroupsProtocolPrivate, ToolRuntime, NeedsR ToolDef( name="wolfram_alpha", description="Query WolframAlpha for computational knowledge", - parameters=[ - ToolParameter( - name="query", - description="The query to compute", - parameter_type="string", - ) - ], + input_schema={ + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "The query to compute", + } + }, + "required": ["query"], + }, ) ] ) diff --git a/llama_stack/providers/utils/inference/openai_compat.py b/llama_stack/providers/utils/inference/openai_compat.py index 29060a88f..9ce04fb9c 100644 --- a/llama_stack/providers/utils/inference/openai_compat.py +++ b/llama_stack/providers/utils/inference/openai_compat.py @@ -538,18 +538,13 @@ async def convert_message_to_openai_dict(message: Message, download: bool = Fals if isinstance(tool_name, BuiltinTool): tool_name = tool_name.value - # arguments_json can be None, so attempt it first and fall back to arguments - if hasattr(tc, "arguments_json") and tc.arguments_json: - arguments = tc.arguments_json - else: - arguments = json.dumps(tc.arguments) result["tool_calls"].append( { "id": tc.call_id, "type": "function", "function": { "name": tool_name, - "arguments": arguments, + "arguments": tc.arguments, }, } ) @@ -685,8 +680,7 @@ def convert_tool_call( valid_tool_call = ToolCall( call_id=tool_call.id, tool_name=tool_call.function.name, - arguments=json.loads(tool_call.function.arguments), - arguments_json=tool_call.function.arguments, + arguments=tool_call.function.arguments, ) except Exception: return UnparseableToolCall( @@ -897,8 +891,7 @@ def _convert_openai_tool_calls( ToolCall( call_id=call.id, tool_name=call.function.name, - arguments=json.loads(call.function.arguments), - arguments_json=call.function.arguments, + arguments=call.function.arguments, ) for call in tool_calls ] @@ -1184,8 +1177,7 @@ async def convert_openai_chat_completion_stream( tool_call = ToolCall( call_id=buffer["call_id"], tool_name=buffer["name"], - arguments=arguments, - arguments_json=buffer["arguments"], + arguments=buffer["arguments"], ) yield ChatCompletionResponseStreamChunk( event=ChatCompletionResponseEvent( @@ -1418,7 +1410,7 @@ class OpenAIChatCompletionToLlamaStackMixin: openai_tool_call = OpenAIChoiceDeltaToolCall( index=0, function=OpenAIChoiceDeltaToolCallFunction( - arguments=tool_call.arguments_json, + arguments=tool_call.arguments, ), ) delta = OpenAIChoiceDelta(tool_calls=[openai_tool_call]) diff --git a/tests/common/mcp.py b/tests/common/mcp.py index f65f7c952..357ea4d41 100644 --- a/tests/common/mcp.py +++ b/tests/common/mcp.py @@ -222,16 +222,16 @@ def make_mcp_server(required_auth_token: str | None = None, tools: dict[str, Cal def run_server(): try: - logger.info(f"Starting MCP server on port {port}") + logger.debug(f"Starting MCP server on port {port}") server_instance.run() - logger.info(f"MCP server on port {port} has stopped") + logger.debug(f"MCP server on port {port} has stopped") except Exception as e: logger.error(f"MCP server failed to start on port {port}: {e}") raise # Start the server in a new thread server_thread = threading.Thread(target=run_server, daemon=True) - logger.info(f"Starting MCP server thread on port {port}") + logger.debug(f"Starting MCP server thread on port {port}") server_thread.start() # Polling until the server is ready @@ -239,13 +239,13 @@ def make_mcp_server(required_auth_token: str | None = None, tools: dict[str, Cal start_time = time.time() server_url = f"http://localhost:{port}/sse" - logger.info(f"Waiting for MCP server to be ready at {server_url}") + logger.debug(f"Waiting for MCP server to be ready at {server_url}") while time.time() - start_time < timeout: try: response = httpx.get(server_url) if response.status_code in [200, 401]: - logger.info(f"MCP server is ready on port {port} (status: {response.status_code})") + logger.debug(f"MCP server is ready on port {port} (status: {response.status_code})") break except httpx.RequestError as e: logger.debug(f"Server not ready yet, retrying... ({e})") @@ -261,14 +261,14 @@ def make_mcp_server(required_auth_token: str | None = None, tools: dict[str, Cal try: yield {"server_url": server_url} finally: - logger.info(f"Shutting down MCP server on port {port}") + logger.debug(f"Shutting down MCP server on port {port}") server_instance.should_exit = True time.sleep(0.5) # Force shutdown if still running if server_thread.is_alive(): try: - logger.info("Force shutting down server thread") + logger.debug("Force shutting down server thread") if hasattr(server_instance, "servers") and server_instance.servers: for srv in server_instance.servers: srv.close() diff --git a/tests/integration/inference/test_tools_with_schemas.py b/tests/integration/inference/test_tools_with_schemas.py index 2170e7fe4..b144a5196 100644 --- a/tests/integration/inference/test_tools_with_schemas.py +++ b/tests/integration/inference/test_tools_with_schemas.py @@ -213,7 +213,7 @@ class TestMCPToolsInChatCompletion: "function": { "name": tool.name, "description": tool.description, - "parameters": tool.input_schema if hasattr(tool, "input_schema") else {}, + "parameters": tool.input_schema or {}, }, } ) diff --git a/tests/integration/recordings/responses/0fad19b9d308.json b/tests/integration/recordings/responses/0fad19b9d308.json new file mode 100644 index 000000000..2e92cc179 --- /dev/null +++ b/tests/integration/recordings/responses/0fad19b9d308.json @@ -0,0 +1,103 @@ +{ + "request": { + "method": "POST", + "url": "http://0.0.0.0:11434/v1/v1/chat/completions", + "headers": {}, + "body": { + "model": "llama3.2:3b-instruct-fp16", + "messages": [ + { + "role": "user", + "content": "What time is it in UTC?" + } + ], + "stream": true, + "tools": [ + { + "type": "function", + "function": { + "name": "get_time", + "description": "Get current time", + "parameters": { + "type": "object", + "properties": { + "timezone": { + "type": "string" + } + } + } + } + } + ] + }, + "endpoint": "/v1/chat/completions", + "model": "llama3.2:3b-instruct-fp16" + }, + "response": { + "body": [ + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "chatcmpl-187", + "choices": [ + { + "delta": { + "content": "", + "function_call": null, + "refusal": null, + "role": "assistant", + "tool_calls": [ + { + "index": 0, + "id": "call_nng2lhyy", + "function": { + "arguments": "{\"timezone\":\"UTC\"}", + "name": "get_time" + }, + "type": "function" + } + ] + }, + "finish_reason": null, + "index": 0, + "logprobs": null + } + ], + "created": 1759351462, + "model": "llama3.2:3b-instruct-fp16", + "object": "chat.completion.chunk", + "service_tier": null, + "system_fingerprint": "fp_ollama", + "usage": null + } + }, + { + "__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk", + "__data__": { + "id": "chatcmpl-187", + "choices": [ + { + "delta": { + "content": "", + "function_call": null, + "refusal": null, + "role": "assistant", + "tool_calls": null + }, + "finish_reason": "tool_calls", + "index": 0, + "logprobs": null + } + ], + "created": 1759351462, + "model": "llama3.2:3b-instruct-fp16", + "object": "chat.completion.chunk", + "service_tier": null, + "system_fingerprint": "fp_ollama", + "usage": null + } + } + ], + "is_streaming": true + } +} diff --git a/tests/integration/recordings/responses/8deded211f21.json b/tests/integration/recordings/responses/8deded211f21.json new file mode 100644 index 000000000..c567108fa --- /dev/null +++ b/tests/integration/recordings/responses/8deded211f21.json @@ -0,0 +1,743 @@ +{ + "request": { + "method": "POST", + "url": "http://localhost:11434/api/generate", + "headers": {}, + "body": { + "model": "llama3.2:3b-instruct-fp16", + "raw": true, + "prompt": "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nYou are a helpful assistant. You have access to functions, but you should only use them if they are required.\nYou are an expert in composing functions. You are given a question and a set of possible functions.\nBased on the question, you may or may not need to make one function/tool call to achieve the purpose.\n\nIf you decide to invoke any of the function(s), you MUST put it in the format of [func_name1(params_name1=params_value1, params_name2=params_value2...), func_name2(params)]\nIf you decide to invoke a function, you SHOULD NOT include any other text in the response. besides the function call in the above format.\nFor a boolean parameter, be sure to use `True` or `False` (capitalized) for the value.\n\n\nHere is a list of functions in JSON format that you can invoke.\n\n[\n {\n \"name\": \"book_flight\",\n \"description\": \"\n Book a flight with passenger and payment information.\n\n This tool uses JSON Schema $ref and $defs for type reuse.\n \",\n \"parameters\": {\n \"type\": \"dict\",\n \"required\": [\"flight\", \"passengers\", \"payment\"],\n \"properties\": {\n \"flight\": {\n \"type\": \"object\",\n \"description\": \"\"\n },\n \"passengers\": {\n \"type\": \"array\",\n \"description\": \"\"\n },\n \"payment\": {\n \"type\": \"object\",\n \"description\": \"\"\n }\n }\n }\n },\n {\n \"name\": \"process_order\",\n \"description\": \"\n Process an order with nested address information.\n\n Uses nested objects and $ref.\n \",\n \"parameters\": {\n \"type\": \"dict\",\n \"required\": [\"order_data\"],\n \"properties\": {\n \"order_data\": {\n \"type\": \"object\",\n \"description\": \"\"\n }\n }\n }\n },\n {\n \"name\": \"flexible_contact\",\n \"description\": \"\n Accept flexible contact (email or phone).\n\n Uses anyOf schema.\n \",\n \"parameters\": {\n \"type\": \"dict\",\n \"required\": [\"contact_info\"],\n \"properties\": {\n \"contact_info\": {\n \"type\": \"string\",\n \"description\": \"\"\n }\n }\n }\n }\n]\n\nYou can answer general questions or invoke tools when necessary.\nIn addition to tool calls, you should also augment your responses by using the tool outputs.\nYou are a helpful assistant that can process orders and book flights.<|eot_id|><|start_header_id|>user<|end_header_id|>\n\nProcess an order with 2 widgets going to 123 Main St, San Francisco<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n", + "options": { + "temperature": 0.0 + }, + "stream": true + }, + "endpoint": "/api/generate", + "model": "llama3.2:3b-instruct-fp16" + }, + "response": { + "body": [ + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:15.998653Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "[", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.042936Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "process", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.086689Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "_order", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.128398Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "(order", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.172808Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "_data", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.215123Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "={\"", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.259326Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "order", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.303332Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "_id", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.345453Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "\":", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.388745Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": " ", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.432258Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "1", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.474552Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": ",", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.51763Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": " \"", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.561623Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "customer", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.605498Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "_name", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.649228Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "\":", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.691311Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": " \"", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.735229Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "John", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.77891Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": " Doe", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.822779Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "\",", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.864798Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": " \"", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.908719Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "address", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.952037Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "\":", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:16.997344Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": " {\"", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.040154Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "street", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.084207Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "\":", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.125633Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": " \"", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.169076Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "123", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.211634Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": " Main", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.254149Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": " St", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.298417Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "\",", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.339693Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": " \"", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.382919Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "city", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.42623Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "\":", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.468642Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": " \"", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.512136Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "San", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.553518Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": " Francisco", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.597107Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": "\"}}", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.640858Z", + "done": false, + "done_reason": null, + "total_duration": null, + "load_duration": null, + "prompt_eval_count": null, + "prompt_eval_duration": null, + "eval_count": null, + "eval_duration": null, + "response": ")]", + "thinking": null, + "context": null + } + }, + { + "__type__": "ollama._types.GenerateResponse", + "__data__": { + "model": "llama3.2:3b-instruct-fp16", + "created_at": "2025-10-01T22:46:17.685634Z", + "done": true, + "done_reason": "stop", + "total_duration": 7493315500, + "load_duration": 4640587750, + "prompt_eval_count": 556, + "prompt_eval_duration": 1163238292, + "eval_count": 40, + "eval_duration": 1687901500, + "response": "", + "thinking": null, + "context": null + } + } + ], + "is_streaming": true + } +} diff --git a/tests/integration/recordings/responses/931ac7158789.json b/tests/integration/recordings/responses/931ac7158789.json new file mode 100644 index 000000000..dc5f985da --- /dev/null +++ b/tests/integration/recordings/responses/931ac7158789.json @@ -0,0 +1,86 @@ +{ + "request": { + "method": "POST", + "url": "http://0.0.0.0:11434/v1/v1/chat/completions", + "headers": {}, + "body": { + "model": "llama3.2:3b-instruct-fp16", + "messages": [ + { + "role": "user", + "content": "What's the weather in San Francisco?" + } + ], + "tools": [ + { + "type": "function", + "function": { + "name": "get_weather", + "description": "Get weather for a location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "City name" + } + }, + "required": [ + "location" + ] + } + } + } + ] + }, + "endpoint": "/v1/chat/completions", + "model": "llama3.2:3b-instruct-fp16" + }, + "response": { + "body": { + "__type__": "openai.types.chat.chat_completion.ChatCompletion", + "__data__": { + "id": "chatcmpl-190", + "choices": [ + { + "finish_reason": "tool_calls", + "index": 0, + "logprobs": null, + "message": { + "content": "", + "refusal": null, + "role": "assistant", + "annotations": null, + "audio": null, + "function_call": null, + "tool_calls": [ + { + "id": "call_st2uc9zo", + "function": { + "arguments": "{\"location\":\"San Francisco\"}", + "name": "get_weather" + }, + "type": "function", + "index": 0 + } + ] + } + } + ], + "created": 1759351458, + "model": "llama3.2:3b-instruct-fp16", + "object": "chat.completion", + "service_tier": null, + "system_fingerprint": "fp_ollama", + "usage": { + "completion_tokens": 18, + "prompt_tokens": 161, + "total_tokens": 179, + "completion_tokens_details": null, + "prompt_tokens_details": null + } + } + }, + "is_streaming": false + } +} diff --git a/tests/integration/recordings/responses/c4991de37dfb.json b/tests/integration/recordings/responses/c4991de37dfb.json new file mode 100644 index 000000000..f77a51997 --- /dev/null +++ b/tests/integration/recordings/responses/c4991de37dfb.json @@ -0,0 +1,78 @@ +{ + "request": { + "method": "POST", + "url": "http://0.0.0.0:11434/v1/v1/chat/completions", + "headers": {}, + "body": { + "model": "llama3.2:3b-instruct-fp16", + "messages": [ + { + "role": "user", + "content": "Call the no args tool" + } + ], + "tools": [ + { + "type": "function", + "function": { + "name": "no_args_tool", + "description": "Tool with no arguments", + "parameters": { + "type": "object", + "properties": {} + } + } + } + ] + }, + "endpoint": "/v1/chat/completions", + "model": "llama3.2:3b-instruct-fp16" + }, + "response": { + "body": { + "__type__": "openai.types.chat.chat_completion.ChatCompletion", + "__data__": { + "id": "chatcmpl-695", + "choices": [ + { + "finish_reason": "tool_calls", + "index": 0, + "logprobs": null, + "message": { + "content": "", + "refusal": null, + "role": "assistant", + "annotations": null, + "audio": null, + "function_call": null, + "tool_calls": [ + { + "id": "call_bfwjy2i9", + "function": { + "arguments": "{}", + "name": "no_args_tool" + }, + "type": "function", + "index": 0 + } + ] + } + } + ], + "created": 1759351462, + "model": "llama3.2:3b-instruct-fp16", + "object": "chat.completion", + "service_tier": null, + "system_fingerprint": "fp_ollama", + "usage": { + "completion_tokens": 14, + "prompt_tokens": 148, + "total_tokens": 162, + "completion_tokens_details": null, + "prompt_tokens_details": null + } + } + }, + "is_streaming": false + } +} diff --git a/tests/integration/recordings/responses/cca0267555a6.json b/tests/integration/recordings/responses/cca0267555a6.json new file mode 100644 index 000000000..9ba103900 --- /dev/null +++ b/tests/integration/recordings/responses/cca0267555a6.json @@ -0,0 +1,97 @@ +{ + "request": { + "method": "POST", + "url": "http://0.0.0.0:11434/v1/v1/chat/completions", + "headers": {}, + "body": { + "model": "llama3.2:3b-instruct-fp16", + "messages": [ + { + "role": "user", + "content": "Calculate 5 + 3" + } + ], + "tools": [ + { + "type": "function", + "function": { + "name": "calculate", + "description": "", + "parameters": { + "properties": { + "x": { + "title": "X", + "type": "number" + }, + "y": { + "title": "Y", + "type": "number" + }, + "operation": { + "title": "Operation", + "type": "string" + } + }, + "required": [ + "x", + "y", + "operation" + ], + "title": "calculateArguments", + "type": "object" + } + } + } + ] + }, + "endpoint": "/v1/chat/completions", + "model": "llama3.2:3b-instruct-fp16" + }, + "response": { + "body": { + "__type__": "openai.types.chat.chat_completion.ChatCompletion", + "__data__": { + "id": "chatcmpl-985", + "choices": [ + { + "finish_reason": "tool_calls", + "index": 0, + "logprobs": null, + "message": { + "content": "", + "refusal": null, + "role": "assistant", + "annotations": null, + "audio": null, + "function_call": null, + "tool_calls": [ + { + "id": "call_338dhuqf", + "function": { + "arguments": "{\"operation\":\"+\",\"x\":\"5\",\"y\":\"3\"}", + "name": "calculate" + }, + "type": "function", + "index": 0 + } + ] + } + } + ], + "created": 1759357337, + "model": "llama3.2:3b-instruct-fp16", + "object": "chat.completion", + "service_tier": null, + "system_fingerprint": "fp_ollama", + "usage": { + "completion_tokens": 27, + "prompt_tokens": 172, + "total_tokens": 199, + "completion_tokens_details": null, + "prompt_tokens_details": null + } + } + }, + "is_streaming": false + } +} diff --git a/tests/integration/recordings/responses/d0ac68cbde69.json b/tests/integration/recordings/responses/d0ac68cbde69.json index 4b3bcaa1d..b37962fb6 100644 --- a/tests/integration/recordings/responses/d0ac68cbde69.json +++ b/tests/integration/recordings/responses/d0ac68cbde69.json @@ -11,62 +11,7 @@ "body": { "__type__": "ollama._types.ProcessResponse", "__data__": { - "models": [ - { - "model": "llama3.2:3b", - "name": "llama3.2:3b", - "digest": "a80c4f17acd55265feec403c7aef86be0c25983ab279d83f3bcd3abbcb5b8b72", - "expires_at": "2025-10-01T14:42:00.149364-07:00", - "size": 3367856128, - "size_vram": 3367856128, - "details": { - "parent_model": "", - "format": "gguf", - "family": "llama", - "families": [ - "llama" - ], - "parameter_size": "3.2B", - "quantization_level": "Q4_K_M" - } - }, - { - "model": "llama3.2:3b-instruct-fp16", - "name": "llama3.2:3b-instruct-fp16", - "digest": "195a8c01d91ec3cb1e0aad4624a51f2602c51fa7d96110f8ab5a20c84081804d", - "expires_at": "2025-10-01T13:49:34.349274-07:00", - "size": 7919570944, - "size_vram": 7919570944, - "details": { - "parent_model": "", - "format": "gguf", - "family": "llama", - "families": [ - "llama" - ], - "parameter_size": "3.2B", - "quantization_level": "F16" - } - }, - { - "model": "all-minilm:l6-v2", - "name": "all-minilm:l6-v2", - "digest": "1b226e2802dbb772b5fc32a58f103ca1804ef7501331012de126ab22f67475ef", - "expires_at": "2025-10-01T13:49:25.407653-07:00", - "size": 585846784, - "size_vram": 585846784, - "details": { - "parent_model": "", - "format": "gguf", - "family": "bert", - "families": [ - "bert" - ], - "parameter_size": "23M", - "quantization_level": "F16" - } - } - ] + "models": [] } }, "is_streaming": false diff --git a/tests/integration/recordings/responses/d9e8f66e1d85.json b/tests/integration/recordings/responses/d9e8f66e1d85.json new file mode 100644 index 000000000..77dcd74ea --- /dev/null +++ b/tests/integration/recordings/responses/d9e8f66e1d85.json @@ -0,0 +1,117 @@ +{ + "request": { + "method": "POST", + "url": "http://0.0.0.0:11434/v1/v1/chat/completions", + "headers": {}, + "body": { + "model": "llama3.2:3b-instruct-fp16", + "messages": [ + { + "role": "user", + "content": "Book a flight from SFO to JFK for John Doe" + } + ], + "tools": [ + { + "type": "function", + "function": { + "name": "book_flight", + "description": "Book a flight", + "parameters": { + "type": "object", + "properties": { + "flight": { + "$ref": "#/$defs/FlightInfo" + }, + "passenger": { + "$ref": "#/$defs/Passenger" + } + }, + "required": [ + "flight", + "passenger" + ], + "$defs": { + "FlightInfo": { + "type": "object", + "properties": { + "from": { + "type": "string" + }, + "to": { + "type": "string" + }, + "date": { + "type": "string", + "format": "date" + } + } + }, + "Passenger": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer" + } + } + } + } + } + } + } + ] + }, + "endpoint": "/v1/chat/completions", + "model": "llama3.2:3b-instruct-fp16" + }, + "response": { + "body": { + "__type__": "openai.types.chat.chat_completion.ChatCompletion", + "__data__": { + "id": "chatcmpl-559", + "choices": [ + { + "finish_reason": "tool_calls", + "index": 0, + "logprobs": null, + "message": { + "content": "", + "refusal": null, + "role": "assistant", + "annotations": null, + "audio": null, + "function_call": null, + "tool_calls": [ + { + "id": "call_p9nnpr9l", + "function": { + "arguments": "{\"flight\":\"{'from':'SFO','to':'JFK'}\",\"passenger\":{\"age\":\"30\",\"name\":\"John Doe\"}}", + "name": "book_flight" + }, + "type": "function", + "index": 0 + } + ] + } + } + ], + "created": 1759351460, + "model": "llama3.2:3b-instruct-fp16", + "object": "chat.completion", + "service_tier": null, + "system_fingerprint": "fp_ollama", + "usage": { + "completion_tokens": 38, + "prompt_tokens": 227, + "total_tokens": 265, + "completion_tokens_details": null, + "prompt_tokens_details": null + } + } + }, + "is_streaming": false + } +} diff --git a/tests/integration/recordings/responses/e0c71820f395.json b/tests/integration/recordings/responses/e0c71820f395.json new file mode 100644 index 000000000..881b7e4fd --- /dev/null +++ b/tests/integration/recordings/responses/e0c71820f395.json @@ -0,0 +1,122 @@ +{ + "request": { + "method": "POST", + "url": "http://0.0.0.0:11434/v1/v1/chat/completions", + "headers": {}, + "body": { + "model": "llama3.2:3b-instruct-fp16", + "messages": [ + { + "role": "user", + "content": "Use one of the available tools" + } + ], + "tools": [ + { + "type": "function", + "function": { + "name": "simple", + "parameters": { + "type": "object", + "properties": { + "x": { + "type": "string" + } + } + } + } + }, + { + "type": "function", + "function": { + "name": "complex", + "parameters": { + "type": "object", + "properties": { + "data": { + "$ref": "#/$defs/Complex" + } + }, + "$defs": { + "Complex": { + "type": "object", + "properties": { + "nested": { + "type": "array", + "items": { + "type": "number" + } + } + } + } + } + } + } + }, + { + "type": "function", + "function": { + "name": "with_output", + "parameters": { + "type": "object", + "properties": { + "input": { + "type": "string" + } + } + } + } + } + ] + }, + "endpoint": "/v1/chat/completions", + "model": "llama3.2:3b-instruct-fp16" + }, + "response": { + "body": { + "__type__": "openai.types.chat.chat_completion.ChatCompletion", + "__data__": { + "id": "chatcmpl-927", + "choices": [ + { + "finish_reason": "tool_calls", + "index": 0, + "logprobs": null, + "message": { + "content": "", + "refusal": null, + "role": "assistant", + "annotations": null, + "audio": null, + "function_call": null, + "tool_calls": [ + { + "id": "call_umobdfav", + "function": { + "arguments": "{\"data\":\"[[1, 2], [3, 4]]\"}", + "name": "complex" + }, + "type": "function", + "index": 0 + } + ] + } + } + ], + "created": 1759351464, + "model": "llama3.2:3b-instruct-fp16", + "object": "chat.completion", + "service_tier": null, + "system_fingerprint": "fp_ollama", + "usage": { + "completion_tokens": 27, + "prompt_tokens": 246, + "total_tokens": 273, + "completion_tokens_details": null, + "prompt_tokens_details": null + } + } + }, + "is_streaming": false + } +} diff --git a/tests/integration/recordings/responses/f22b7da7ad75.json b/tests/integration/recordings/responses/f22b7da7ad75.json new file mode 100644 index 000000000..ef1ee8414 --- /dev/null +++ b/tests/integration/recordings/responses/f22b7da7ad75.json @@ -0,0 +1,1204 @@ +{ + "request": { + "method": "POST", + "url": "http://0.0.0.0:11434/v1/v1/embeddings", + "headers": {}, + "body": { + "model": "all-minilm:l6-v2", + "input": [ + "First text for base64", + "Second text for base64", + "Third text for base64" + ], + "encoding_format": "base64" + }, + "endpoint": "/v1/embeddings", + "model": "all-minilm:l6-v2" + }, + "response": { + "body": { + "__type__": "openai.types.create_embedding_response.CreateEmbeddingResponse", + "__data__": { + "data": [ + { + "embedding": [ + 0.047443096, + 0.1030663, + -0.02994777, + -0.0019610971, + -0.0004458719, + 0.013241453, + -0.022299973, + 0.035796557, + 0.042697832, + -0.013352145, + 0.014903893, + 0.059454504, + -0.030757127, + -0.016443565, + 0.04413251, + -0.01962478, + -0.052001625, + 0.023652397, + 0.038157385, + -0.019067932, + 0.07790512, + 0.065477535, + 0.0063924147, + 0.01184581, + 0.008469548, + 0.055321243, + -0.08488264, + 0.1419959, + 0.07208884, + -0.052270085, + 0.04475413, + -0.043897122, + 0.19948907, + 0.0521248, + 0.039570127, + 0.047736328, + -0.0031801846, + -0.027514923, + 0.016915824, + 0.08785543, + 0.018578053, + -0.062505305, + 0.025584552, + 0.039979465, + 0.013755796, + -0.029615713, + 0.050677385, + 0.09286756, + 0.046862997, + -0.046437945, + 0.09620637, + -0.037828952, + -0.021523252, + 0.053332504, + 0.008366923, + 0.016525395, + -0.04379942, + 0.057431653, + -0.042829104, + 0.053737152, + -0.05284048, + -0.025113432, + 0.040097877, + -0.05878011, + 0.04986854, + -0.016612675, + 0.06288202, + -0.057936136, + 0.0014946498, + 0.011902256, + -0.02110201, + -0.045040447, + -0.028943324, + 0.112218715, + -0.04346062, + 0.02658561, + -0.08660781, + 0.0075222226, + 0.040901423, + -0.013788897, + -0.0034571695, + -0.105320804, + 0.13145688, + 0.1387978, + -0.024207905, + 0.00011780889, + 0.0027130456, + 0.08893496, + -0.0404282, + -0.013090902, + -0.042802725, + -0.019277347, + -0.0072423737, + -0.012584974, + -0.0758852, + 0.042088367, + -0.028754171, + -0.046412025, + -0.08769414, + 0.011706997, + 0.033290867, + -0.047082063, + 0.036054734, + 0.02562872, + -0.064266376, + -0.041589364, + 0.022733012, + 0.03523196, + -0.030952249, + -0.030285591, + -0.030893793, + -0.014268825, + -0.064496316, + -0.029686624, + -0.037651353, + -0.07263676, + -0.05136519, + 0.01860713, + 0.015172685, + 0.0192144, + -0.0116023095, + -0.012719093, + -0.029429333, + 0.032753803, + -0.10127056, + -0.08305989, + 0.07203204, + -1.6656048e-33, + -0.003488058, + 0.0655988, + -0.007163306, + 0.038025133, + -0.042687092, + -0.008737161, + -0.037520815, + 0.038469143, + -0.120509155, + 0.03023451, + -0.026864765, + -0.06805885, + 0.05592863, + -0.07489512, + -0.017807316, + -0.049285922, + -0.08905791, + 0.011731217, + 0.017883036, + 0.00015935759, + -0.030456739, + 0.024376402, + -0.027947344, + -0.049716905, + 0.014850297, + -0.0068702376, + -0.037318625, + -0.050714917, + 0.03216811, + -0.03513996, + -0.040848706, + 0.0031008294, + -0.06374552, + -0.07015488, + 0.040950127, + -0.031313762, + 0.06336745, + 0.015497221, + -0.08470297, + 0.034139305, + 0.047749784, + 0.063429475, + 0.08305951, + -0.031543955, + -0.02092045, + 0.024276698, + -0.050816093, + -0.00951583, + 0.11460215, + -0.011085907, + 0.0006970512, + 0.08304137, + -0.018151749, + 0.012668774, + 0.023483729, + -0.068380035, + 0.008017319, + 0.005103147, + -0.033619083, + -0.045522273, + -0.007610588, + -0.0031189255, + 0.02023118, + 0.048001137, + 0.018279912, + -0.06083473, + 0.0025614651, + -0.051604036, + -0.0712584, + 0.0049647917, + -0.056144852, + -0.03460778, + 0.084107466, + -0.051244184, + -0.07208066, + 0.082872786, + -0.042616084, + 0.032226164, + 0.038903847, + -0.043644667, + 0.03114516, + -0.037657745, + -0.0051392126, + -0.0399705, + -0.01362006, + 0.062149994, + 0.009436811, + -0.10927611, + 0.0054878076, + 0.035581235, + 0.06060475, + -0.051899396, + 0.013453982, + -0.02607209, + 0.03149, + 5.778151e-34, + 0.04866742, + -0.026154209, + 0.028786905, + -0.009705908, + 0.036763143, + 0.07683042, + 0.124761656, + 0.02430845, + -0.0055978484, + -0.011855667, + 0.08782188, + 0.03667143, + -0.01590326, + -0.005430289, + 0.026028333, + -0.047321074, + -0.0042727133, + 0.026540313, + 0.0465339, + -0.042490445, + -0.015054837, + -0.032038923, + -0.10492689, + 0.10122033, + 0.07957377, + 0.042453364, + 0.011124516, + 0.010934764, + 0.045186315, + -0.02283475, + -0.06222954, + 0.04523413, + 0.048799627, + 0.060591288, + -0.048021708, + -0.03465323, + -0.045096762, + 0.017476292, + 0.036111128, + 0.05623506, + 0.062889755, + -0.07529307, + -0.065171525, + 0.0069152173, + 0.05907177, + -0.0603988, + 0.045391977, + 0.03989815, + 0.017313296, + -0.010879031, + 0.014901746, + 0.05576297, + -0.064136796, + -0.05788592, + 0.049781807, + -0.04160058, + -0.116747804, + 0.037745718, + 0.0020103676, + -0.01814592, + 0.013506867, + 0.00341396, + 0.014206663, + -0.009217883, + -0.011821457, + -0.033057805, + -0.051591158, + 0.031610493, + -0.07041633, + 0.007702183, + -0.009296349, + -0.058487307, + -0.01271879, + 0.043650433, + 0.017939351, + -0.034527123, + 0.037774917, + 0.0450543, + -0.03789838, + 0.0016587796, + -0.017690128, + 0.046084408, + -0.10634635, + 0.058015924, + 0.09367202, + -0.03887253, + -0.030778354, + -0.04526167, + -0.042162772, + -0.019281171, + -0.094072275, + 0.08443694, + 0.04598175, + 0.11420337, + -0.016542073, + -1.3092824e-08, + 0.01029157, + -0.05607101, + -0.053273894, + 0.04327644, + -0.012097581, + 0.075499125, + 8.911722e-05, + -0.059431333, + -0.039473776, + -0.12459489, + -0.01031571, + 0.01610335, + 0.016960384, + -0.07947821, + 0.01820896, + 0.040425852, + 0.0060324515, + -0.13502608, + 0.016641272, + -0.020874891, + 0.021407917, + 0.030175129, + -0.045509353, + -0.10665387, + -0.071301624, + 0.027237656, + -0.0072193583, + 0.120991066, + -0.008656499, + 0.0011201953, + 0.0039784242, + 0.0341344, + -0.06401818, + -0.036852792, + 0.035282534, + -0.011923041, + 0.067173794, + 0.014300814, + 0.06770646, + -0.066512346, + 0.085266545, + -0.037755802, + -0.094363555, + -0.0124826655, + -0.014590712, + 0.026925279, + 0.04410473, + 0.015496688, + 0.004318949, + -0.031916477, + 0.017218966, + 0.016201599, + -0.033119682, + 0.06837974, + -0.02781091, + -0.01779888, + 0.057812553, + -0.016622763, + -0.0718051, + 0.07917062, + 0.027705258, + -0.0024773679, + 0.11784412, + -0.02393799 + ], + "index": 0, + "object": "embedding" + }, + { + "embedding": [ + 0.04654041, + 0.100457005, + -0.03960695, + 0.0054190895, + -0.00061261636, + 0.022978926, + -0.015349646, + 0.05174952, + 0.04080002, + -0.040600445, + 0.02253602, + 0.024573963, + -0.0061854525, + -0.024768595, + 0.097017914, + 0.0037721908, + -0.1071271, + 0.05670194, + 0.021320485, + -0.023483735, + 0.10240627, + 0.046724126, + 0.014405091, + 0.017862096, + 0.0076312926, + 0.084439315, + -0.08968022, + 0.16757359, + 0.046978492, + -0.029951245, + 0.07417616, + 0.00019549856, + 0.118695736, + 0.026067322, + 0.035530325, + 0.0063190986, + -0.016918957, + -0.011904382, + 0.02159433, + 0.04011584, + 0.020048723, + -0.053142868, + 0.022441626, + 0.016903853, + -0.023708675, + -0.02648895, + 0.019766012, + 0.062821016, + 0.04764414, + -0.052348837, + 0.07352589, + -0.06325153, + -0.0331663, + 0.04175679, + 0.0015468705, + 0.05215102, + -0.04930485, + 0.05475271, + -0.037362292, + 0.048984047, + 0.00668616, + 0.0077575357, + 0.033763032, + -0.045534473, + 0.04478127, + -0.041897986, + 0.058399495, + -0.053956937, + -0.066097215, + 0.006726588, + 0.0038363277, + -0.03608817, + 0.008571994, + 0.07390713, + 0.006064092, + 0.0057486463, + -0.08874643, + -0.0021642765, + 0.045340028, + -0.051646378, + 0.0056842417, + -0.10331014, + 0.120456606, + 0.12761793, + -0.024176907, + -0.05479328, + 0.0034843183, + 0.07641806, + -0.059855074, + -0.0195081, + -0.0150292525, + -0.00992928, + 0.045797862, + -0.015174619, + -0.07924758, + 0.023096986, + -0.040744357, + -0.0101818275, + -0.08914291, + 0.013643887, + 0.011581099, + -0.049888827, + -0.00021994562, + -0.02913472, + -0.029171223, + -0.04352264, + 0.0076333424, + 0.012210982, + 0.016095871, + -0.06401206, + 0.0016354738, + 0.028166138, + -0.07800048, + -0.013365193, + -0.0013295119, + -0.019354483, + -0.0043497235, + 0.025218496, + 0.033494957, + 0.007653746, + -0.033507217, + -0.03213291, + -0.022418406, + 0.0067284796, + -0.08024248, + -0.12522098, + 0.069272675, + -1.9683093e-33, + -0.012249598, + 0.070073105, + -0.016373688, + 0.03268669, + -0.0011716175, + 0.008970948, + -0.05875696, + 0.031790286, + -0.09962546, + -0.011529516, + -0.042214815, + -0.08385974, + 0.050325025, + -0.058266874, + -0.01614801, + -0.07460485, + -0.056625802, + 0.049216725, + 0.09685523, + 0.02972927, + -0.010797609, + 0.096737646, + -0.008734601, + -0.024298675, + 0.054711536, + 0.020422578, + -0.0040869303, + -0.041413024, + 0.039046016, + -0.027355552, + 0.022152912, + 0.015635848, + -0.040486902, + -0.046137046, + 0.067116976, + -0.050166503, + 0.05231306, + 0.03977189, + -0.08200705, + 0.04208007, + 0.06871361, + 0.0415384, + 0.08255112, + -0.019878006, + 0.009672142, + -0.0013818855, + -0.02187854, + -0.03571946, + 0.1019913, + -0.040465977, + 0.0029030787, + 0.071231104, + -0.018016066, + 0.022290476, + 0.053263694, + -0.05915711, + -0.024596125, + 0.042284742, + 0.0125378035, + -0.026088756, + -0.007868452, + 0.018145658, + 0.025348024, + 0.048246585, + 0.032595333, + -0.04322502, + -0.024803862, + -0.070749104, + -0.07416428, + 0.0484724, + -0.05546208, + -0.041756414, + 0.12654942, + -0.04357299, + -0.08900543, + 0.016302116, + -0.040754095, + 0.024944471, + 0.041844428, + -0.06273068, + 0.0006748941, + -0.05448637, + -0.013658018, + -0.03356399, + -0.0060005034, + 0.05786807, + -0.030056076, + -0.12787268, + -0.027650442, + 0.083788656, + 0.021819875, + -0.040701445, + -0.041838806, + -0.047018126, + 0.08002261, + 4.734239e-34, + 0.02015769, + -0.00014442818, + 0.0072734207, + -0.01035945, + 0.0436576, + 0.060642734, + 0.1473969, + -0.023643956, + -0.018900618, + -0.026930645, + 0.054844704, + 0.029314412, + 0.016708935, + -0.009290097, + -0.002891506, + -0.057237446, + -0.0032285063, + 0.05497127, + 0.048353076, + -0.067556486, + -0.02002941, + -0.013762125, + -0.060434237, + 0.075815536, + 0.092324585, + 0.021875912, + -0.028627641, + 0.02281807, + 0.04816562, + -0.029499082, + -0.07594795, + 0.028744346, + 0.045300674, + 0.061325517, + -0.017799513, + -0.06497018, + -0.043381255, + -0.012436013, + -0.017595029, + 0.038607694, + 0.03692832, + -0.06317727, + -0.03189631, + 0.0163061, + 0.066662505, + -0.01747777, + 0.0455436, + 0.032373946, + 0.019391501, + -0.029496003, + 0.026255092, + -0.003917891, + -0.12487856, + -0.012247588, + 0.015688721, + -0.044113353, + -0.11468337, + 0.040689792, + 0.031688645, + -0.027883623, + 0.03565975, + -0.029930554, + 0.0272684, + -0.0078877555, + 0.026264768, + -0.06124056, + -0.06071735, + 0.009353228, + -0.09204558, + 0.05202069, + -0.042713076, + -0.07342886, + 0.004044382, + 0.06092453, + -0.003994553, + -0.025158737, + 0.02733044, + 0.032295305, + -0.03984234, + 0.017935337, + -0.028768739, + 0.01554963, + -0.073981866, + 0.0739418, + 0.04965046, + -0.04301918, + -0.035159755, + 0.027055329, + -0.03693953, + -0.036715843, + -0.06353325, + 0.12646905, + -0.003499326, + 0.093309924, + 0.00889324, + -1.38464875e-08, + 0.0231563, + -0.075574, + -0.040843725, + 0.0071973656, + -0.032683276, + 0.025759073, + -0.039060622, + -0.070802435, + -0.026421575, + -0.12223953, + -0.01567019, + 0.008273527, + 0.021523712, + -0.077978514, + 0.008511451, + 0.038049843, + 0.013643623, + -0.12606904, + 0.024690265, + -0.049368616, + 0.022910642, + 0.012570536, + -0.038921557, + -0.0539728, + -0.11401533, + 0.0717154, + -0.02019053, + 0.09689256, + -0.03522339, + -0.01902355, + 0.052379142, + 0.015264651, + -0.059212603, + -0.029434869, + 0.040918592, + -0.050510794, + 0.07031127, + 0.010864601, + 0.08412114, + -0.034533564, + 0.10262946, + -0.060668074, + -0.121650845, + 0.033533875, + 0.064201616, + 0.021554638, + 0.059297472, + -0.009686148, + -0.0021906071, + -0.013715586, + 0.050112963, + -0.014887802, + -0.010682921, + 0.07304227, + -0.034087624, + -0.024696104, + 0.0442271, + -0.00089669036, + -0.08143203, + 0.06717475, + 0.03451422, + -0.0024682316, + 0.09635781, + -0.04145595 + ], + "index": 1, + "object": "embedding" + }, + { + "embedding": [ + 0.045375798, + 0.07258055, + -0.08003706, + -0.032656744, + 0.0139935585, + 0.017206425, + -0.0085616745, + 0.019218331, + 0.0527245, + -0.017329019, + 0.020587556, + 0.011539302, + -0.02006116, + -0.0116708, + 0.116046146, + -0.010887594, + -0.112962514, + 0.07470017, + -0.008835863, + -0.038513727, + 0.1079511, + 0.05575882, + 0.05465468, + 0.028420603, + 0.012869476, + 0.078700624, + -0.07481292, + 0.10657601, + 0.048312515, + -0.019187614, + 0.043496132, + -0.014120566, + 0.16143475, + -0.006972843, + 0.059548676, + -0.002742684, + -0.06421385, + -0.03753407, + -0.00034186858, + 0.103141606, + 0.021242032, + -0.035123263, + 0.039595246, + 0.03465166, + -0.007700848, + -0.016779039, + -0.017973451, + 0.03797483, + 0.06914695, + -0.06505097, + 0.0768558, + -0.063415445, + -0.047812812, + 0.081876844, + -0.03468853, + -0.010242799, + -0.04682619, + 0.05593955, + -0.037297264, + 0.048033547, + 0.0084374575, + 0.013531666, + 0.03961178, + -0.06994999, + 0.07862166, + -0.014270066, + 0.022243122, + -0.08205504, + -0.06690809, + 0.016866608, + -0.005296731, + -0.039822105, + -0.026300494, + 0.06192888, + 0.003208919, + 0.038568772, + -0.03837477, + -0.0075851064, + 0.019920006, + -0.056322522, + -0.0022795193, + -0.08178385, + 0.13542512, + 0.18784039, + -0.016274614, + -0.053139277, + -0.032727182, + 0.06850126, + -0.07511497, + 0.02570966, + -0.03359296, + -0.0060070264, + -0.0014385056, + -0.0030237471, + -0.07544867, + 0.05513981, + -0.015720192, + -0.05642966, + -0.08506004, + 0.02179422, + 0.038471166, + -0.0283351, + 0.015446086, + -0.023619834, + -0.029330725, + 0.010942997, + -0.0015495635, + 0.04477932, + -0.038915448, + -0.044640813, + -0.035229694, + -0.017752215, + -0.08401524, + -0.044855777, + -0.02621097, + -0.029825464, + -0.008823935, + -0.019113153, + 0.06113879, + 0.017369257, + -0.018114269, + -0.017956765, + -0.0055642324, + -0.0022192416, + -0.074853644, + -0.098001055, + 0.08262387, + -1.7699036e-33, + -0.03260984, + 0.088475876, + -0.02405542, + 0.043462854, + -0.008397535, + 0.020519359, + -0.049513564, + 0.018314049, + -0.11363644, + -0.0017021305, + -0.046051882, + -0.07227338, + 0.062427472, + -0.063298784, + -0.0043539773, + -0.07343966, + -0.08858381, + 0.04477799, + 0.04930878, + 0.034854405, + 0.007476164, + 0.046887144, + -0.03770322, + -0.025251219, + 0.0446619, + 0.03149236, + -0.0053032744, + -0.032395095, + 0.050810106, + -0.037147496, + 0.053301577, + 0.021033086, + -0.031951237, + -0.07252799, + 0.052170422, + -0.02576369, + 0.026887013, + 0.01079958, + -0.073781185, + 0.07478704, + 0.05142738, + 0.013788507, + 0.09066831, + -0.011272152, + 0.012055797, + 0.05094217, + 0.01781682, + -0.04303251, + 0.10018772, + -0.009778261, + 0.031500068, + 0.08470662, + 0.006889941, + 0.0029960799, + 0.052113816, + -0.07264866, + -0.028845811, + 0.05798962, + 0.026194785, + -0.053314455, + -0.013308107, + -0.005074615, + 0.039697673, + 0.05761601, + 0.018443743, + -0.024383908, + -0.04246694, + -0.057976462, + -0.045537386, + 0.038462877, + -0.06458701, + -0.021180486, + 0.10092568, + -0.0217069, + -0.09957015, + 0.023281459, + -0.06976486, + 0.03478707, + 0.021886345, + -0.07436989, + 0.0059652724, + -0.045952816, + 0.011156351, + -0.0023965703, + -0.020232527, + 0.051849972, + -0.016511427, + -0.14282945, + 0.0007839438, + 0.05143813, + 0.045633797, + -0.047449116, + -0.031150315, + -0.028784428, + 0.022110209, + 8.540206e-34, + 0.035680003, + -0.004454516, + 0.0019904706, + -0.03159778, + 0.039594337, + 0.055580996, + 0.11990417, + 0.007444201, + 0.0014800398, + -0.035671443, + 0.054802123, + 0.013518193, + 0.015369701, + -0.042170182, + 0.00910241, + -0.03393552, + -0.011560881, + 0.008206326, + 0.03244244, + -0.057579078, + 0.001215648, + -0.037337195, + -0.09628385, + 0.10470648, + 0.073387526, + 0.034718595, + -0.031235449, + -0.008077066, + 0.0532558, + -0.007544639, + -0.06481378, + 0.0078824125, + 0.059332505, + 0.07509864, + -0.023143422, + -0.053352714, + -0.0049984492, + 0.020093009, + 0.005558518, + 0.02055946, + 0.040190052, + -0.058405206, + -0.019410733, + 0.040003065, + 0.043201532, + 0.0153706325, + 0.038072105, + 0.044809878, + 0.03211562, + 0.02581734, + 0.016989984, + -0.031887848, + -0.072636016, + -0.008867823, + 0.043845262, + -0.032801606, + -0.10555597, + -0.008874612, + 0.037949465, + -0.008839974, + 0.0024741436, + -0.005779733, + 0.06775476, + -0.016673656, + 0.020682104, + -0.02387207, + -0.08558911, + 0.008887117, + -0.07502815, + 0.034403294, + -0.04082733, + -0.06821772, + -0.018959502, + 0.03903044, + 0.011770784, + -0.042644627, + 0.021807244, + 0.069912925, + -0.027863, + 0.021612082, + -0.017177302, + 0.013199131, + -0.06342314, + 0.11476938, + 0.055228394, + -0.057914026, + -0.018466951, + 0.029547459, + -0.025892112, + -0.061446555, + -0.051833864, + 0.12864126, + 0.013783986, + 0.10842094, + 0.025589032, + -1.3291747e-08, + 0.04438634, + -0.035043437, + -0.059084963, + 0.007846919, + -0.03533786, + 0.04078865, + -0.0045822817, + -0.044390634, + -0.017847955, + -0.11152658, + 0.019488214, + -0.04202167, + -0.010433255, + -0.09392986, + 0.031165348, + 0.0037942217, + 0.011776091, + -0.11188344, + 0.019489327, + -0.059643954, + 5.5016415e-05, + 0.023693599, + -0.03426268, + -0.067298956, + -0.05988965, + 0.09677909, + -0.026113264, + 0.11115747, + -0.032836337, + -0.002883786, + 0.048552252, + 0.027802175, + -0.06964344, + -0.024443185, + 0.01612565, + -0.020989701, + 0.062907666, + -0.00074260257, + 0.067105986, + -0.040433157, + 0.077970855, + -0.04189095, + -0.1258856, + 0.0058066114, + 0.03658347, + -0.015551063, + 0.021594083, + -0.008647476, + -0.026618915, + -0.04521969, + 0.02759545, + -0.02447648, + -0.016449116, + 0.1025887, + -0.016808366, + -0.04455479, + 0.023937078, + -0.017120138, + -0.07922125, + 0.062927626, + 0.038930148, + -0.018900929, + 0.09125473, + -0.017347038 + ], + "index": 2, + "object": "embedding" + } + ], + "model": "all-minilm:l6-v2", + "object": "list", + "usage": { + "prompt_tokens": 15, + "total_tokens": 15 + } + } + }, + "is_streaming": false + } +} diff --git a/tests/integration/tool_runtime/test_builtin_tools.py b/tests/integration/tool_runtime/test_builtin_tools.py index 1acf06719..97300a8dd 100644 --- a/tests/integration/tool_runtime/test_builtin_tools.py +++ b/tests/integration/tool_runtime/test_builtin_tools.py @@ -26,7 +26,7 @@ def test_web_search_tool(llama_stack_client, sample_search_query): pytest.skip("TAVILY_SEARCH_API_KEY not set, skipping test") tools = llama_stack_client.tool_runtime.list_tools() - assert any(tool.identifier == "web_search" for tool in tools) + assert any(tool.name == "web_search" for tool in tools) response = llama_stack_client.tool_runtime.invoke_tool( tool_name="web_search", kwargs={"query": sample_search_query} @@ -52,7 +52,7 @@ def test_wolfram_alpha_tool(llama_stack_client, sample_wolfram_alpha_query): pytest.skip("WOLFRAM_ALPHA_API_KEY not set, skipping test") tools = llama_stack_client.tool_runtime.list_tools() - assert any(tool.identifier == "wolfram_alpha" for tool in tools) + assert any(tool.name == "wolfram_alpha" for tool in tools) response = llama_stack_client.tool_runtime.invoke_tool( tool_name="wolfram_alpha", kwargs={"query": sample_wolfram_alpha_query} ) diff --git a/tests/integration/tool_runtime/test_mcp_json_schema.py b/tests/integration/tool_runtime/test_mcp_json_schema.py index 76dd313d9..b6c001872 100644 --- a/tests/integration/tool_runtime/test_mcp_json_schema.py +++ b/tests/integration/tool_runtime/test_mcp_json_schema.py @@ -362,6 +362,7 @@ class TestAgentWithMCPTools: model=text_model_id, instructions="You are a helpful assistant that can process orders and book flights.", tools=[test_toolgroup_id], + extra_headers=auth_headers, ) session_id = agent.create_session("test-session-complex") diff --git a/tests/unit/providers/inference/test_remote_vllm.py b/tests/unit/providers/inference/test_remote_vllm.py index 4dc2e0c16..4b5b93103 100644 --- a/tests/unit/providers/inference/test_remote_vllm.py +++ b/tests/unit/providers/inference/test_remote_vllm.py @@ -138,8 +138,7 @@ async def test_tool_call_response(vllm_inference_adapter): ToolCall( call_id="foo", tool_name="knowledge_search", - arguments={"query": "How many?"}, - arguments_json='{"query": "How many?"}', + arguments='{"query": "How many?"}', ) ], ), @@ -263,7 +262,7 @@ async def test_tool_call_delta_streaming_arguments_dict(): assert chunks[1].event.event_type.value == "progress" assert chunks[1].event.delta.type == "tool_call" assert chunks[1].event.delta.parse_status.value == "succeeded" - assert chunks[1].event.delta.tool_call.arguments_json == '{"number": 28, "power": 3}' + assert chunks[1].event.delta.tool_call.arguments == '{"number": 28, "power": 3}' assert chunks[2].event.event_type.value == "complete" @@ -339,11 +338,11 @@ async def test_multiple_tool_calls(): assert chunks[1].event.event_type.value == "progress" assert chunks[1].event.delta.type == "tool_call" assert chunks[1].event.delta.parse_status.value == "succeeded" - assert chunks[1].event.delta.tool_call.arguments_json == '{"number": 28, "power": 3}' + assert chunks[1].event.delta.tool_call.arguments == '{"number": 28, "power": 3}' assert chunks[2].event.event_type.value == "progress" assert chunks[2].event.delta.type == "tool_call" assert chunks[2].event.delta.parse_status.value == "succeeded" - assert chunks[2].event.delta.tool_call.arguments_json == '{"first_number": 4, "second_number": 7}' + assert chunks[2].event.delta.tool_call.arguments == '{"first_number": 4, "second_number": 7}' assert chunks[3].event.event_type.value == "complete" diff --git a/tests/unit/providers/utils/inference/test_openai_compat.py b/tests/unit/providers/utils/inference/test_openai_compat.py index ddc70e102..c200c4395 100644 --- a/tests/unit/providers/utils/inference/test_openai_compat.py +++ b/tests/unit/providers/utils/inference/test_openai_compat.py @@ -41,9 +41,7 @@ async def test_convert_message_to_openai_dict(): async def test_convert_message_to_openai_dict_with_tool_call(): message = CompletionMessage( content="", - tool_calls=[ - ToolCall(call_id="123", tool_name="test_tool", arguments_json='{"foo": "bar"}', arguments={"foo": "bar"}) - ], + tool_calls=[ToolCall(call_id="123", tool_name="test_tool", arguments='{"foo": "bar"}')], stop_reason=StopReason.end_of_turn, ) @@ -65,8 +63,7 @@ async def test_convert_message_to_openai_dict_with_builtin_tool_call(): ToolCall( call_id="123", tool_name=BuiltinTool.brave_search, - arguments_json='{"foo": "bar"}', - arguments={"foo": "bar"}, + arguments='{"foo": "bar"}', ) ], stop_reason=StopReason.end_of_turn, @@ -202,8 +199,7 @@ async def test_convert_message_to_openai_dict_new_completion_message_with_tool_c ToolCall( call_id="call_123", tool_name="get_weather", - arguments={"city": "Sligo"}, - arguments_json='{"city": "Sligo"}', + arguments='{"city": "Sligo"}', ) ], stop_reason=StopReason.end_of_turn,