Open wulucxy opened 6 days ago
@wulucxy Hello there! I'm here to assist you with any bugs, questions, or contributions. While you're waiting for a human maintainer, feel free to ask me anything.
The Tavily Search API returning an empty array in the results
field could be due to several reasons:
API Key Issue: Ensure that the API key is correctly set either through the environment variable TAVILY_API_KEY
or passed directly in the apiKey
field. If the API key is missing or incorrect, the request might not be processed correctly [1].
Query Parameters: The parameters being sent in the request might not be yielding any results. Check the values for includeGeneratedAnswer
, includeRawContent
, includeImages
, searchDepth
, includeDomains
, excludeDomains
, and kwargs
to ensure they are set correctly and are appropriate for the search query [1].
API Response Handling: The code checks if json.results
is an array. If the API response structure has changed or if there is an issue with the API itself, it might not return the expected results array [1].
Recent Changes: There have been recent changes in the LangChain.js repository that affect the Tavily Search API retriever functionality. Ensure you are using the latest version and check for any migration warnings or updates [2][1].
Error Codes or Messages: Specific error codes or messages returned by the Tavily Search API could indicate why the results
field is empty. If the API request fails, it throws an error with the status code and the error message from the response [3].
Default Parameter Values: The default values for parameters like includeGeneratedAnswer
, includeRawContent
, includeImages
, searchDepth
, includeDomains
, and excludeDomains
might affect the results. Ensure these are set appropriately for your query [1].
If the issue persists, consider enabling verbose logging or tracing to get more detailed information about the API requests and responses [4][5].
To continue talking to Dosu, mention @dosu.
Sorry you're running into this!
CC @rotemweiss57 for a look
Hey @wulucxy! Please try to insert "2023 NBA final winner" instead of '"{\"input\":\"2023 NBA final winner\"}"' as it creates limitations. Hope it helps (:
@rotemweiss57 I don't think so.
{"input":"2023 NBA final winner"}
was inferenced by model,as the schema defined by the tavily_search
.
so you have to be think the implement of the tool
@rotemweiss57 now I have been blocked here for a while, do you have any plan to improve this?
@rotemweiss57 what's the progress here?
Checked other resources
Example Code
// ===tavily request=== { query: '"{\"input\":\"2023 NBA final winner\"}"', max_results: 1, api_key: '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' }
// ===tavily response=== { query: '"{\"input\":\"2023 NBA final winner\"}"', follow_up_questions: null, answer: null, images: null, results: [], response_time: 1.28 }
Error Message and Stack Trace (if applicable)
No response
Description
https://github.com/langchain-ai/langchainjs/blob/1fddf296f922dcaa362a90c8fe90b4bfd84b6c3e/libs/langchain-community/src/retrievers/tavily_search_api.ts#L97
the return of tavily search api always empty array
System Info
@langchain/community": "^0.2.13"