How to output structured JSON from DuckDuckGo tool call #29313
Replies: 1 comment
-
Hi, It would help if you could give the code including the From what I understand, making a tool call will return structured data which is passed back to the calling program to then execute the tool call. Therefore you'll need at least two LLM calls, the first LLM has the tool(s) bound to it. Then call the tools with the returned arguments. Next call the LLM again with a structured output request (see https://python.langchain.com/docs/concepts/structured_outputs/) However, I'm not sure here why you need the duckduckgo scraping as a tool call here? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
I am using an example from official documentation here: duckduckgo_search
The output is a string, but I want it to be a structured JSON
When trying to add method
withStructuredJson()
I got error, that basically says that bindTools method doesnt exist on the object
Who knows how to achieve a structured output after calling DuckDuckGo tool
Please help, or point to a working similar solution
Thank you
System Info
{
"type": "module",
"dependencies": {
"@langchain/community": "^0.3.24",
"@langchain/core": "^0.3.30",
"@langchain/openai": "^0.3.17",
"dotenv": "^16.4.7",
"duck-duck-scrape": "^2.2.7",
"langchain": "^0.3.11",
"zod": "^3.24.1"
}
}
Beta Was this translation helpful? Give feedback.
All reactions