Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /agno-agi_agno /cookbook /90_models /litellm /metrics.py
| """ | |
| Litellm Metrics | |
| =============== | |
| Cookbook example for `litellm/metrics.py`. | |
| """ | |
| from agno.agent import Agent, RunOutput | |
| from agno.models.litellm import LiteLLM | |
| from agno.tools.yfinance import YFinanceTools | |
| from agno.utils.pprint import pprint_run_response | |
| from rich.pretty import pprint | |
| # --------------------------------------------------------------------------- | |
| # Create Agent | |
| # --------------------------------------------------------------------------- | |
| agent = Agent( | |
| model=LiteLLM( | |
| id="gpt-5.6-luna", | |
| ), | |
| tools=[YFinanceTools()], | |
| markdown=True, | |
| ) | |
| run_output: RunOutput = agent.run("What is the stock price of NVDA") | |
| pprint_run_response(run_output, markdown=True) | |
| # Print metrics per message | |
| if run_output.messages: | |
| for message in run_output.messages: | |
| if message.role == "assistant": | |
| if message.content: | |
| print(f"Message: {message.content}") | |
| elif message.tool_calls: | |
| print(f"Tool calls: {message.tool_calls}") | |
| print("---" * 5, "Metrics", "---" * 5) | |
| pprint(message.metrics) | |
| print("---" * 20) | |
| # Print the metrics | |
| print("---" * 5, "Collected Metrics", "---" * 5) | |
| pprint(run_output.metrics) # type: ignore | |
| # --------------------------------------------------------------------------- | |
| # Run Agent | |
| # --------------------------------------------------------------------------- | |
| if __name__ == "__main__": | |
| pass | |
Xet Storage Details
- Size:
- 1.45 kB
- Xet hash:
- c7b8323cc11e147b0cd1cc9548add6a7eebf74cee8e2f85bae9cf27753084f73
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.