Spaces:
Build error
Build error
Fix system prompts
Browse files- app.py +3 -4
- prompts.yaml +1 -9
app.py
CHANGED
|
@@ -17,16 +17,15 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 17 |
class BasicAgent:
|
| 18 |
def __init__(self):
|
| 19 |
print("BasicAgent initialized.")
|
| 20 |
-
|
| 21 |
-
final_answer = FinalAnswerTool()
|
| 22 |
-
# Initialize the agent with a model and tools
|
| 23 |
|
|
|
|
| 24 |
model = OpenAIServerModel(
|
| 25 |
model_id=os.environ["MODEL_ID"],
|
| 26 |
api_base="https://api.openai.com/v1",
|
| 27 |
api_key=os.environ["OPENAI_API_KEY"],
|
| 28 |
)
|
| 29 |
-
|
|
|
|
| 30 |
with open("prompts.yaml", "r") as stream:
|
| 31 |
prompt_templates = yaml.safe_load(stream)
|
| 32 |
|
|
|
|
| 17 |
class BasicAgent:
|
| 18 |
def __init__(self):
|
| 19 |
print("BasicAgent initialized.")
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
# Initialize the agent with a model and tools
|
| 22 |
model = OpenAIServerModel(
|
| 23 |
model_id=os.environ["MODEL_ID"],
|
| 24 |
api_base="https://api.openai.com/v1",
|
| 25 |
api_key=os.environ["OPENAI_API_KEY"],
|
| 26 |
)
|
| 27 |
+
|
| 28 |
+
final_answer = FinalAnswerTool()
|
| 29 |
with open("prompts.yaml", "r") as stream:
|
| 30 |
prompt_templates = yaml.safe_load(stream)
|
| 31 |
|
prompts.yaml
CHANGED
|
@@ -1,10 +1,4 @@
|
|
| 1 |
"system_prompt": |-
|
| 2 |
-
You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer as a number OR as few words
|
| 3 |
-
as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don not use comma to write your number
|
| 4 |
-
neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, do not use articles, neither
|
| 5 |
-
abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma
|
| 6 |
-
separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
|
| 7 |
-
|
| 8 |
You are an expert assistant who can solve any task using code blobs. You will be given a task to solve as best you can.
|
| 9 |
To do so, you have been given access to a list of tools: these tools are basically Python functions which you can call with code.
|
| 10 |
To solve the task, you must plan forward to proceed in a series of steps, in a cycle of 'Thought:', 'Code:', and 'Observation:' sequences.
|
|
@@ -315,6 +309,4 @@
|
|
| 315 |
And even if your task resolution is not successful, please return as much context as possible, so that your manager can act upon this feedback.
|
| 316 |
"report": |-
|
| 317 |
Here is the final answer from your managed agent '{{name}}':
|
| 318 |
-
{{final_answer}}
|
| 319 |
-
|
| 320 |
-
|
|
|
|
| 1 |
"system_prompt": |-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
You are an expert assistant who can solve any task using code blobs. You will be given a task to solve as best you can.
|
| 3 |
To do so, you have been given access to a list of tools: these tools are basically Python functions which you can call with code.
|
| 4 |
To solve the task, you must plan forward to proceed in a series of steps, in a cycle of 'Thought:', 'Code:', and 'Observation:' sequences.
|
|
|
|
| 309 |
And even if your task resolution is not successful, please return as much context as possible, so that your manager can act upon this feedback.
|
| 310 |
"report": |-
|
| 311 |
Here is the final answer from your managed agent '{{name}}':
|
| 312 |
+
{{final_answer}}
|
|
|
|
|
|