From 68f9f157a62c551126c7987436c72bcd95a98e27 Mon Sep 17 00:00:00 2001 From: joachim-danswer Date: Fri, 4 Apr 2025 09:53:39 -0700 Subject: [PATCH] Adding research topics for better search context (#4448) * research topics addition * allow for question to overwrite research area --- .../nodes/a2_research_object_source.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/backend/onyx/agents/agent_search/dc_search_analysis/nodes/a2_research_object_source.py b/backend/onyx/agents/agent_search/dc_search_analysis/nodes/a2_research_object_source.py index 072a2f274..0e567d578 100644 --- a/backend/onyx/agents/agent_search/dc_search_analysis/nodes/a2_research_object_source.py +++ b/backend/onyx/agents/agent_search/dc_search_analysis/nodes/a2_research_object_source.py @@ -61,7 +61,11 @@ def research_object_source( raise ValueError("Agent 2 task not found") agent_2_time_cutoff = extract_section( - agent_2_instructions, "Time Cutoff:", "Output Objective:" + agent_2_instructions, "Time Cutoff:", "Research Topics:" + ) + + agent_2_research_topics = extract_section( + agent_2_instructions, "Research Topics:", "Output Objective" ) agent_2_output_objective = extract_section( @@ -99,8 +103,15 @@ def research_object_source( document_sources = [document_source] if document_source else None + if len(question.strip()) > 0: + research_area = f"{question} for {object}" + elif agent_2_research_topics and len(agent_2_research_topics.strip()) > 0: + research_area = f"{agent_2_research_topics} for {object}" + else: + research_area = object + retrieved_docs = research( - question=object, + question=research_area, search_tool=search_tool, document_sources=document_sources, time_cutoff=agent_2_source_start_time,