-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
core[minor],openai[patch],langchain[patch]: Allow tool functions to input ToolCall
/ return ToolMessage
#6005
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
langchain-core/src/callbacks/base.ts
Outdated
@@ -197,7 +198,7 @@ abstract class BaseCallbackHandlerMethodsClass { | |||
* Called at the end of a Tool run, with the tool output and the run ID. | |||
*/ | |||
handleToolEnd?( | |||
output: string, | |||
output: string | ToolMessage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be an any type -- a tool should be allowed to return anything, and we shouldn't be limiting the return type in anyway
output: string | ToolMessage, | |
output: any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would we handle things that aren't a string or tool message? Type check and e.g. JSON.stringify?
ToolCall
/ return ToolMessage
…brace/tools-return-tool-message
ToolCall
/ return ToolMessage
ToolCall
/ return ToolMessage
TODO:
Followup PR will wrap all integrations with the
createToolCall
/createToolCallChunk
funcTools can now:
ToolCall
as an input.ToolMessage
Updated generics to reflect that.
Added a third generic to
tool
func wrapper if you want to specify for the input arg of thefunc
field. (it will infer if no generics were prev passed)