Skip to content

Commit 82d8a70

Browse files
Refine agent prompts and Python instructions
The changes in smart_with_tools.py include modifications to the planning prompt, clarifying the roles of agents and the reasoning process. The Python interpreter instructions were expanded to specify the use of a Python interpreter with internet access, listing installed libraries, and emphasizing UUID usage for file handling. Additionally, the system prompt injection was updated to include the new Python interpreter instructions.
1 parent c482c74 commit 82d8a70

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

functions/smart_with_tools.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
PLANNING_PROMPT = """<system_instructions>
4444
You are a planning Agent. You are part of an agent chain designed to make LLMs more capable.
4545
You are responsible for taking the incoming user input/request and preparing it for the next agents in the chain.
46-
After you will come a reasoning and tool use agent. These agents can go back and forth between each other until they have come up with a solution.
46+
After you will come either a reasoning agent or the final agent.
4747
After they have come up with a solution, a final agent will be used to summarize the reasoning and provide a final answer.
4848
Only use a Newline after each closing tag. Never after the opening tag or within the tags.
4949
@@ -54,7 +54,7 @@
5454
You should respond by following these steps:
5555
1. Within <reasoning> tags, plan what you will write in the other tags. This has to be your first step.
5656
1. First, reason about the task difficulty. What kind of task is it? What do your guidelines say about that?
57-
2. Second, reason about if the reasoning and tool use agent is needed. What do your guidelines say about that?
57+
2. Second, reason about if the reasoning is needed. What do your guidelines say about that?
5858
3. Third, reason about what model would best be used. What do your guidelines say about that?
5959
2. Within the <answer> tag, write out your final answer. Your answer should be a comma seperated list.
6060
1. First choose the model the final-agent will use. Try to find a good balance between performance and cost. Larger models are bigger.
@@ -64,10 +64,10 @@
6464
- Use #large for tasks that are mostly creative or involve the writing of complex code, math, etc.
6565
2. Secondly, choose if the query requieres reasoning before being handed off to the final agent.
6666
- Queries that requeire reasoning are especially queries where llm are bad at. Such as planning, counting, logic, code architecutre, moral questions, etc.
67-
- Queries that don't requeire reasoning are queries that are easy for llms. Such as "knowledge" questions, summarization, writing notes, simple tool use, etc.
67+
- Queries that don't requeire reasoning are queries that are easy for llms. Such as "knowledge" questions, summarization, writing notes, primairly tool use, web searching, etc.
6868
- If you think reasoning is needed, include #reasoning. If not #no-reasoning.
6969
- When you choose reasoning, you should (in most cases) choose at least the #medium model.
70-
3. Third, you can make tools avalible to the tool-use and final agent. You can enable multiple tools.
70+
3. Third, you can make tools avalible to the final agent. You can enable multiple tools.
7171
- Avalible tools are #online, #python, #wolfram, #image-gen
7272
- Use #online to enable multiple tools such as Search and a Scraping tool. This will greatly increase the accuracy of answers for things newer than Late 2023.
7373
- Use #wolfram to enable access to Wolfram|Alpha, a powerful computational knowledge engine and scientific and real-time database.
@@ -228,7 +228,16 @@
228228
</imageGenInstructions>"""
229229

230230
PROMPT_PythonInterpreter = """<pythonInstructions>
231-
231+
Use a Python interpreter with internet access to execute code.
232+
No Notebook, use print etc. to output to STDOUT.
233+
Installed Libraries: numpy, scipy, pypdf2, pandas, pyarrow, matplotlib, pillow, opencv-python-headless, requests, bs4, geopandas, geopy, yfinance, seaborn, openpyxl, litellm, replicate, openai, ipython.
234+
Installed System libraries: wget git curl ffmpeg.
235+
236+
You can link to files within the python intrpreter by using !(file_name)[https://api.rennersh.de/api/v1/interpreter/file/download/[uuid]/[filename]]. If the file is an image you should always use the !()[] syntax instead of ()[].
237+
ALWAYS list the files before saying "can you upload that" or something similar, if the user is asking you to do something to a file they probably already uploaded it!
238+
239+
You should use the same UUID for the entire conversation, unless the user specifically requests or gives you a new one.
240+
Always add all UUIDs of the interpreters you used at the VERY beginning of your answer to the user! You HAVE TO include something like:"UUIDs: [list of uuids GOES HERE]" at the VERY START of your message! THE USER NEEDS TO KNOW THE uuid!
232241
</pythonInstructions>"""
233242

234243
# ---------------------------------------------------------------
@@ -1180,6 +1189,7 @@ def create_pydantic_model_from_docstring(func):
11801189
description=desc,
11811190
)
11821191
)
1192+
self.SYSTEM_PROMPT_INJECTION = self.SYSTEM_PROMPT_INJECTION + PROMPT_PythonInterpreter
11831193
if tool == "online":
11841194
online_tools = [
11851195
(self.search_web, "Search the internet for information."),

0 commit comments

Comments
 (0)