ValueError: tool_choice and tool_config.tool_choice must match
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start with the tool_choice validation in llama_stack/distribution/routers/routers.py, then trace how AgentConfig and tool_config values reach chat_completion. Reproduce the AgentConfig example with tool_choice set to required and verify that matching values no longer raise the reported ValueError.
Written by the indexing model from the issue text.
Description
Not able to set tool_choice to "required"
Below is my code...
self.agent_config = AgentConfig(
model=MODEL_NAME,
instructions=WEB_SEARCH_INSTRUNCTION_PROMPT,
sampling_params={
"strategy": {
"type": "greedy",
},
},
toolgroups=["builtin::websearch"],
tool_choice="required", # This is throwing error when changed to required from auto.
input_shields=[],
output_shields=[],
enable_session_persistence=False,
)
Error Logs ....
Traceback (most recent call last):
2025-03-01 15:56:53 File "/usr/local/lib/python3.10/site-packages/llama_stack/distribution/server/server.py", line 208, in sse_generator
2025-03-01 15:56:53 async for item in event_gen:
2025-03-01 15:56:53 File "/usr/local/lib/python3.10/site-packages/llama_stack/providers/inline/agents/meta_reference/agents.py", line 169, in _create_agent_turn_streaming
2025-03-01 15:56:53 async for event in agent.create_and_execute_turn(request):
2025-03-01 15:56:53 File "/usr/local/lib/python3.10/site-packages/llama_stack/providers/inline/agents/meta_reference/agent_instance.py", line 189, in create_and_execute_turn
2025-03-01 15:56:53 async for chunk in self.run(
2025-03-01 15:56:53 File "/usr/local/lib/python3.10/site-packages/llama_stack/providers/inline/agents/meta_reference/agent_instance.py", line 258, in run
2025-03-01 15:56:53 async for res in self._run(
2025-03-01 15:56:53 File "/usr/local/lib/python3.10/site-packages/llama_stack/providers/inline/agents/meta_reference/agent_instance.py", line 493, in _run
2025-03-01 15:56:53 async for chunk in await self.inference_api.chat_completion(
2025-03-01 15:56:53 File "/usr/local/lib/python3.10/site-packages/llama_stack/providers/utils/telemetry/trace_protocol.py", line 89, in async_wrapper
2025-03-01 15:56:53 result = await method(self, *args, **kwargs)
2025-03-01 15:56:53 File "/usr/local/lib/python3.10/site-packages/llama_stack/distribution/routers/routers.py", line 144, in chat_completion
2025-03-01 15:56:53 raise ValueError("tool_choice and tool_config.tool_choice must match")
2025-03-01 15:56:53 ValueError: tool_choice and tool_config.tool_choice must match
- Dominant language
- Python
- Stars
- 198
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ogx-ai/ogx-client-python
-
Difficulty 1/5 Under an hour Newbie friendliness 15/100
ogx-ai/ogx-client-python#348 · 1 comment ·
-
Mad APIOpen
Difficulty 5/5 Over a week Newbie friendliness 10/100
ogx-ai/ogx-client-python#347 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
ogx-ai/ogx-client-python#307 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
ogx-ai/ogx-client-python#287 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
ogx-ai/ogx-client-python#279 · 1 comment ·
All issues in ogx-ai/ogx-client-python
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 91/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 92/100
-
enhancement P2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Toloka/tolokaforge#1776 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
TencentCloud/Octop#1622 ·
Maintainers usually reply within 1 day
-
arch area:fleet priority:p3 severity:low track:hosted-product
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day