model_post_init(
self,
_context: Any,
,
) -> None| Name | Type | Description |
|---|---|---|
_context* | Any | Pydantic validation context (typically |
Pydantic V2 lifecycle hook called automatically after __init__.
Seeds metadata["lc_versions"] with the installed langchain-core
(and langchain, if installed) versions so that every LLM trace
carries the package versions that produced it.
Partner packages should not override this method. Instead, they
should define a @model_validator(mode="after") that calls
_add_version to append their own version to the same dict.
Each subclass's validator must have a unique name. Pydantic
replaces — rather than chains — same-named model_validator methods
in child classes. For example, a BaseChatOpenAI subclass should
use _set_<partner>_version, not _set_version, to avoid silently
dropping the parent's entry.