### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)tags/v0.17.1
| if self.prompt_config.get("tavily_api_key"): | if self.prompt_config.get("tavily_api_key"): | ||||
| tav = Tavily(self.prompt_config["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["chunks"].extend(tav_res["chunks"]) | ||||
| kbinfos["doc_aggs"].extend(tav_res["doc_aggs"]) | kbinfos["doc_aggs"].extend(tav_res["doc_aggs"]) | ||||
| if self.prompt_config.get("use_kg") and self._kg_retrieve: | if self.prompt_config.get("use_kg") and self._kg_retrieve: |
| def retrieve_chunks(self, question): | def retrieve_chunks(self, question): | ||||
| chunks = [] | chunks = [] | ||||
| aggs = [] | aggs = [] | ||||
| logging.info("[Tavily]Q: " + question) | |||||
| for r in self.search(question): | for r in self.search(question): | ||||
| id = get_uuid() | id = get_uuid() | ||||
| chunks.append({ | chunks.append({ | ||||
| "count": 1, | "count": 1, | ||||
| "url": r["url"] | "url": r["url"] | ||||
| }) | }) | ||||
| logging.info("[Tavily]: "+r["content"][:128]+"...") | |||||
| logging.info("[Tavily]R: "+r["content"][:128]+"...") | |||||
| return {"chunks": chunks, "doc_aggs": aggs} | return {"chunks": chunks, "doc_aggs": aggs} |