Copy config while preserving nested model instances and subclasses. Important: Avoid reconstructing via `model_dump` as that coerces nested models to their annotated base types (dropping subclass-only fields). Instead, defer to Pydantic's native `model_copy`, which
(
self, *, update: Mapping[str, Any] | None = None, deep: bool = False
)
| 324 | model_config = SettingsConfigDict(env_prefix="OPENAI_") |
| 325 | |
| 326 | def model_copy( |
| 327 | self, *, update: Mapping[str, Any] | None = None, deep: bool = False |
| 328 | ) -> "OpenAIGPTConfig": |
| 329 | """ |
| 330 | Copy config while preserving nested model instances and subclasses. |
| 331 | |
| 332 | Important: Avoid reconstructing via `model_dump` as that coerces nested |
| 333 | models to their annotated base types (dropping subclass-only fields). |
| 334 | Instead, defer to Pydantic's native `model_copy`, which keeps nested |
| 335 | `BaseModel` instances (and their concrete subclasses) intact. |
| 336 | """ |
| 337 | # Delegate to BaseSettings/BaseModel implementation to preserve types |
| 338 | return super().model_copy(update=update, deep=deep) # type: ignore[return-value] |
| 339 | |
| 340 | def _validate_litellm(self) -> None: |
| 341 | """ |
no outgoing calls