Spaces:
Sleeping
Sleeping
Primer commit...
Browse files
app.py
CHANGED
|
@@ -7,6 +7,42 @@ from tools.final_answer import FinalAnswerTool
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
+
# This system prompt is a bit more complex and actually contains the function description already appended.
|
| 11 |
+
# Here we suppose that the textual description of the tools has already been appended
|
| 12 |
+
SYSTEM_PROMPT = """Answer the following questions as best you can. You have access to the following tools:
|
| 13 |
+
|
| 14 |
+
get_weather: Get the current weather in a given location
|
| 15 |
+
|
| 16 |
+
The way you use the tools is by specifying a json blob.
|
| 17 |
+
Specifically, this json should have a `action` key (with the name of the tool to use) and a `action_input` key (with the input to the tool going here).
|
| 18 |
+
|
| 19 |
+
The only values that should be in the "action" field are:
|
| 20 |
+
get_weather: Get the current weather in a given location, args: {"location": {"type": "string"}}
|
| 21 |
+
example use :
|
| 22 |
+
```
|
| 23 |
+
{{
|
| 24 |
+
"action": "get_weather",
|
| 25 |
+
"action_input": {"location": "New York"}
|
| 26 |
+
}}
|
| 27 |
+
|
| 28 |
+
ALWAYS use the following format:
|
| 29 |
+
|
| 30 |
+
Question: the input question you must answer
|
| 31 |
+
Thought: you should always think about one action to take. Only one action at a time in this format:
|
| 32 |
+
Action:
|
| 33 |
+
```
|
| 34 |
+
$JSON_BLOB
|
| 35 |
+
```
|
| 36 |
+
Observation: the result of the action. This Observation is unique, complete, and the source of truth.
|
| 37 |
+
... (this Thought/Action/Observation can repeat N times, you should take several steps when needed. The $JSON_BLOB must be formatted as markdown and only use a SINGLE action at a time.)
|
| 38 |
+
|
| 39 |
+
You must always end your output with the following format:
|
| 40 |
+
|
| 41 |
+
Thought: I now know the final answer
|
| 42 |
+
Final Answer: the final answer to the original input question
|
| 43 |
+
|
| 44 |
+
Now begin! Reminder to ALWAYS use the exact characters `Final Answer:` when you provide a definitive answer. """
|
| 45 |
+
|
| 46 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 47 |
@tool
|
| 48 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|