Spaces:
Sleeping
Sleeping
Luigi D'Addona
commited on
Commit
·
cd0253f
1
Parent(s):
e8e4ce5
modificate istruzioni generali dell'agent
Browse files
agent.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
| 2 |
from dotenv import load_dotenv
|
| 3 |
import traceback
|
| 4 |
import time
|
|
|
|
| 5 |
|
| 6 |
from typing import Annotated,Sequence, TypedDict
|
| 7 |
|
|
@@ -28,13 +29,13 @@ GEMINI_TEMPERATURE = float(os.environ.get("GEMINI_TEMPERATURE"))
|
|
| 28 |
TOOLS_CALL_DELAY = 1.5
|
| 29 |
|
| 30 |
# V1
|
| 31 |
-
GENERAL_AGENT_INSTRUCTIONS = """You are a helpful assistant tasked with answering questions using a set of tools.
|
| 32 |
-
Now, I will ask you a question. Analyze the question and provide your answer.
|
| 33 |
-
Your answer should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
|
| 34 |
-
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.
|
| 35 |
-
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.
|
| 36 |
-
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.
|
| 37 |
-
Provide only the answer, without notes, explanations or comments."""
|
| 38 |
|
| 39 |
# V2
|
| 40 |
# GENERAL_AGENT_INSTRUCTIONS = """
|
|
@@ -78,15 +79,17 @@ Provide only the answer, without notes, explanations or comments."""
|
|
| 78 |
# Provide only the answer, without notes, explanations or comments."""
|
| 79 |
|
| 80 |
# V5
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
|
|
|
|
|
|
| 90 |
|
| 91 |
#
|
| 92 |
# Inizializza il modello e gli associa i tool
|
|
@@ -121,6 +124,10 @@ chat_with_tools = chat.bind_tools(tools)
|
|
| 121 |
|
| 122 |
tools_by_name = {tool.name: tool for tool in tools}
|
| 123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
#
|
| 126 |
# Definisce il grafo
|
|
|
|
| 2 |
from dotenv import load_dotenv
|
| 3 |
import traceback
|
| 4 |
import time
|
| 5 |
+
import pprint
|
| 6 |
|
| 7 |
from typing import Annotated,Sequence, TypedDict
|
| 8 |
|
|
|
|
| 29 |
TOOLS_CALL_DELAY = 1.5
|
| 30 |
|
| 31 |
# V1
|
| 32 |
+
# GENERAL_AGENT_INSTRUCTIONS = """You are a helpful assistant tasked with answering questions using a set of tools.
|
| 33 |
+
# Now, I will ask you a question. Analyze the question and provide your answer.
|
| 34 |
+
# Your answer should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
|
| 35 |
+
# 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.
|
| 36 |
+
# 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.
|
| 37 |
+
# 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.
|
| 38 |
+
# Provide only the answer, without notes, explanations or comments."""
|
| 39 |
|
| 40 |
# V2
|
| 41 |
# GENERAL_AGENT_INSTRUCTIONS = """
|
|
|
|
| 79 |
# Provide only the answer, without notes, explanations or comments."""
|
| 80 |
|
| 81 |
# V5
|
| 82 |
+
GENERAL_AGENT_INSTRUCTIONS = """
|
| 83 |
+
You are a general AI assistant. Your purpose is to answer questions and complete tasks accurately and concisely.
|
| 84 |
+
You have access to various tools to help you gather information and perform actions.
|
| 85 |
+
Always prioritize using your tools to find factual information if a question requires it.
|
| 86 |
+
If the question mentions Wikpedia, use the wikpedia tool; if the question mentions a youtube url, use get_youtube_transcript tool.
|
| 87 |
+
Analyze the question and plan the necessary steps to get the answer.
|
| 88 |
+
Your answer should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
|
| 89 |
+
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.
|
| 90 |
+
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.
|
| 91 |
+
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.
|
| 92 |
+
Provide only the answer, without notes, explanations or comments."""
|
| 93 |
|
| 94 |
#
|
| 95 |
# Inizializza il modello e gli associa i tool
|
|
|
|
| 124 |
|
| 125 |
tools_by_name = {tool.name: tool for tool in tools}
|
| 126 |
|
| 127 |
+
# debug
|
| 128 |
+
print("Tools:")
|
| 129 |
+
for tool in tools:
|
| 130 |
+
print(" {}".format(tool.name))
|
| 131 |
|
| 132 |
#
|
| 133 |
# Definisce il grafo
|