mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 09:05:23 -04:00
Support Metrics #70
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @slyt on GitHub (Apr 19, 2024).
The Ollama API has a Metrics object that appears to be returned with both the ChatResponse and GenerateResponse.
I can't find a way to get these metrics using a client with ollama-python. Is it supported?
I would expect something like this to work:
currently, the above code outputs:
metrics: {}@slyt commented on GitHub (Apr 19, 2024):
Here's an example of parsing the metrics from the API
This works for streaming and non-streaming responses.
Output is:
{'total_duration': 8037858768, 'load_duration': 207136, 'prompt_eval_duration': 235696000, 'eval_count': 464, 'eval_duration': 7801437000}@mxyng commented on GitHub (Apr 24, 2024):
metrics are returned in the top level JSON object. here's the equivalent using the client