Skip to content

Conversation

@dsfaccini
Copy link
Contributor

@dsfaccini dsfaccini commented Nov 30, 2025

Closes #1996

This is an attempt at adding a timestamp field directly on ModelRequest. This PR also overrides the timestamp in ModelResponse that is set to the value returned by the provider (created or created_at in most cases).

Previously, only the response got a timestamp. The request's timestamp was set by the first part. The problem main with this approach is that some providers, like openai, return unix time (seconds passed since unix epoch), which for very fast requests can mean (as far as the user sees), that the response's timestamp is earlier that the request's.

Thus for absolute certainty that this is not the case, this PR sets both timestamps locally. The provider's timestamp is still stored in the models, in the response's provider_details['timestamp'].

Many tests needed adjusting because the timestamp field now becomes part of every snapshot. If this is undesired we could set the timestamp to be a private field in the model? I don't know exactly how that would go but there must be a way :).

Note: I see one commit from #3592 snuck into here, will be irrelevant when that merges.

dsfaccini and others added 10 commits November 28, 2025 12:42
Clarify that agents can be produced by a factory function if preferred.
The ModelRequest snapshots for Google/Vertex URL input tests were missing
the timestamp field that was added in the parent commit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
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.

Access ModelRequest-ModelResponse timestamps and duration as fields

1 participant