|
25 | 25 |
|
26 | 26 |
|
27 | 27 | class DeepResearchLangchain(DeepResearchBase): |
| 28 | + _FINAL_ANSWER_INST = ( |
| 29 | + "You are a senior interdisciplinary researcher with expertise across " |
| 30 | + "science, technology, humanities, and social sciences.\n" |
| 31 | + "Provide report only in plain text using natural language.\n" |
| 32 | + "Write your response in the form of a well-structured research report with sections:\n" |
| 33 | + "Executive Summary, Key Findings, Evidence, Limitations, Conclusion.\n" |
| 34 | + "Use inline numeric citations like [1], [2] that refer to Sources.\n" |
| 35 | + "At the end, include a 'Sources' section listing the numbered citations.\n\n" |
| 36 | + ) |
| 37 | + |
28 | 38 | def __init__( |
29 | 39 | self, |
30 | 40 | key: str, |
@@ -142,6 +152,7 @@ async def invoke( |
142 | 152 | reasoning_traces: list[dict[str, Any]] = [] |
143 | 153 |
|
144 | 154 | question = messages[-1]["content"] |
| 155 | + question = self._FINAL_ANSWER_INST + question |
145 | 156 |
|
146 | 157 | # Seed notes with any provided documents |
147 | 158 | notes: list[str] = [] |
@@ -297,14 +308,7 @@ async def invoke( |
297 | 308 | final_prompt = PromptTemplate( |
298 | 309 | input_variables=["question", "notes", "sources"], |
299 | 310 | template=( |
300 | | - "You are a senior interdisciplinary researcher with expertise across " |
301 | | - "science, technology, humanities, and social sciences.\n" |
302 | | - "Provide report only in plain text using natural language.\n" |
303 | | - "Write your response in the form of a well-structured research report with sections:\n" |
304 | | - "Executive Summary, Key Findings, Evidence, Limitations, Conclusion.\n" |
305 | | - "Use inline numeric citations like [1], [2] that refer to Sources.\n" |
306 | | - "At the end, include a 'Sources' section listing the numbered citations.\n\n" |
307 | | - "Do NOT use JSON, or any other structured data format.\n" |
| 311 | + self._FINAL_ANSWER_INST + "Do NOT use JSON, or any other structured data format.\n" |
308 | 312 | "Question:\n{question}\n\n" |
309 | 313 | "Notes:\n{notes}\n\n" |
310 | 314 | "Sources:\n{sources}\n\n" |
|
0 commit comments