Skip to content

Conversation

@mattbrandman
Copy link
Contributor

@mattbrandman mattbrandman commented Dec 4, 2025

  • Store and resends the container id on the modelresponse.provider_details.
  • Always goes by the most recent container id
  • Introduces a setting on modelprofile to force a new container (this is relevant for resetting and handling expiring containers)

solves containerid part of #3365.

@mattbrandman mattbrandman force-pushed the container-id branch 3 times, most recently from 4cc56e5 to b713ad3 Compare December 4, 2025 03:17
@mattbrandman
Copy link
Contributor Author

@DouweM for review whenever you have time

@mattbrandman mattbrandman marked this pull request as ready for review December 4, 2025 03:48
@mattbrandman
Copy link
Contributor Author

@DouweM updated

@mattbrandman mattbrandman requested a review from DouweM December 5, 2025 16:38
self._usage = _map_usage(event, self._provider_name, self._provider_url, self._model_name, self._usage)
if raw_finish_reason := event.delta.stop_reason: # pragma: no branch
self.provider_details = {'finish_reason': raw_finish_reason}
self.provider_details = {**(self.provider_details or {}), 'finish_reason': raw_finish_reason}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the 2-line way we do it on line 1158 slightly better

By default, if previous messages contain a container_id (from a prior response),
it will be reused automatically.
Set to `False` to force a fresh container (ignore any container_id from history).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Set to `False` to force a fresh container (ignore any container_id from history).
Set to `False` to force a fresh container (ignore any `container_id` from history).

@DouweM DouweM changed the title pass container id back Pass container_id back to Anthropic API Dec 9, 2025
@mattbrandman
Copy link
Contributor Author

@DouweM updated

@DouweM DouweM merged commit a1a514e into pydantic:main Dec 9, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants