mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-16 16:11:02 +00:00
format
This commit is contained in:
parent
97a0431874
commit
36db3212a9
@ -359,18 +359,20 @@ class ChatLlamaCpp(BaseChatModel):
|
|||||||
f"provided tools were {tool_names}."
|
f"provided tools were {tool_names}."
|
||||||
)
|
)
|
||||||
elif isinstance(tool_choice, str):
|
elif isinstance(tool_choice, str):
|
||||||
if tool_choice == 'any':
|
if tool_choice == "any":
|
||||||
if len(formatted_tools) == 1:
|
if len(formatted_tools) == 1:
|
||||||
tool_choice = formatted_tools[0]
|
tool_choice = formatted_tools[0]
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"tool_choice `'any'` only supported if one tool is provided."
|
"tool_choice `'any'` only supported if one tool is provided."
|
||||||
)
|
)
|
||||||
elif tool_choice == 'auto':
|
elif tool_choice == "auto":
|
||||||
tool_choice = None
|
tool_choice = None
|
||||||
else:
|
else:
|
||||||
chosen = [
|
chosen = [
|
||||||
f for f in formatted_tools if f["function"]["name"] == tool_choice
|
f
|
||||||
|
for f in formatted_tools
|
||||||
|
if f["function"]["name"] == tool_choice
|
||||||
]
|
]
|
||||||
if not chosen:
|
if not chosen:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
Loading…
Reference in New Issue
Block a user