Skip to main content
This example reads agent.run_response.messages, but Agent does not expose that attribute. Update the saved file before running.
metrics.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export your Meta Llama API key

4

Correct the message metrics loop

Replace agent.run_response.messages with run_response.messages in the saved file.
5

Run the example

Save the code above as metrics.py, then run:
Full source: cookbook/90_models/meta/llama_openai/metrics.py