Any reason why LangChain.Message.new_tool_result/1 only supports content field? #219
Closed
CaiqueMitsuoka
started this conversation in
General
Replies: 1 comment 1 reply
-
Hi @CaiqueMitsuoka! I may be missing something here, but the https://github.com/brainlid/langchain/blob/main/lib/message/tool_result.ex#L26 You can do this: Message.new_tool_result!(%{
tool_results: [
ToolResult.new!(%{
tool_call_id: "call_123",
name: "hello_world",
content: "Hello world!"
})
]
}) Does this meet your needs? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Asking about LangChain.Message.new_tool_result/1 that only populates
content
andtool_calls
(cursively).tool_call_id
andname
?Just to give context on my use case:
I save the exchanged messages(user and assistant) and tool_calls(name, args, result) associated with them.
Across requests I need reconstruct the chain and use result from previous tools. But I need to validate which tool was called.
Quick example:
User: Send an email to Brad asking if he is coming to the party.
Tool
create_email
is calledAssistant: Nice, I found Brad Pit on your contact list. Here is the email:
Hey Brad, are you coming to the party tomorrow?
Can I send the email?
User: Yep
Tool
send_email
, validates that the request is ancreate_email
and it uses the output execute to the action.I know its a silly example, but for compliance this is very important requirement. Once the user agree with something we need to stick with it.
The field name would allow to know the type of the on callbacks without a database trip to parse the result according to the tool format. The field
tool_call_id
allow to more complex queries to be done when only the name of the tool and the result is not enough, in this example with thetool_call_id
I can find in the database the call and find the contact id that was not included in the tool result.I'm able to achieve all of this with
But since the api still in rc I figure this is a quick and easy win.
I can open a PR if it's ok 👍
Beta Was this translation helpful? Give feedback.
All reactions