LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
Pythonlangsmith_openapi_client_filesdeepcopy_with_paths
Function●Since v0.8

deepcopy_with_paths

Copy
deepcopy_with_paths(
    item: _T,
    paths: Sequence[Sequence[str]],
) -> _T
View source on GitHub

Copy only the containers along the given paths.

Used to guard against mutation by extract_files without copying the entire structure. Only dicts and lists that lie on a path are copied; everything else is returned by reference.

For example, given paths=[["foo", "files", "file"]] and the structure: { "foo": { "bar": {"baz": {}}, "files": {"file": } } } The root dict, "foo", and "files" are copied (they lie on the path). "bar" and "baz" are returned by reference (off the path).