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
PythonlangsmithutilsContextThreadPoolExecutormap
Method●Since v0.1

map

Copy
map(
  self,
  fn: Callable[..., T],
  *iterables: Iterable[Any
View source on GitHub
]
=
(
)
,
timeout
:
Optional
[
float
]
=
None
,
chunksize
:
int
=
1
)
->
Iterator
[
T
]

Parameters

NameTypeDescription
fn*Callable[..., T]

A callable that will take as many arguments as there are passed iterables.

timeoutOptional[float]
Default:None

The maximum number of seconds to wait. If None, then there is no limit on the wait time.

chunksizeint
Default:1

Return an iterator equivalent to stdlib map.

Each function will receive its own copy of the context from the parent thread.

The size of the chunks the iterable will be broken into before being passed to a child process. This argument is only used by ProcessPoolExecutor; it is ignored by ThreadPoolExecutor.