Mustafa-albakkar commited on
Commit
db23983
·
verified ·
1 Parent(s): f036519

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -10
app.py CHANGED
@@ -44,7 +44,7 @@ llm = LlamaCpp(
44
  n_threads=4,
45
  n_gpu_layers=0,
46
  temperature=0.65,
47
- top_p=0.9,
48
  max_tokens=100,
49
  n_batch=64,
50
  verbose=False,
@@ -260,16 +260,29 @@ Final Answer: The answer is 42 because analysis of the given data and tool resul
260
  )
261
 
262
  react_template = """
 
 
263
  Question: {input}
264
- Thought: <describe your short plan>
265
- Action: <tool name>
266
- Action Input: <input to the tool>
267
- Observation: <tool output>
268
- Repeat (Thought- Action - Action Input - Observation) until confident.
269
- Final Answer: <answer>
270
- use only those tools : {tools} .
271
- tool names: {tool_names}
272
- agent_scratchpad: {agent_scratchpad}
 
 
 
 
 
 
 
 
 
 
 
273
  """
274
 
275
  def create_agent_executor(llm, tools: List[Tool], tracer: Optional[Any] = None) -> AgentExecutor:
 
44
  n_threads=4,
45
  n_gpu_layers=0,
46
  temperature=0.65,
47
+ top_p=0.8,
48
  max_tokens=100,
49
  n_batch=64,
50
  verbose=False,
 
260
  )
261
 
262
  react_template = """
263
+ You are a ReAct-style reasoning agent. Follow always *exactly* this structure:
264
+
265
  Question: {input}
266
+
267
+ Thought: Reflect on what is being asked. Based on previous Observations, decide your next useful step.
268
+ Action: <choose a tool from the provided list — WikipediaSearch, YouTubeExtractor, MediaAnalyzer, CoderAgent, SafePythonREPL, etc.>
269
+ Action Input: <provide only the raw input for that tool, without brackets or quotes, reasure always to give the write input based on abilities of the tool and it's supported input>
270
+ Observation: <summarize the important and useful result from that tool>
271
+
272
+ (Repeat the Thought / Action / Action Input / Observation pattern as needed.)
273
+
274
+ When you are ready to conclude, write your final section:
275
+
276
+ Final Answer: <write your best possible answer here, including both the main result and the short reasoning or justification that led you to it. This section must contain the full reasoning summary as one coherent response.> <<END>>
277
+
278
+ Notes:
279
+ - Allowed tools: {tool_names}
280
+ - Tool descriptions: {tools}
281
+ - Always use Observations from previous steps to inform the next Thought.
282
+ - Do not repeat identical actions.
283
+ - Always stop generation immediately after `<<END>>`.
284
+ Begin.
285
+ {agent_scratchpad}
286
  """
287
 
288
  def create_agent_executor(llm, tools: List[Tool], tracer: Optional[Any] = None) -> AgentExecutor: