Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Migrate from function calling to tool calling #400

Merged
merged 1 commit into from
May 5, 2024

Conversation

davidmigloz
Copy link
Owner

@davidmigloz davidmigloz commented May 4, 2024

Resolves #397

This PR migrates from the "function calling" paradigm to the "tool calling" paradigm. The main difference is that previously the model could only call a single function/tool at a time, whereas now the model can call multiple tools in a single request.

Currently, we only support tool calling with OpenAI's chat models. We will soon add support for tool calling with other providers (GoogleAI and Mistral).

Migration guide

The following list contains the equivalent classes in the new "tool calling" paradigm:

  • ChatFunction -> ToolSpec
  • ChatFunctionCall -> ChatToolChoice
  • AIChatMessageFunctionCall -> AIChatMessageToolCall
  • FunctionChatMessage -> ToolChatMessage
  • ChatMessage.function -> ChatMessage.tool
  • OutputFunctionsParser -> ToolsOutputParser
  • JsonOutputFunctionsParser -> ToolsOutputParser
  • JsonKeyOutputFunctionsParser -> ToolsOutputParser
  • OpenAIFunctionsAgent -> OpenAIToolsAgent

You can check the new Tool Calling documentation for more details.

@davidmigloz davidmigloz self-assigned this May 4, 2024
@davidmigloz davidmigloz added c:chat-models Chat models. p:langchain_openai langchain_openai package. p:langchain_core langchain_core package. t:enhancement New feature or request labels May 4, 2024
@davidmigloz davidmigloz added this to the v0.7.0 milestone May 4, 2024
@davidmigloz davidmigloz merged commit 44413b8 into main May 5, 2024
1 check passed
@davidmigloz davidmigloz deleted the tool-calling branch May 5, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:chat-models Chat models. p:langchain_core langchain_core package. p:langchain_openai langchain_openai package. t:enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Migrate from function calling to tool calling
1 participant