fix: fix unittes & background investigation search logic (#247)

This commit is contained in:
DanielWalnut
2025-05-27 23:05:34 -07:00
committed by GitHub
parent 29be360954
commit 0565ab6d27
2 changed files with 22 additions and 9 deletions

View File

@@ -50,9 +50,24 @@ def background_investigation_node(
logger.info("background investigation node is running.")
configurable = Configuration.from_runnable_config(config)
query = state["messages"][-1].content
background_investigation_results = get_web_search_tool(
configurable.max_search_results
).invoke(query)
if SELECTED_SEARCH_ENGINE == SearchEngine.TAVILY.value:
searched_content = LoggedTavilySearch(
max_results=configurable.max_search_results
).invoke(query)
background_investigation_results = None
if isinstance(searched_content, list):
background_investigation_results = [
{"title": elem["title"], "content": elem["content"]}
for elem in searched_content
]
else:
logger.error(
f"Tavily search returned malformed response: {searched_content}"
)
else:
background_investigation_results = get_web_search_tool(
configurable.max_search_results
).invoke(query)
return Command(
update={
"background_investigation_results": json.dumps(