OptionalimportAdditional import map for the "langchain" namespace.
Security warning: This extends which classes can be instantiated during deserialization. Never populate this map with values derived from user input. Only include modules that you explicitly trust and have reviewed.
Any class exposed through this map can be instantiated with attacker-controlled kwargs if the serialized data is untrusted.
OptionalmaxMaximum recursion depth allowed during deserialization.
OptionaloptionalAdditional optional import entrypoints to allow beyond the defaults.
OptionaloptionalA map of optional imports. Keys are namespace paths (e.g., "langchain_community/llms"), values are the imported modules.
Security warning: This extends which classes can be instantiated during deserialization. Never populate this map with values derived from user input. Only include modules that you explicitly trust and have reviewed.
Classes in these modules can be instantiated with attacker-controlled kwargs if the serialized data is untrusted.
OptionalsecretsWhether to load secrets from environment variables when not found in secretsMap.
OptionalsecretsA map of secrets to load. Keys are secret identifiers, values are the secret values.
If a secret is not found in this map and secretsFromEnv is false, an error is
thrown. If secretsFromEnv is true, the secret will be loaded from environment
variables (if not found there either, an error is thrown).
Options for loading serialized LangChain objects.
Remarks
Security considerations:
Deserialization can instantiate arbitrary classes from the allowed namespaces. When loading untrusted data, be aware that:
secretsFromEnv: Defaults tofalse. Setting totrueallows the deserializer to read environment variables, which could leak secrets if the serialized data contains malicious secret references.importMap/optionalImportsMap: These allow extending which classes can be instantiated. Never populate these from user input. Only include modules you explicitly trust.Class instantiation: Allowed classes will have their constructors called with the deserialized kwargs. If a class performs side effects in its constructor (network calls, file I/O, etc.), those will execute.