File tree 2 files changed +15
-10
lines changed
src/ollama_deep_researcher
2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -135,14 +135,14 @@ def summarize_sources(state: SummaryState, config: RunnableConfig):
135
135
# Build the human message
136
136
if existing_summary :
137
137
human_message_content = (
138
- f"<User Input> \n { state .research_topic } \n <User Input>\n \n "
139
138
f"<Existing Summary> \n { existing_summary } \n <Existing Summary>\n \n "
140
- f"<New Search Results> \n { most_recent_web_research } \n <New Search Results>"
139
+ f"<New Context> \n { most_recent_web_research } \n <New Context>"
140
+ f"Update the Existing Summary with the New Context on this topic: \n <User Input> \n { state .research_topic } \n <User Input>\n \n "
141
141
)
142
142
else :
143
143
human_message_content = (
144
- f"<User Input > \n { state . research_topic } \n <User Input> \n \n "
145
- f"<Search Results > \n { most_recent_web_research } \n <Search Results> "
144
+ f"<Context > \n { most_recent_web_research } \n <Context> "
145
+ f"Create a Summary using the Context on this topic: \n <User Input > \n { state . research_topic } \n <User Input> \n \n "
146
146
)
147
147
148
148
# Run the LLM
@@ -256,7 +256,7 @@ def finalize_summary(state: SummaryState):
256
256
257
257
# Join the deduplicated sources
258
258
all_sources = "\n " .join (unique_sources )
259
- state .running_summary = f"## Summary\n \n { state .running_summary } \n \n ### Sources:\n { all_sources } "
259
+ state .running_summary = f"## Summary\n { state .running_summary } \n \n ### Sources:\n { all_sources } "
260
260
return {"running_summary" : state .running_summary }
261
261
262
262
def route_research (state : SummaryState , config : RunnableConfig ) -> Literal ["finalize_summary" , "web_research" ]:
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def get_current_date():
33
33
34
34
summarizer_instructions = """
35
35
<GOAL>
36
- Generate a high-quality summary of the web search results and keep it concise / related to the user topic .
36
+ Generate a high-quality summary of the provided context .
37
37
</GOAL>
38
38
39
39
<REQUIREMENTS>
@@ -54,7 +54,12 @@ def get_current_date():
54
54
55
55
< FORMATTING >
56
56
- Start directly with the updated summary, without preamble or titles. Do not use XML tags in the output.
57
- < /FORMATTING >"""
57
+ < /FORMATTING >
58
+
59
+ <Task>
60
+ Think carefully about the provided Context first. Then generate a summary of the context to address the User Input.
61
+ </Task>
62
+ """
58
63
59
64
reflection_instructions = """You are an expert research assistant analyzing a summary about {research_topic}.
60
65
@@ -74,12 +79,12 @@ def get_current_date():
74
79
- follow_up_query: Write a specific question to address this gap
75
80
</FORMAT>
76
81
77
- <EXAMPLE >
78
- Example output:
82
+ <Task >
83
+ Reflect carefully on the Summary to identify knowledge gaps and produce a follow-up query. Then, produce your output following this JSON format :
79
84
{{
80
85
"knowledge_gap": "The summary lacks information about performance metrics and benchmarks",
81
86
"follow_up_query": "What are typical performance benchmarks and metrics used to evaluate [specific technology]?"
82
87
}}
83
- </EXAMPLE >
88
+ </Task >
84
89
85
90
Provide your analysis in JSON format:"""
You can’t perform that action at this time.
0 commit comments