awaittool.invoke("what is the current weather in sf?");
// output: [{"title":"San Francisco, CA Current Weather | AccuWeather","link":"https://www.accuweather.com/en/us/san-francisco/94103/current-weather/347629","snippet":"<b>Current</b> <b>weather</b> <b>in</b> San Francisco, CA. Check <b>current</b> conditions in San Francisco, CA with radar, hourly, and more."}]
Invocation with tool call
// This is usually generated by a model, but we'll create a tool call directly for demo purposes. constmodelGeneratedToolCall = { args: { input:"what is the current weather in sf?", }, id:"tool_call_id", name:tool.name, type:"tool_call", }; awaittool.invoke(modelGeneratedToolCall);
ToolMessage {
"content": "[{\"title\":\"San Francisco, CA Weather Conditions | Weather Underground\",\"link\":\"https://www.wunderground.com/weather/us/ca/san-francisco\",\"snippet\":\"San Francisco <b>Weather</b> Forecasts. <b>Weather</b> Underground provides local & long-range <b>weather</b> forecasts, weatherreports, maps & tropical <b>weather</b> conditions for the San Francisco area.\"}]",
"name": "duckduckgo-search",
"additional_kwargs": {},
"response_metadata": {},
"tool_call_id": "tool_call_id"
}
DuckDuckGo tool integration.
Setup: Install
@langchain/community
andduck-duck-scrape
.Constructor args
Instantiate
Invocation
Invocation with tool call