ORromu commited on
Commit
6592bb2
·
verified ·
1 Parent(s): 08772b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -4,6 +4,7 @@ import requests
4
  import inspect
5
  import pandas as pd
6
  from smolagents import CodeAgent, OpenAIServerModel, DuckDuckGoSearchTool, WikipediaSearchTool, CodeAgent
 
7
 
8
  GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY")
9
 
@@ -13,11 +14,13 @@ model = OpenAIServerModel(
13
  api_base="https://generativelanguage.googleapis.com/v1beta/openai/"
14
  )
15
 
16
- prompt = """You are a helpful assistant tasked with answering questions using a set of tools.
 
 
17
  Now, I will ask you a question. Report your thoughts, and finish your answer with the following template:
18
  FINAL ANSWER: [YOUR FINAL ANSWER].
19
  YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
20
- Your answer should only start with "FINAL ANSWER: ", then follows with the answer. """
21
 
22
  # (Keep Constants as is)
23
  # --- Constants ---
@@ -31,7 +34,7 @@ class BasicAgent:
31
  tools = [DuckDuckGoSearchTool(), WikipediaSearchTool()],
32
  model = model,
33
  add_base_tools=True,
34
- system_prompt = prompt
35
  )
36
  print("BasicAgent initialized.")
37
  def __call__(self, question: str) -> str:
 
4
  import inspect
5
  import pandas as pd
6
  from smolagents import CodeAgent, OpenAIServerModel, DuckDuckGoSearchTool, WikipediaSearchTool, CodeAgent
7
+ from smolagents.agents import PromptTemplates
8
 
9
  GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY")
10
 
 
14
  api_base="https://generativelanguage.googleapis.com/v1beta/openai/"
15
  )
16
 
17
+
18
+ prompt = PromptTemplates(
19
+ system_prompt="""You are a helpful assistant tasked with answering questions using a set of tools.
20
  Now, I will ask you a question. Report your thoughts, and finish your answer with the following template:
21
  FINAL ANSWER: [YOUR FINAL ANSWER].
22
  YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
23
+ Your answer should only start with "FINAL ANSWER: ", then follows with the answer. """)
24
 
25
  # (Keep Constants as is)
26
  # --- Constants ---
 
34
  tools = [DuckDuckGoSearchTool(), WikipediaSearchTool()],
35
  model = model,
36
  add_base_tools=True,
37
+ prompt_templates = prompt
38
  )
39
  print("BasicAgent initialized.")
40
  def __call__(self, question: str) -> str: