Skip to content

The agent engineering platform.

fireworks[patch]: allow tool_choice with multiple tools (#26999)

Bagatur0078493a805b
diff --git a/libs/partners/fireworks/langchain_fireworks/chat_models.py b/libs/partners/fireworks/langchain_fireworks/chat_models.py
index 9b9a06d518..a07398f6d3 100644
--- a/libs/partners/fireworks/langchain_fireworks/chat_models.py
+++ b/libs/partners/fireworks/langchain_fireworks/chat_models.py
@@ -721,19 +721,6 @@ class ChatFireworks(BaseChatModel):
tool_choice not in ("auto", "any", "none")
):
tool_choice = {"type": "function", "function": {"name": tool_choice}}
- if isinstance(tool_choice, dict) and (len(formatted_tools) != 1):
- raise ValueError(
- "When specifying `tool_choice`, you must provide exactly one "
- f"tool. Received {len(formatted_tools)} tools."
- )
- if isinstance(tool_choice, dict) and (
- formatted_tools[0]["function"]["name"]
- != tool_choice["function"]["name"]
- ):
- raise ValueError(
- f"Tool choice {tool_choice} was specified, but the only "
- f"provided tool was {formatted_tools[0]['function']['name']}."
- )
if isinstance(tool_choice, bool):
if len(tools) > 1:
raise ValueError(