iQuentin commited on
Commit
9c254c5
·
verified ·
1 Parent(s): 6843597

Mise en place de Prompt_templates suivant instructions par Perplexity

Browse files
Files changed (1) hide show
  1. agent.py +11 -4
agent.py CHANGED
@@ -10,6 +10,7 @@ from smolagents import (
10
  # HfApiModel, # import bug from smolagents after adding duckduckgo-search in requirements
11
  tool
12
  )
 
13
  from typing import List, Dict, Any, Optional
14
 
15
 
@@ -22,17 +23,22 @@ class QAgent:
22
  api_key: Optional[str] = None,
23
  provider: Optional[str] = None, # for InferenceClientModel
24
  timeout: Optional[int] = None, # for InferenceClientModel
25
- system_prompt: str = "",
26
  temperature: float = 0.2,
27
  verbose: bool = False # Verbose logging or not
28
  ):
29
  """
30
  QAgent description
31
  """
 
 
 
 
 
32
  print(f"Begin QAgent init with: ")
33
  self.verbose = verbose
34
- self.system_prompt = system_prompt or ""
35
- print(f"self.system_prompt = {self.system_prompt}, system_prompt = {system_prompt}")
36
 
37
 
38
 
@@ -110,7 +116,8 @@ class QAgent:
110
  # Setup imports
111
  self.imports = ["pandas", "numpy", "datetime", "json", "re", "math", "os", "requests", "csv", "urllib"]
112
  custom_templates = PromptTemplates(
113
- system_prompt="Votre system prompt personnalisé ici"
 
114
  )
115
  # Create CodeAgent
116
  print(f"Begin creating CodeAgent")
 
10
  # HfApiModel, # import bug from smolagents after adding duckduckgo-search in requirements
11
  tool
12
  )
13
+ from smolagents.prompts import CODE_SYSTEM_PROMPT
14
  from typing import List, Dict, Any, Optional
15
 
16
 
 
23
  api_key: Optional[str] = None,
24
  provider: Optional[str] = None, # for InferenceClientModel
25
  timeout: Optional[int] = None, # for InferenceClientModel
26
+ # system_prompt: str = "",
27
  temperature: float = 0.2,
28
  verbose: bool = False # Verbose logging or not
29
  ):
30
  """
31
  QAgent description
32
  """
33
+ # Enhance system prompt for GAIA test
34
+ extra="You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. 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."
35
+ custom_prompt = f"{extra}\n\n{CODE_SYSTEM_PROMPT}"
36
+
37
+
38
  print(f"Begin QAgent init with: ")
39
  self.verbose = verbose
40
+ # self.system_prompt = system_prompt or ""
41
+ # print(f"self.system_prompt = {self.system_prompt}, system_prompt = {system_prompt}")
42
 
43
 
44
 
 
116
  # Setup imports
117
  self.imports = ["pandas", "numpy", "datetime", "json", "re", "math", "os", "requests", "csv", "urllib"]
118
  custom_templates = PromptTemplates(
119
+ system_prompt=custom_prompt,
120
+ planning=PlanningPromptTemplate(template="Remember: reflect deeply."),
121
  )
122
  # Create CodeAgent
123
  print(f"Begin creating CodeAgent")