fix: raise error when request param failed to convert #1339
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
This led to extremely hard to debug messages.
Before:
llama_stack/distribution/library_client.py:275: in request
response = await self._call_non_streaming(
llama_stack/distribution/library_client.py:322: in _call_non_streaming
result = await matched_func(**body)
llama_stack/providers/utils/telemetry/trace_protocol.py:102: in async_wrapper
result = await method(self, *args, **kwargs)
llama_stack/providers/inline/agents/meta_reference/agents.py:80: in create_agent
value=agent_config.model_dump_json(),
E AttributeError: 'dict' object has no attribute 'model_dump_json'
After:
E ValueError: Failed to convert parameter {'model': 'meta-llama/Llama-3.1-8B-Instruct', 'instructions': 'You are a helpful assistant', 'sampling_params': {'strategy': {'type': 'top_p', 'temperature': 0.0001, 'top_p': 0.9}}, 'toolgroups': [{'name': 'builtin::rag'}], 'input_shields': ['meta-llama/Llama-Guard-3-8B'], 'output_shields': ['meta-llama/Llama-Guard-3-8B'], 'enable_session_persistence': False} into <class 'llama_stack.apis.agents.agents.AgentConfig'>: 2 validation errors for AgentConfig
E toolgroups.0.str
E Input should be a valid string [type=string_type, input_value={'name': 'builtin::rag'}, input_type=dict]
E For further information visit https://errors.pydantic.dev/2.10/v/string_type
E toolgroups.0.AgentToolGroupWithArgs.args
E Field required [type=missing, input_value={'name': 'builtin::rag'}, input_type=dict]
E For further information visit https://errors.pydantic.dev/2.10/v/missing
Test Plan:
LLAMA_STACK_CONFIG=fireworks pytest -s -v tests/client-sdk/ --safety-shield meta-llama/Llama-Guard-3-8B