chinmayjha commited on
Commit
e1528d1
·
unverified ·
1 Parent(s): 2fd251c

Reduce max_steps to 2 to prevent final_answer from reformatting

Browse files

- Changed max_steps from 3 to 2 to stop after answer_with_sources
- Updated tool description to clarify it generates the FINAL answer
- Removed reference to calling final_answer tool (no longer needed)
- This prevents the built-in final_answer from stripping citations and sources

src/second_brain_online/application/agents/agents.py CHANGED
@@ -63,7 +63,7 @@ class AgentWrapper:
63
  agent = ToolCallingAgent(
64
  tools=[what_can_i_do, retriever_tool, summarizer_tool],
65
  model=model,
66
- max_steps=3, # Retrieval → answer_with_sources final_answer (pass-through)
67
  verbosity_level=2,
68
  )
69
 
 
63
  agent = ToolCallingAgent(
64
  tools=[what_can_i_do, retriever_tool, summarizer_tool],
65
  model=model,
66
+ max_steps=2, # Retrieval → answer_with_sources (which IS the final answer)
67
  verbosity_level=2,
68
  )
69
 
src/second_brain_online/application/agents/tools/summarizer.py CHANGED
@@ -62,11 +62,11 @@ class HuggingFaceEndpointSummarizerTool(Tool):
62
 
63
  class OpenAISummarizerTool(Tool):
64
  name = "answer_with_sources"
65
- description = """Use this tool to generate the complete final answer to the user's question based on search results.
66
 
67
  After retrieving documents with mongodb_vector_search_retriever, use this tool to synthesize a comprehensive answer with a Sources section.
68
 
69
- CRITICAL: This tool's output is the complete answer - after getting results from this tool, you MUST call the built-in final_answer tool and pass this output EXACTLY as-is without any modifications."""
70
 
71
  inputs = {
72
  "search_results": {
 
62
 
63
  class OpenAISummarizerTool(Tool):
64
  name = "answer_with_sources"
65
+ description = """Use this tool to generate the FINAL answer to the user's question based on search results.
66
 
67
  After retrieving documents with mongodb_vector_search_retriever, use this tool to synthesize a comprehensive answer with a Sources section.
68
 
69
+ CRITICAL: This tool generates the final answer that will be returned to the user. Do NOT modify or reformat its output in any way."""
70
 
71
  inputs = {
72
  "search_results": {