File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -819,7 +819,7 @@ def check_tool_usage(cls, data):
819
819
return data
820
820
821
821
# if "tool_choice" is specified -- validation
822
- if "tool_choice" in data :
822
+ if "tool_choice" in data and data [ "tool_choice" ] is not None :
823
823
824
824
# ensure that if "tool choice" is specified, tools are present
825
825
if "tools" not in data or data ["tools" ] is None :
@@ -831,7 +831,7 @@ def check_tool_usage(cls, data):
831
831
if data ["tool_choice" ] not in [
832
832
"auto" , "required"
833
833
] and not isinstance (data ["tool_choice" ], dict ):
834
- raise NotImplementedError (
834
+ raise ValueError (
835
835
f'Invalid value for `tool_choice`: { data ["tool_choice" ]} ! ' \
836
836
'Only named tools, "none", "auto" or "required" ' \
837
837
'are supported.'
You can’t perform that action at this time.
0 commit comments