From 0078493a805b8fc6b3897e0ee22b36a8f083cbde Mon Sep 17 00:00:00 2001 From: Bagatur <22008038+baskaryan@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:28:43 -0700 Subject: [PATCH] fireworks[patch]: allow tool_choice with multiple tools (#26999) https://docs.fireworks.ai/api-reference/post-chatcompletions --- .../fireworks/langchain_fireworks/chat_models.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/libs/partners/fireworks/langchain_fireworks/chat_models.py b/libs/partners/fireworks/langchain_fireworks/chat_models.py index 9b9a06d5181..a07398f6d35 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(