Fix: tavily search error. (#5653)

### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu 2025-03-05 17:03:05 +08:00 committed by GitHub
parent 78b2e0be89
commit e5041749a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -118,7 +118,7 @@ class DeepResearcher:
if self.prompt_config.get("tavily_api_key"):
tav = Tavily(self.prompt_config["tavily_api_key"])
tav_res = tav.retrieve_chunks(" ".join(search_query))
tav_res = tav.retrieve_chunks(search_query)
kbinfos["chunks"].extend(tav_res["chunks"])
kbinfos["doc_aggs"].extend(tav_res["doc_aggs"])
if self.prompt_config.get("use_kg") and self._kg_retrieve:

View File

@ -38,6 +38,7 @@ class Tavily:
def retrieve_chunks(self, question):
chunks = []
aggs = []
logging.info("[Tavily]Q: " + question)
for r in self.search(question):
id = get_uuid()
chunks.append({
@ -62,5 +63,5 @@ class Tavily:
"count": 1,
"url": r["url"]
})
logging.info("[Tavily]: "+r["content"][:128]+"...")
logging.info("[Tavily]R: "+r["content"][:128]+"...")
return {"chunks": chunks, "doc_aggs": aggs}