mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-19 04:14:46 +08:00
Update nodes.py (#242)
SELECTED_SEARCH_ENGINE impossible equal to SearchEngine.ARXIV, should be SearchEngine.ARXIV.value, or use the encapsulated get_web_search_tool
This commit is contained in:
@@ -50,24 +50,9 @@ def background_investigation_node(
|
|||||||
logger.info("background investigation node is running.")
|
logger.info("background investigation node is running.")
|
||||||
configurable = Configuration.from_runnable_config(config)
|
configurable = Configuration.from_runnable_config(config)
|
||||||
query = state["messages"][-1].content
|
query = state["messages"][-1].content
|
||||||
if SELECTED_SEARCH_ENGINE == SearchEngine.TAVILY:
|
background_investigation_results = get_web_search_tool(
|
||||||
searched_content = LoggedTavilySearch(
|
configurable.max_search_results
|
||||||
max_results=configurable.max_search_results
|
).invoke(query)
|
||||||
).invoke({"query": 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(
|
return Command(
|
||||||
update={
|
update={
|
||||||
"background_investigation_results": json.dumps(
|
"background_investigation_results": json.dumps(
|
||||||
|
|||||||
Reference in New Issue
Block a user