File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/llama_stack_client/lib/agents Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,14 @@ def async_run_impl(self, **kwargs):
129129
130130T = TypeVar ("T" , bound = Callable )
131131
132+ # python typehint to litellm/openai parameter spec
133+ TYPEHINT_TO_LITELLM_TYPE = {
134+ "int" : "integer" ,
135+ "float" : "number" ,
136+ "bool" : "boolean" ,
137+ "str" : "string" ,
138+ }
139+
132140
133141def client_tool (func : T ) -> ClientTool :
134142 """
@@ -197,8 +205,7 @@ def get_params_definition(self) -> Dict[str, Parameter]:
197205 params [name ] = Parameter (
198206 name = name ,
199207 description = param_doc or f"Parameter { name } " ,
200- # Hack: litellm/openai expects "string" for str type
201- parameter_type = type_hint .__name__ if type_hint .__name__ != "str" else "string" ,
208+ parameter_type = TYPEHINT_TO_LITELLM_TYPE .get (type_hint .__name__ , type_hint .__name__ ),
202209 default = (param .default if param .default != inspect .Parameter .empty else None ),
203210 required = is_required ,
204211 )
You can’t perform that action at this time.
0 commit comments