Spaces:
Runtime error
Runtime error
Rob Blanford
commited on
Commit
·
b50d9e7
1
Parent(s):
81917a3
Notes and template tools file
Browse files- agent_tools.py +41 -0
- notes_tools_needed.txt +11 -0
agent_tools.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#mp3 transcription
|
| 2 |
+
|
| 3 |
+
#python code running
|
| 4 |
+
|
| 5 |
+
#chess analysis
|
| 6 |
+
|
| 7 |
+
from smolagents import AzureOpenAIServerModel, CodeAgent, ToolCallingAgent, tool, load_tool, DuckDuckGoSearchTool, WikipediaSearchTool
|
| 8 |
+
import os
|
| 9 |
+
from dotenv import load_dotenv
|
| 10 |
+
|
| 11 |
+
load_dotenv()
|
| 12 |
+
|
| 13 |
+
model = AzureOpenAIServerModel(
|
| 14 |
+
model_id = os.environ.get("AZURE_OPENAI_MODEL"),
|
| 15 |
+
azure_endpoint=os.environ.get("AZURE_OPENAI_ENDPOINT"),
|
| 16 |
+
api_key=os.environ.get("AZURE_OPENAI_API_KEY"),
|
| 17 |
+
api_version=os.environ.get("OPENAI_API_VERSION"),
|
| 18 |
+
max_tokens=4096
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
@tool
|
| 22 |
+
def intuition() -> dict:
|
| 23 |
+
"""This tool provides suggestions (intuition) on which tools to use or approaches based on the task being attempted.
|
| 24 |
+
It returns a dict where the keys are tasks and values are intuition.
|
| 25 |
+
When you have a task step which includes one of the topics, get the dictionary value from this tool which contains information so you can make better decisions.
|
| 26 |
+
Intuition does not change during a run, do not rerun if the intuition is known.
|
| 27 |
+
Args:
|
| 28 |
+
None
|
| 29 |
+
"""
|
| 30 |
+
suggestions = {'search':'A web search is most efficient for finding individual facts. Wikipedia is better for in-depth information on a topic.'}
|
| 31 |
+
return suggestions
|
| 32 |
+
|
| 33 |
+
agent = CodeAgent(model=model, tools=[DuckDuckGoSearchTool(), WikipediaSearchTool(), intuition], planning_interval=1)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
# Query
|
| 37 |
+
query = "How long would a cheetah at full speed take to run the length of Pont Alexandre III?"
|
| 38 |
+
# Run it!
|
| 39 |
+
result = agent.run(query + f"\nIf any intuition topics are relevant, look up the intuition before proceeding with the step. \nIntuition topics available: {str(list(intuition().keys()))}")
|
| 40 |
+
|
| 41 |
+
|
notes_tools_needed.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Websearch
|
| 2 |
+
imdb search? (Polish Everybody Loves Raymond)
|
| 3 |
+
Wikisearch
|
| 4 |
+
Video query - highest number of birds on camera
|
| 5 |
+
Prompt parse - reverse if necessary
|
| 6 |
+
Image query - chess board
|
| 7 |
+
Video query - look at transcript
|
| 8 |
+
mp3 transcription
|
| 9 |
+
python code runner
|
| 10 |
+
document converter? Read pdfs
|
| 11 |
+
Read Excel
|