Replies: 2 comments 1 reply
-
Hello @gafda ! The tools that you define are a part of the input tokens. I'd recommend you to try: https://docs.agno.com/tools/toolkits/calculator. In my testing, the token usage is not as high - but that of course depends upon your query and Agent instructions. Additionally, token usage is highly dependent upon whether or not your provide the Agent with chat history by setting: |
Beta Was this translation helpful? Give feedback.
-
First of all, thank you for the rapid response! I was trying to understand the bare minimum to create tools. So a few important notes that I've learned and I think should be highlighted in the Tools documentation as part of the quick starting guide:
ie.: class ToolsClass:
@staticmethod
def get_current_date() -> str:
"""Useful function to get the current date in the format "YYYY-MM-DD".
Returns:
str: The current date in the format "YYYY-MM-DD".
"""
response = datetime.now(timezone.utc).strftime("%Y-%m-%d")
return json.dumps({"operation": "current date", "result": response})
return json.dumps({"operation": "current date", "result": response}) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all! I'm trying to learn how to create my very own tools using math methods. The objective is to use either
requests
orhttpx
to do custom API calls, but for now I'm using simple math to figure out how Agno works.That said, I've created a class with basic math methods and an agent that is able to call it.
What I've observed is that it spends a bunch of tokens for a simple math call.
Why is that?
Below you can see that a simple prompt of
2 times 10
uses almost 1000 tokens!Using:
Math calls:
generic_calls.py
Abstract BaseAgent:
base_agent.py
Agent:
my_agent.py
Beta Was this translation helpful? Give feedback.
All reactions