id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
9646e64f2988-1
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names:...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableEachBase.html
9646e64f2988-2
e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel]¶ The type of config this runnable accepts specified as a pydantic m...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableEachBase.html
9646e64f2988-3
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, i...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableEachBase.html
9646e64f2988-4
Get a pydantic model that can be used to validate output to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific co...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableEachBase.html
9646e64f2988-5
classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with e...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableEachBase.html
9646e64f2988-6
classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶ Bind config to a Runnable, returning a new Runna...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableEachBase.html
9646e64f2988-7
added to the run. with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_after_attempt: int = 3) → Runnable[Input, Output]¶ Create a new Runnable that retries the original runnable on exceptions. Parameters retry_if_exc...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableEachBase.html
9646e64f2988-8
property output_schema: Type[pydantic.main.BaseModel]¶ The type of output this runnable produces specified as a pydantic model.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableEachBase.html
4602039af77a-0
langchain.schema.runnable.utils.ConfigurableFieldMultiOption¶ class langchain.schema.runnable.utils.ConfigurableFieldMultiOption(id: str, options: Mapping[str, Any], default: Sequence[str], name: Optional[str] = None, description: Optional[str] = None)[source]¶ A field that can be configured by the user with multiple d...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.ConfigurableFieldMultiOption.html
4f2de06f41a8-0
langchain.schema.runnable.base.RunnableMap¶ langchain.schema.runnable.base.RunnableMap¶ alias of RunnableParallel Examples using RunnableMap¶ OpaquePrompts interface.md First we add a step to load memory sql_db.md prompt_llm_parser.md Adding memory multiple_chains.md
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableMap.html
cd70f86f1fb4-0
langchain.schema.runnable.utils.add¶ langchain.schema.runnable.utils.add(addables: Iterable[Addable]) → Optional[Addable][source]¶ Add a sequence of addable objects together.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.add.html
fffedd21bda9-0
langchain.schema.runnable.utils.accepts_config¶ langchain.schema.runnable.utils.accepts_config(callable: Callable[[...], Any]) → bool[source]¶ Check if a callable accepts a config argument.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.accepts_config.html
029018aa1e16-0
langchain.schema.runnable.base.RunnableBinding¶ class langchain.schema.runnable.base.RunnableBinding[source]¶ Bases: RunnableBindingBase[Input, Output] A runnable that delegates calls to another runnable with a set of kwargs. Create a new model by parsing and validating input data from keyword arguments. Raises Validat...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBinding.html
029018aa1e16-1
Subclasses should override this method if they can run asynchronously. async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of astream, which calls ainvoke. Subclasses should override this method if they support streaming output. a...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBinding.html
029018aa1e16-2
Default implementation runs invoke in parallel using a thread pool executor. The default implementation of batch works well for IO bound runnables. Subclasses should override this method if they can batch more efficiently; e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → R...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBinding.html
029018aa1e16-3
Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creat...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBinding.html
029018aa1e16-4
namespace is [“langchain”, “llms”, “openai”] get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶ Get a pydantic model that can be used to validate output to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output schema tha...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBinding.html
029018aa1e16-5
Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a ...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBinding.html
029018aa1e16-6
Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing output while input is still being generated. classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and lo...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBinding.html
029018aa1e16-7
added to the run. with_retry(**kwargs: Any) → Runnable[Input, Output][source]¶ Create a new Runnable that retries the original runnable on exceptions. Parameters retry_if_exception_type – A tuple of exception types to retry on wait_exponential_jitter – Whether to add jitter to the wait time between retries stop_after_a...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBinding.html
2348ef284f1f-0
langchain.schema.runnable.passthrough.RunnablePassthrough¶ class langchain.schema.runnable.passthrough.RunnablePassthrough[source]¶ Bases: RunnableSerializable[Other, Other] A runnable to passthrough inputs unchanged or with additional keys. This runnable behaves almost like the identity function, except that it can be...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.passthrough.RunnablePassthrough.html
2348ef284f1f-1
} | RunnablePassthrough.assign( total_chars=lambda inputs: len(inputs['llm1'] + inputs['llm2']) ) runnable.invoke('hello') # {'llm1': 'completion', 'llm2': 'completion', 'total_chars': 20} Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cann...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.passthrough.RunnablePassthrough.html
2348ef284f1f-2
the runnable did not implement a native async version of invoke. Subclasses should override this method if they can run asynchronously. classmethod assign(**kwargs: Union[Runnable[Dict[str, Any], Any], Callable[[Dict[str, Any]], Any], Mapping[str, Union[Runnable[Dict[str, Any], Any], Callable[[Dict[str, Any]], Any]]]])...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.passthrough.RunnablePassthrough.html
2348ef284f1f-3
The jsonpatch ops can be applied in order to construct state. async atransform(input: AsyncIterator[Other], config: Optional[RunnableConfig] = None, **kwargs: Any) → AsyncIterator[Other][source]¶ Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they ...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.passthrough.RunnablePassthrough.html
2348ef284f1f-4
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.passthrough.RunnablePassthrough.html
2348ef284f1f-5
Get a pydantic model that can be used to validate input to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic input schema that depends on which configuration the runnable is invoked with. This method allows to get an input schema for a specific confi...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.passthrough.RunnablePassthrough.html
2348ef284f1f-6
for more details. Returns The output of the runnable. classmethod is_lc_serializable() → bool[source]¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Op...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.passthrough.RunnablePassthrough.html
2348ef284f1f-7
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Other, config: Optional[RunnableConfig] = None, **kwargs: Any) → Iterator[Other][source]¶ Default implementation of stream, which calls invoke. Subclasses should override this...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.passthrough.RunnablePassthrough.html
2348ef284f1f-8
fallback in order, upon failures. with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → Runnable[Input, Output]¶ Bind lifecycle listeners to a Runnable, returning a new Runnable. on_start: Called before the runnable starts running, with the Run ...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.passthrough.RunnablePassthrough.html
2348ef284f1f-9
The type of output this runnable produces specified as a type annotation. property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶ List configurable fields for this runnable. property input_schema: Type[pydantic.main.BaseModel]¶ The type of input this runnable accepts specified as a pydantic ...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.passthrough.RunnablePassthrough.html
4f58b02b6896-0
langchain.schema.runnable.utils.get_lambda_source¶ langchain.schema.runnable.utils.get_lambda_source(func: Callable) → Optional[str][source]¶ Get the source code of a lambda function. Parameters func – a callable that can be a lambda function Returns the source code of the lambda function Return type str
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.get_lambda_source.html
98c4e34752c6-0
langchain.schema.runnable.branch.RunnableBranch¶ class langchain.schema.runnable.branch.RunnableBranch[source]¶ Bases: RunnableSerializable[Input, Output] A Runnable that selects which branch to run based on a condition. The runnable is initialized with a list of (condition, runnable) pairs and a default branch. When o...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.branch.RunnableBranch.html
98c4e34752c6-1
The default implementation of batch works well for IO bound runnables. Subclasses should override this method if they can batch more efficiently; e.g., if the underlying runnable uses an API which supports a batch mode. async ainvoke(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Any) → Output[source]...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.branch.RunnableBranch.html
98c4e34752c6-2
Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they can start producing output while input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.branch.RunnableBranch.html
98c4e34752c6-3
Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.branch.RunnableBranch.html
98c4e34752c6-4
This method allows to get an input schema for a specific configuration. Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate input. classmethod get_lc_namespace() → List[str][source]¶ The namespace of a RunnableBranch is the namespace of its default branc...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.branch.RunnableBranch.html
98c4e34752c6-5
Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a ...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.branch.RunnableBranch.html
98c4e34752c6-6
Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing output while input is still being generated. classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and lo...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.branch.RunnableBranch.html
98c4e34752c6-7
added to the run. with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_after_attempt: int = 3) → Runnable[Input, Output]¶ Create a new Runnable that retries the original runnable on exceptions. Parameters retry_if_exc...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.branch.RunnableBranch.html
98c4e34752c6-8
property output_schema: Type[pydantic.main.BaseModel]¶ The type of output this runnable produces specified as a pydantic model.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.branch.RunnableBranch.html
e0a9fa0ddf71-0
langchain.schema.runnable.config.get_async_callback_manager_for_config¶ langchain.schema.runnable.config.get_async_callback_manager_for_config(config: RunnableConfig) → AsyncCallbackManager[source]¶ Get an async callback manager for a config. Parameters config (RunnableConfig) – The config. Returns The async callback m...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.config.get_async_callback_manager_for_config.html
78d1eb0e0e44-0
langchain.schema.runnable.router.RouterRunnable¶ class langchain.schema.runnable.router.RouterRunnable[source]¶ Bases: RunnableSerializable[RouterInput, Output] A runnable that routes to a set of runnables based on Input[‘key’]. Returns the output of the selected runnable. Create a new model by parsing and validating i...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.router.RouterRunnable.html
78d1eb0e0e44-1
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names:...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.router.RouterRunnable.html
78d1eb0e0e44-2
e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel]¶ The type of config this runnable accepts specified as a pydantic m...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.router.RouterRunnable.html
78d1eb0e0e44-3
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, i...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.router.RouterRunnable.html
78d1eb0e0e44-4
Get a pydantic model that can be used to validate output to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific co...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.router.RouterRunnable.html
78d1eb0e0e44-5
classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with e...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.router.RouterRunnable.html
78d1eb0e0e44-6
classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶ Bind config to a Runnable, returning a new Runna...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.router.RouterRunnable.html
78d1eb0e0e44-7
added to the run. with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_after_attempt: int = 3) → Runnable[Input, Output]¶ Create a new Runnable that retries the original runnable on exceptions. Parameters retry_if_exc...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.router.RouterRunnable.html
78d1eb0e0e44-8
property output_schema: Type[pydantic.main.BaseModel]¶ The type of output this runnable produces specified as a pydantic model.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.router.RouterRunnable.html
209ce5bce599-0
langchain.schema.runnable.utils.accepts_run_manager¶ langchain.schema.runnable.utils.accepts_run_manager(callable: Callable[[...], Any]) → bool[source]¶ Check if a callable accepts a run_manager argument.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.accepts_run_manager.html
e5b79e685719-0
langchain.schema.runnable.utils.AddableDict¶ class langchain.schema.runnable.utils.AddableDict[source]¶ Dictionary that can be added to another dictionary. Methods __init__(*args, **kwargs) clear() copy() fromkeys([value]) Create a new dictionary with keys from iterable and values set to value. get(key[, default]) Retu...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.AddableDict.html
e5b79e685719-1
pop(k[, d]) → v, remove specified key and return the corresponding value.¶ If the key is not found, return the default if given; otherwise, raise a KeyError. popitem()¶ Remove and return a (key, value) pair as a 2-tuple. Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty. setdef...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.AddableDict.html
ae523e2c1227-0
langchain.schema.runnable.config.get_executor_for_config¶ langchain.schema.runnable.config.get_executor_for_config(config: RunnableConfig) → Generator[Executor, None, None][source]¶ Get an executor for a config. Parameters config (RunnableConfig) – The config. Yields Generator[Executor, None, None] – The executor.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.config.get_executor_for_config.html
9d8ab9ab6bcc-0
langchain.schema.runnable.utils.get_unique_config_specs¶ langchain.schema.runnable.utils.get_unique_config_specs(specs: Iterable[ConfigurableFieldSpec]) → List[ConfigurableFieldSpec][source]¶ Get the unique config specs from a sequence of config specs.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.get_unique_config_specs.html
eccc42578bab-0
langchain.schema.runnable.config.call_func_with_variable_args¶ langchain.schema.runnable.config.call_func_with_variable_args(func: Union[Callable[[Input], Output], Callable[[Input, RunnableConfig], Output], Callable[[Input, CallbackManagerForChainRun], Output], Callable[[Input, CallbackManagerForChainRun, RunnableConfi...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.config.call_func_with_variable_args.html
730b6b21598f-0
langchain.schema.runnable.router.RouterInput¶ class langchain.schema.runnable.router.RouterInput[source]¶ A Router input. key¶ The key to route on. Type str input¶ The input to pass to the selected runnable. Type Any Attributes key input Methods __init__(*args, **kwargs) clear() copy() fromkeys([value]) Create a new di...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.router.RouterInput.html
730b6b21598f-1
items() → a set-like object providing a view on D's items¶ keys() → a set-like object providing a view on D's keys¶ pop(k[, d]) → v, remove specified key and return the corresponding value.¶ If the key is not found, return the default if given; otherwise, raise a KeyError. popitem()¶ Remove and return a (key, value) pa...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.router.RouterInput.html
37a49ed65bff-0
langchain.schema.runnable.utils.IsFunctionArgDict¶ class langchain.schema.runnable.utils.IsFunctionArgDict[source]¶ Check if the first argument of a function is a dict. Methods __init__() generic_visit(node) Called if no explicit visitor function exists for a node. visit(node) Visit a node. visit_AsyncFunctionDef(node)...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.IsFunctionArgDict.html
51221e85b704-0
langchain.schema.runnable.base.RunnableParallel¶ class langchain.schema.runnable.base.RunnableParallel[source]¶ Bases: RunnableSerializable[Input, Dict[str, Any]] A runnable that runs a mapping of runnables in parallel, and returns a mapping of their outputs. Create a new model by parsing and validating input data from...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableParallel.html
51221e85b704-1
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names:...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableParallel.html
51221e85b704-2
e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel]¶ The type of config this runnable accepts specified as a pydantic m...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableParallel.html
51221e85b704-3
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, i...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableParallel.html
51221e85b704-4
Get a pydantic model that can be used to validate output to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific co...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableParallel.html
51221e85b704-5
classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with e...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableParallel.html
51221e85b704-6
input is still being generated. classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶ Bind config to a...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableParallel.html
51221e85b704-7
added to the run. with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_after_attempt: int = 3) → Runnable[Input, Output]¶ Create a new Runnable that retries the original runnable on exceptions. Parameters retry_if_exc...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableParallel.html
51221e85b704-8
property output_schema: Type[pydantic.main.BaseModel]¶ The type of output this runnable produces specified as a pydantic model.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableParallel.html
b931c2f226bc-0
langchain.schema.runnable.utils.gather_with_concurrency¶ async langchain.schema.runnable.utils.gather_with_concurrency(n: Optional[int], *coros: Coroutine) → list[source]¶ Gather coroutines with a limit on the number of concurrent coroutines.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.gather_with_concurrency.html
f111087d901a-0
langchain.schema.runnable.utils.ConfigurableFieldSpec¶ class langchain.schema.runnable.utils.ConfigurableFieldSpec(id: str, name: Optional[str], description: Optional[str], default: Any, annotation: Any)[source]¶ A field that can be configured by the user. It is a specification of a field. Create new instance of Config...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.ConfigurableFieldSpec.html
3c917ad0c02d-0
langchain.schema.runnable.fallbacks.RunnableWithFallbacks¶ class langchain.schema.runnable.fallbacks.RunnableWithFallbacks[source]¶ Bases: RunnableSerializable[Input, Output] A Runnable that can fallback to other Runnables if it fails. External APIs (e.g., APIs for a language model) may at times experience degraded per...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.fallbacks.RunnableWithFallbacks.html
3c917ad0c02d-1
PromptTemplate.from_template('Tell me a joke about {topic}') | model | StrOutputParser() ).with_fallbacks([RunnableLambda(when_all_is_lost)]) Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form a valid model. param exc...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.fallbacks.RunnableWithFallbacks.html
3c917ad0c02d-2
Subclasses should override this method if they can run asynchronously. async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of astream, which calls ainvoke. Subclasses should override this method if they support streaming output. a...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.fallbacks.RunnableWithFallbacks.html
3c917ad0c02d-3
Default implementation runs invoke in parallel using a thread pool executor. The default implementation of batch works well for IO bound runnables. Subclasses should override this method if they can batch more efficiently; e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → R...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.fallbacks.RunnableWithFallbacks.html
3c917ad0c02d-4
Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creat...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.fallbacks.RunnableWithFallbacks.html
3c917ad0c02d-5
namespace is [“langchain”, “llms”, “openai”] get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel][source]¶ Get a pydantic model that can be used to validate output to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output sc...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.fallbacks.RunnableWithFallbacks.html
3c917ad0c02d-6
Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a ...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.fallbacks.RunnableWithFallbacks.html
3c917ad0c02d-7
Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing output while input is still being generated. classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and lo...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.fallbacks.RunnableWithFallbacks.html
3c917ad0c02d-8
added to the run. with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_after_attempt: int = 3) → Runnable[Input, Output]¶ Create a new Runnable that retries the original runnable on exceptions. Parameters retry_if_exc...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.fallbacks.RunnableWithFallbacks.html
3c917ad0c02d-9
property output_schema: Type[pydantic.main.BaseModel]¶ The type of output this runnable produces specified as a pydantic model. property runnables: Iterator[langchain.schema.runnable.base.Runnable[langchain.schema.runnable.utils.Input, langchain.schema.runnable.utils.Output]]¶
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.fallbacks.RunnableWithFallbacks.html
198958b2e3df-0
langchain.schema.runnable.passthrough.identity¶ langchain.schema.runnable.passthrough.identity(x: Other) → Other[source]¶ An identity function
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.passthrough.identity.html
3a6baef93000-0
langchain.schema.runnable.config.RunnableConfig¶ class langchain.schema.runnable.config.RunnableConfig[source]¶ Configuration for a Runnable. Attributes tags Tags for this call and any sub-calls (eg. metadata Metadata for this call and any sub-calls (eg. callbacks Callbacks for this call and any sub-calls (eg. run_name...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.config.RunnableConfig.html
3a6baef93000-1
values() __init__(*args, **kwargs)¶ clear() → None.  Remove all items from D.¶ copy() → a shallow copy of D¶ fromkeys(value=None, /)¶ Create a new dictionary with keys from iterable and values set to value. get(key, default=None, /)¶ Return the value for key if key is in the dictionary, else default. items() → a set-li...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.config.RunnableConfig.html
864af75092e2-0
langchain.schema.runnable.base.RunnableSequence¶ class langchain.schema.runnable.base.RunnableSequence[source]¶ Bases: RunnableSerializable[Input, Output] A sequence of runnables, where the output of each is the input of the next. RunnableSequence is the most important composition operator in LangChain as it is used in...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableSequence.html
864af75092e2-1
def add_one(x: int) -> int: return x + 1 def mul_two(x: int) -> int: return x * 2 runnable_1 = RunnableLambda(add_one) runnable_2 = RunnableLambda(mul_two) sequence = runnable_1 | runnable_2 # Or equivalently: # sequence = RunnableSequence(first=runnable_1, last=runnable_2) sequence.invoke(1) await runnable.ain...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableSequence.html
864af75092e2-2
The middle runnables in the sequence. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output][source]¶ Default implementation runs ainvoke in parallel using asyncio.gather. The default implementat...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableSequence.html
864af75092e2-3
Stream all output from a runnable, as reported to the callback system. This includes all inner runs of LLMs, Retrievers, Tools, etc. Output is streamed as Log objects, which include a list of jsonpatch ops that describe how the state of the run has changed in each step, and the final state of the run. The jsonpatch ops...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableSequence.html
864af75092e2-4
Returns A pydantic model that can be used to validate config. configurable_alternatives(which: ConfigurableField, default_key: str = 'default', **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶ configurable_fields(**kwargs: Union[ConfigurableField, C...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableSequence.html
864af75092e2-5
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, ex...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableSequence.html
864af75092e2-6
This method allows to get an output schema for a specific configuration. Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate output. invoke(input: Input, config: Optional[RunnableConfig] = None) → Output[source]¶ Transform a single input into an output. ...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableSequence.html
864af75092e2-7
Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ cl...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableSequence.html
864af75092e2-8
Bind config to a Runnable, returning a new Runnable. with_fallbacks(fallbacks: Sequence[Runnable[Input, Output]], *, exceptions_to_handle: Tuple[Type[BaseException], ...] = (<class 'Exception'>,)) → RunnableWithFallbacksT[Input, Output]¶ Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A se...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableSequence.html
864af75092e2-9
between retries stop_after_attempt – The maximum number of attempts to make before giving up Returns A new Runnable that retries the original runnable on exceptions. with_types(*, input_type: Optional[Type[Input]] = None, output_type: Optional[Type[Output]] = None) → Runnable[Input, Output]¶ Bind input and output types...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableSequence.html
ed7c8efa9977-0
langchain.schema.runnable.base.coerce_to_runnable¶ langchain.schema.runnable.base.coerce_to_runnable(thing: Union[Runnable[Input, Output], Callable[[Input], Output], Callable[[Input], Awaitable[Output]], Callable[[Iterator[Input]], Iterator[Output]], Callable[[AsyncIterator[Input]], AsyncIterator[Output]], Mapping[str,...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.coerce_to_runnable.html
734b3e1fa8c0-0
langchain.schema.runnable.config.EmptyDict¶ class langchain.schema.runnable.config.EmptyDict[source]¶ Empty dict type. Methods __init__(*args, **kwargs) clear() copy() fromkeys([value]) Create a new dictionary with keys from iterable and values set to value. get(key[, default]) Return the value for key if key is in the...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.config.EmptyDict.html
734b3e1fa8c0-1
pop(k[, d]) → v, remove specified key and return the corresponding value.¶ If the key is not found, return the default if given; otherwise, raise a KeyError. popitem()¶ Remove and return a (key, value) pair as a 2-tuple. Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty. setdef...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.config.EmptyDict.html
10ac0940470e-0
langchain.schema.runnable.utils.aadd¶ async langchain.schema.runnable.utils.aadd(addables: AsyncIterable[Addable]) → Optional[Addable][source]¶ Asynchronously add a sequence of addable objects together.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.aadd.html
a15fdd3b94df-0
langchain.schema.runnable.config.ensure_config¶ langchain.schema.runnable.config.ensure_config(config: Optional[RunnableConfig] = None) → RunnableConfig[source]¶ Ensure that a config is a dict with all keys present. Parameters config (Optional[RunnableConfig], optional) – The config to ensure. Defaults to None. Returns...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.config.ensure_config.html
0597fd79f5a2-0
langchain.schema.runnable.retry.RunnableRetry¶ class langchain.schema.runnable.retry.RunnableRetry[source]¶ Bases: RunnableBindingBase[Input, Output] Retry a Runnable if it fails. A RunnableRetry helps can be used to add retry logic to any object that subclasses the base Runnable. Such retries are especially useful for...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.retry.RunnableRetry.html
0597fd79f5a2-1
from langchain.chat_models import ChatOpenAI from langchain.prompts import PromptTemplate template = PromptTemplate.from_template("tell me a joke about {topic}.") model = ChatOpenAI(temperature=0.5) # Good chain = template | model.with_retry() # Bad chain = template | model retryable_chain = chain.with_retry() Create a...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.retry.RunnableRetry.html