proitm commited on
Commit
411aff1
·
verified ·
1 Parent(s): 9844ad3

Added fix to prompting

Browse files
Files changed (1) hide show
  1. app.py +1 -6
app.py CHANGED
@@ -8,17 +8,12 @@ import asyncio
8
  import aiohttp
9
 
10
  from smolagents import CodeAgent, OpenAIServerModel, DuckDuckGoSearchTool
11
- from smolagents.prompts import CODE_SYSTEM_PROMPT
12
 
13
  # --- Constants ---
14
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
15
 
16
  # --- Basic Agent Definition ---
17
  MODEL_ID = "gemini-2.5-pro-preview-06-05"
18
- SYSTEM_PROMPT = f"""${CODE_SYSTEM_PROMPT}\n\n
19
- Give as precise answer as possible. Do not include extra explanation, thoughts or questions.
20
- Include just answer to the specific question.
21
- """
22
  GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
23
  class BasicAgent:
24
  def __init__(self):
@@ -37,7 +32,6 @@ class BasicAgent:
37
  self.agent_executor = CodeAgent(
38
  model=llm_model,
39
  tools=[search_tool],
40
- system_prompt=SYSTEM_PROMPT,
41
  )
42
  print("smolagents AgentExecutor initialized successfully with WebSearchTool.")
43
 
@@ -52,6 +46,7 @@ class BasicAgent:
52
  def __call__(self, question: str) -> str:
53
  print(f"\nAgent (smolagents) received question (first 100 chars): {question[:100]}...")
54
  try:
 
55
  response = self.agent_executor.run(question)
56
 
57
  print(f"Agent (smolagents) returning answer (first 50 chars): {str(response)[:50]}...")
 
8
  import aiohttp
9
 
10
  from smolagents import CodeAgent, OpenAIServerModel, DuckDuckGoSearchTool
 
11
 
12
  # --- Constants ---
13
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
14
 
15
  # --- Basic Agent Definition ---
16
  MODEL_ID = "gemini-2.5-pro-preview-06-05"
 
 
 
 
17
  GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
18
  class BasicAgent:
19
  def __init__(self):
 
32
  self.agent_executor = CodeAgent(
33
  model=llm_model,
34
  tools=[search_tool],
 
35
  )
36
  print("smolagents AgentExecutor initialized successfully with WebSearchTool.")
37
 
 
46
  def __call__(self, question: str) -> str:
47
  print(f"\nAgent (smolagents) received question (first 100 chars): {question[:100]}...")
48
  try:
49
+ prompt = f"Answer the following question without any formatting. Just plain text answer with no reasoning output. ${question}"
50
  response = self.agent_executor.run(question)
51
 
52
  print(f"Agent (smolagents) returning answer (first 50 chars): {str(response)[:50]}...")