Skip to content

models - add missing latency metrics#821

Closed
pgrayy wants to merge 4 commits intostrands-agents:mainfrom
pgrayy:latency
Closed

models - add missing latency metrics#821
pgrayy wants to merge 4 commits intostrands-agents:mainfrom
pgrayy:latency

Conversation

@pgrayy
Copy link
Copy Markdown
Member

@pgrayy pgrayy commented Sep 8, 2025

Description

Calculate missing latencyMs metrics across model providers.

Related Issues

N/A

Documentation PR

N/A

Type of Change

New feature

Testing

How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

  • I ran hatch run prepare: Updated unit tests

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -3,6 +3,7 @@
import json
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SageMaker requires OpenAI compatible payloads hence no latency field.

@@ -7,6 +7,7 @@
import json
import logging
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, the underlying clients in each of these model providers do not provide a latency metric in their usage payloads:

Consequently, we calculate the latency ourselves with time.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we ensure we add proper documentation for those providers?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also ensure that there are comments in code indicating this "why"

Copy link
Copy Markdown
Member Author

@pgrayy pgrayy Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I could create an Overview section under the Model Providers user guide. I think that would be a good place for outlining what usage metrics are available (among other things).
  • I'll add some comments.

@pgrayy pgrayy marked this pull request as ready for review September 8, 2025 20:57
@@ -7,6 +7,7 @@
import json
import logging
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we ensure we add proper documentation for those providers?

@@ -7,6 +7,7 @@
import json
import logging
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also ensure that there are comments in code indicating this "why"

@pgrayy pgrayy marked this pull request as draft September 9, 2025 17:18
@pgrayy pgrayy closed this Oct 2, 2025
@pgrayy pgrayy deleted the latency branch October 2, 2025 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants