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
  • RemoteGraph
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDKRemoteGraph
Language
Theme
PythonlangsmithutilsContextThreadPoolExecutormap
Method●Since v0.1

map

Return an iterator equivalent to stdlib map.

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

Copy
map(
  self,
  fn: Callable[..., T],
  *iterables: Iterable[Any] = (),
  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

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.

View source on GitHub