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

langgraph[patch]: ToolNode support for tools outputting msg #977

Merged
merged 7 commits into from
Jul 15, 2024

Conversation

baskaryan
Copy link
Contributor

@baskaryan baskaryan commented Jul 10, 2024

After langchain-ai/langchain#24038, tools will be able to take in typed ToolCalls directly and will output a ToolMessage when invoked with a ToolCall

Requires langchain-core==0.2.16 to be released

@baskaryan baskaryan changed the title rfc: tool node support tools outputting msg langgraph[patch]: ToolNode support for tools outputting msg Jul 11, 2024
@baskaryan baskaryan requested a review from vbarda July 11, 2024 22:27
Copy link
Collaborator

@vbarda vbarda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, thank you!

@baskaryan baskaryan marked this pull request as ready for review July 12, 2024 15:15
content=str_output(output), name=call["name"], tool_call_id=call["id"]
)
content = f"Error: {repr(e)}\n Please fix your mistakes."
return ToolMessage(content, name=call["name"], tool_call_id=call["id"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we no lnoger passing content by keyword?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleaner this way (imo), messages accept content as pos arg

@hinthornw
Copy link
Contributor

So tools always return a tool message in this formulation? I must have missed where we guarantee this; it' sin the TOolCall itself?

@baskaryan
Copy link
Contributor Author

So tools always return a tool message in this formulation? I must have missed where we guarantee this; it' sin the TOolCall itself?

tools always return tool message if input is a ToolCall with "type" and "id" set

@baskaryan baskaryan merged commit 2a1cdd3 into main Jul 15, 2024
27 checks passed
@baskaryan baskaryan deleted the bagatur/rfc_tools_returning_tool_msg branch July 15, 2024 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants