mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-30 01:52:18 +00:00
Fix hosted vllm custom tool schema fallback
Some checks are pending
Unit Tests: Caching (Redis) / caching-redis (push) Waiting to run
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Waiting to run
Unit Tests: Proxy DB Operations / auth-checks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / budgets (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / custom-logging (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / db-and-spend (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / key-generation (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / logging-misc (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-runtime (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-server-core (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / schema-migration (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-utils (push) Blocked by required conditions
Unit Tests: Security / security (push) Waiting to run
Some checks are pending
Unit Tests: Caching (Redis) / caching-redis (push) Waiting to run
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Waiting to run
Unit Tests: Proxy DB Operations / auth-checks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / budgets (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / custom-logging (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / db-and-spend (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / key-generation (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / logging-misc (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-runtime (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-server-core (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / schema-migration (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-utils (push) Blocked by required conditions
Unit Tests: Security / security (push) Waiting to run
This commit is contained in:
parent
8b0f9fe9a2
commit
062ec4240a
2 changed files with 31 additions and 1 deletions
|
|
@ -57,7 +57,7 @@ class HostedVLLMChatConfig(OpenAIGPTConfig):
|
|||
custom_tool.get("name") or tool.get("name") or f"custom_tool_{idx}"
|
||||
)
|
||||
tool_description = custom_tool.get("description") or tool.get("description")
|
||||
tool_parameters = custom_tool.get("input_schema")
|
||||
tool_parameters = custom_tool.get("input_schema") or tool.get("input_schema")
|
||||
|
||||
if not isinstance(tool_parameters, dict):
|
||||
tool_parameters = {
|
||||
|
|
|
|||
|
|
@ -289,3 +289,33 @@ def test_hosted_vllm_custom_tools_are_converted_to_function_tools():
|
|||
assert tools[0]["function"]["description"] == "Apply text patch"
|
||||
assert tools[0]["function"]["parameters"]["type"] == "object"
|
||||
assert "input" in tools[0]["function"]["parameters"]["properties"]
|
||||
|
||||
|
||||
def test_hosted_vllm_custom_tools_use_top_level_input_schema():
|
||||
config = HostedVLLMChatConfig()
|
||||
input_schema = {
|
||||
"type": "object",
|
||||
"properties": {"query": {"type": "string"}},
|
||||
"required": ["query"],
|
||||
}
|
||||
optional_params = config.map_openai_params(
|
||||
non_default_params={
|
||||
"tools": [
|
||||
{
|
||||
"type": "custom",
|
||||
"name": "search",
|
||||
"description": "Search docs",
|
||||
"input_schema": input_schema,
|
||||
}
|
||||
]
|
||||
},
|
||||
optional_params={},
|
||||
model="hosted_vllm/gpt-oss-120b",
|
||||
drop_params=False,
|
||||
)
|
||||
|
||||
tools = optional_params["tools"]
|
||||
assert len(tools) == 1
|
||||
assert tools[0]["function"]["name"] == "search"
|
||||
assert tools[0]["function"]["description"] == "Search docs"
|
||||
assert tools[0]["function"]["parameters"] == input_schema
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue