The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
docs(fireworks,groq,huggingface,mistralai,ollama,openai): x-ref `convert_to_openai_tool` (#34276)
Mason Daughertyff6e3558d764
diff --git a/libs/partners/fireworks/langchain_fireworks/chat_models.py b/libs/partners/fireworks/langchain_fireworks/chat_models.pyindex e2d183faeb..ef818c0c41 100644--- a/libs/partners/fireworks/langchain_fireworks/chat_models.py+++ b/libs/partners/fireworks/langchain_fireworks/chat_models.py@@ -669,8 +669,8 @@ class ChatFireworks(BaseChatModel):Args:tools: A list of tool definitions to bind to this chat model.- Supports any tool definition handled by- `langchain_core.utils.function_calling.convert_to_openai_tool`.++ Supports any tool definition handled by [`convert_to_openai_tool`][langchain_core.utils.function_calling.convert_to_openai_tool].tool_choice: Which tool to require the model to call.Must be the name of the single provided function,`'auto'` to automatically determine which function to call@@ -679,8 +679,7 @@ class ChatFireworks(BaseChatModel):`{"type": "function", "function": {"name": <<tool_name>>}}`.**kwargs: Any additional parameters to pass to`langchain_fireworks.chat_models.ChatFireworks.bind`-- """+ """ # noqa: E501formatted_tools = [convert_to_openai_tool(tool) for tool in tools]if tool_choice is not None and tool_choice:if isinstance(tool_choice, str) and (diff --git a/libs/partners/groq/langchain_groq/chat_models.py b/libs/partners/groq/langchain_groq/chat_models.pyindex 6646ec7212..ea5265336e 100644--- a/libs/partners/groq/langchain_groq/chat_models.py+++ b/libs/partners/groq/langchain_groq/chat_models.py@@ -829,8 +829,8 @@ class ChatGroq(BaseChatModel):Args:tools: A list of tool definitions to bind to this chat model.- Supports any tool definition handled by- `langchain_core.utils.function_calling.convert_to_openai_tool`.++ Supports any tool definition handled by [`convert_to_openai_tool`][langchain_core.utils.function_calling.convert_to_openai_tool].tool_choice: Which tool to require the model to call.Must be the name of the single provided function,`'auto'` to automatically determine which function to call@@ -839,8 +839,7 @@ class ChatGroq(BaseChatModel):`{"type": "function", "function": {"name": <<tool_name>>}}`.**kwargs: Any additional parameters to pass to the`langchain.runnable.Runnable` constructor.-- """+ """ # noqa: E501formatted_tools = [convert_to_openai_tool(tool) for tool in tools]if tool_choice is not None and tool_choice:if tool_choice == "any":diff --git a/libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py b/libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.pyindex 2f61bf9ef8..725c40337e 100644--- a/libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py+++ b/libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py@@ -947,8 +947,8 @@ class ChatHuggingFace(BaseChatModel):Args:tools: A list of tool definitions to bind to this chat model.- Supports any tool definition handled by- `langchain_core.utils.function_calling.convert_to_openai_tool`.++ Supports any tool definition handled by [`convert_to_openai_tool`][langchain_core.utils.function_calling.convert_to_openai_tool].tool_choice: Which tool to require the model to call.Must be the name of the single provided function or`'auto'` to automatically determine which function to call@@ -956,8 +956,7 @@ class ChatHuggingFace(BaseChatModel):{"type": "function", "function": {"name": <<tool_name>>}}.**kwargs: Any additional parameters to pass to the`langchain.runnable.Runnable` constructor.-- """+ """ # noqa: E501formatted_tools = [convert_to_openai_tool(tool) for tool in tools]if tool_choice is not None and tool_choice:if len(formatted_tools) != 1:diff --git a/libs/partners/mistralai/langchain_mistralai/chat_models.py b/libs/partners/mistralai/langchain_mistralai/chat_models.pyindex c56c4deb27..3a2681d7bc 100644--- a/libs/partners/mistralai/langchain_mistralai/chat_models.py+++ b/libs/partners/mistralai/langchain_mistralai/chat_models.py@@ -792,8 +792,8 @@ class ChatMistralAI(BaseChatModel):Args:tools: A list of tool definitions to bind to this chat model.- Supports any tool definition handled by- `langchain_core.utils.function_calling.convert_to_openai_tool`.++ Supports any tool definition handled by [`convert_to_openai_tool`][langchain_core.utils.function_calling.convert_to_openai_tool].tool_choice: Which tool to require the model to call.Must be the name of the single provided function or`'auto'` to automatically determine which function to call@@ -801,8 +801,7 @@ class ChatMistralAI(BaseChatModel):{"type": "function", "function": {"name": <<tool_name>>}}.kwargs: Any additional parameters are passed directly to`self.bind(**kwargs)`.-- """+ """ # noqa: E501formatted_tools = [convert_to_openai_tool(tool) for tool in tools]if tool_choice:tool_names = []diff --git a/libs/partners/ollama/langchain_ollama/chat_models.py b/libs/partners/ollama/langchain_ollama/chat_models.pyindex fb8901fa8b..890f47f39d 100644--- a/libs/partners/ollama/langchain_ollama/chat_models.py+++ b/libs/partners/ollama/langchain_ollama/chat_models.py@@ -1235,13 +1235,13 @@ class ChatOllama(BaseChatModel):Args:tools: A list of tool definitions to bind to this chat model.- Supports any tool definition handled by- `langchain_core.utils.function_calling.convert_to_openai_tool`.++ Supports any tool definition handled by [`convert_to_openai_tool`][langchain_core.utils.function_calling.convert_to_openai_tool].tool_choice: If provided, which tool for model to call. **This parameteris currently ignored as it is not supported by Ollama.**kwargs: Any additional parameters are passed directly to`self.bind(**kwargs)`.- """+ """ # noqa: E501formatted_tools = [convert_to_openai_tool(tool) for tool in tools]return super().bind(tools=formatted_tools, **kwargs)diff --git a/libs/partners/openai/langchain_openai/chat_models/base.py b/libs/partners/openai/langchain_openai/chat_models/base.pyindex 9672cb752e..8428c03e40 100644--- a/libs/partners/openai/langchain_openai/chat_models/base.py+++ b/libs/partners/openai/langchain_openai/chat_models/base.py@@ -1815,8 +1815,8 @@ class BaseChatOpenAI(BaseChatModel):Args:tools: A list of tool definitions to bind to this chat model.- Supports any tool definition handled by- `langchain_core.utils.function_calling.convert_to_openai_tool`.++ Supports any tool definition handled by [`convert_to_openai_tool`][langchain_core.utils.function_calling.convert_to_openai_tool].tool_choice: Which tool to require the model to call. Options are:- `str` of the form `'<<tool_name>>'`: calls `<<tool_name>>` tool.