mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
fix: nullable param type for function call (#2086)
Nullable param type is not supported, e.g. ['string', 'null'], since it
fails type validation.
Tests:
Run inference with
messages:
- content: You are a helpful assistant that can use tools to get
information.
role: system
- content: What's the temperature in San Francisco in celsius?
role: user
tools:
- function:
description: Get current temperature for a given location.
name: get_weather
parameters:
additionalProperties: false
properties:
location:
description: "City and country e.g. Bogot\xE1, Colombia"
type: string
unit:
description: "Unit of temperature, default to celsius"
type: [string, "null"] # <= nullable type
required:
- location
type: object
type: function
Co-authored-by: Eric Huang <erichuang@fb.com>
This commit is contained in:
parent
88a796ca5a
commit
ffe3d0b2cd
1 changed files with 1 additions and 1 deletions
|
|
@ -873,7 +873,7 @@ def _convert_openai_request_tools(tools: Optional[List[Dict[str, Any]]] = None)
|
||||||
tool_param_properties = tool_params.get("properties", {})
|
tool_param_properties = tool_params.get("properties", {})
|
||||||
for tool_param_key, tool_param_value in tool_param_properties.items():
|
for tool_param_key, tool_param_value in tool_param_properties.items():
|
||||||
tool_param_def = ToolParamDefinition(
|
tool_param_def = ToolParamDefinition(
|
||||||
param_type=tool_param_value.get("type", None),
|
param_type=str(tool_param_value.get("type", None)),
|
||||||
description=tool_param_value.get("description", None),
|
description=tool_param_value.get("description", None),
|
||||||
)
|
)
|
||||||
lls_tool_params[tool_param_key] = tool_param_def
|
lls_tool_params[tool_param_key] = tool_param_def
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue