Hi guys,
I am new here,just had a doubt
This is my current code
agent = Agent(
model=Claude(id="anthropic.claude-3-5-sonnet-20240620-v1:0"),
storage=SqliteAgentStorage(
table_name="agent_sessions", db_file="tmp/agent_storage.db"
),
add_history_to_messages=True,
num_history_responses=3,
session_id=hash_string(f"{uid}{file_type}{db_path}"),
description=prompt,
tools=[
SQLTools(db_url=db_path),
CalculatorTools(
add=True,
subtract=True,
multiply=True,
divide=True,
exponentiate=True,
factorial=True,
is_prime=True,
square_root=True,
),
],
tool_hooks=[my_tool_hook],
instructions=[],
show_tool_calls=True,
debug_mode=True,
)
run_response: Iterator[RunResponse] = agent.run(query, stream=True)
response=""
for chunk in run_response:
print(
chunk.content, end="", flush=True
)
response += chunk.content
What I want is to get the current token and time this prompt
I found that
token_usage = {
"input_tokens": agent.session_metrics.input_tokens,
"output_tokens": agent.session_metrics.output_tokens,
"total_tokens": agent.session_metrics.total_tokens,
}
This works for the whole session but I need value for this prompt alone.
And is there any good ai like chatgpt,claude…
that know agno very well,most doesn’t know the context very well