The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
docs(core): expanded `get_lc_namespace` docstring (#35229)
Mason Daugherty1573757b3bf5
diff --git a/libs/core/langchain_core/load/serializable.py b/libs/core/langchain_core/load/serializable.pyindex b447ddfc8b..429a5e8f88 100644--- a/libs/core/langchain_core/load/serializable.py+++ b/libs/core/langchain_core/load/serializable.py@@ -134,9 +134,22 @@ class Serializable(BaseModel, ABC):def get_lc_namespace(cls) -> list[str]:"""Get the namespace of the LangChain object.- For example, if the class is- [`langchain.llms.openai.OpenAI`][langchain_openai.OpenAI], then the namespace is- `["langchain", "llms", "openai"]`+ The default implementation splits `cls.__module__` on `'.'`, e.g.+ `langchain_openai.chat_models` becomes+ `["langchain_openai", "chat_models"]`. This value is used by `lc_id` to+ build the serialization identifier.++ New partner packages should **not** override this method. The default+ behavior is correct for any class whose module path already reflects+ its package name. Some older packages (e.g. `langchain-openai`,+ `langchain-anthropic`) override it to return a legacy-style namespace+ like `["langchain", "chat_models", "openai"]`, matching the module+ paths that existed before those integrations were split out of the+ main `langchain` package. Those overrides are kept for+ backwards-compatible deserialization; new packages should not copy them.++ Deserialization mapping is handled separately by+ `SERIALIZABLE_MAPPING` in `langchain_core.load.mapping`.Returns:The namespace.