id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
0597fd79f5a2-2
Default implementation runs ainvoke in parallel using asyncio.gather. 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, co...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.retry.RunnableRetry.html
0597fd79f5a2-3
The jsonpatch ops can be applied in order to construct state. async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Any) → AsyncIterator[Output]¶ Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they can sta...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.retry.RunnableRetry.html
0597fd79f5a2-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.retry.RunnableRetry.html
0597fd79f5a2-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.retry.RunnableRetry.html
0597fd79f5a2-6
Returns The output of the runnable. classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclu...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.retry.RunnableRetry.html
0597fd79f5a2-7
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of stream, which calls invoke. Subclasses should override t...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.retry.RunnableRetry.html
0597fd79f5a2-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.retry.RunnableRetry.html
0597fd79f5a2-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.retry.RunnableRetry.html
c957e6bc73a3-0
langchain.schema.runnable.config.get_callback_manager_for_config¶ langchain.schema.runnable.config.get_callback_manager_for_config(config: RunnableConfig) → CallbackManager[source]¶ Get a callback manager for a config. Parameters config (RunnableConfig) – The config. Returns The callback manager. Return type CallbackMa...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.config.get_callback_manager_for_config.html
9a7db9277062-0
langchain.schema.runnable.config.patch_config¶ langchain.schema.runnable.config.patch_config(config: Optional[RunnableConfig], *, callbacks: Optional[BaseCallbackManager] = None, recursion_limit: Optional[int] = None, max_concurrency: Optional[int] = None, run_name: Optional[str] = None, configurable: Optional[Dict[str...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.config.patch_config.html
4d9ffa7b7672-0
langchain.schema.runnable.config.acall_func_with_variable_args¶ async langchain.schema.runnable.config.acall_func_with_variable_args(func: Union[Callable[[Input], Awaitable[Output]], Callable[[Input, RunnableConfig], Awaitable[Output]], Callable[[Input, AsyncCallbackManagerForChainRun], Awaitable[Output]], Callable[[In...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.config.acall_func_with_variable_args.html
101615e42447-0
langchain.schema.runnable.config.get_config_list¶ langchain.schema.runnable.config.get_config_list(config: Optional[Union[RunnableConfig, List[RunnableConfig]]], length: int) → List[RunnableConfig][source]¶ Get a list of configs from a single config or a list of configs. It is useful for subclasses overriding batch() o...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.config.get_config_list.html
879f059862af-0
langchain.schema.runnable.utils.SupportsAdd¶ class langchain.schema.runnable.utils.SupportsAdd(*args, **kwargs)[source]¶ Protocol for objects that support addition. Methods __init__(*args, **kwargs) __init__(*args, **kwargs)¶
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.SupportsAdd.html
06fd57af7112-0
langchain.schema.runnable.configurable.RunnableConfigurableAlternatives¶ class langchain.schema.runnable.configurable.RunnableConfigurableAlternatives[source]¶ Bases: DynamicRunnable[Input, Output] A Runnable that can be dynamically configured. Create a new model by parsing and validating input data from keyword argume...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.configurable.RunnableConfigurableAlternatives.html
06fd57af7112-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.configurable.RunnableConfigurableAlternatives.html
06fd57af7112-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.configurable.RunnableConfigurableAlternatives.html
06fd57af7112-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.configurable.RunnableConfigurableAlternatives.html
06fd57af7112-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.configurable.RunnableConfigurableAlternatives.html
06fd57af7112-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.configurable.RunnableConfigurableAlternatives.html
06fd57af7112-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.configurable.RunnableConfigurableAlternatives.html
06fd57af7112-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.configurable.RunnableConfigurableAlternatives.html
06fd57af7112-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.configurable.RunnableConfigurableAlternatives.html
91e216eb5365-0
langchain.schema.runnable.base.RunnableLambda¶ class langchain.schema.runnable.base.RunnableLambda(func: Union[Union[Callable[[Input], Output], Callable[[Input, RunnableConfig], Output], Callable[[Input, CallbackManagerForChainRun], Output], Callable[[Input, CallbackManagerForChainRun, RunnableConfig], Output]], Union[...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableLambda.html
91e216eb5365-1
# Alternatively, can provide both synd and sync implementations async def add_one_async(x: int) -> int: return x + 1 runnable = RunnableLambda(add_one, afunc=add_one_async) runnable.invoke(1) # Uses add_one await runnable.ainvoke(1) # Uses add_one_async Create a RunnableLambda from a callable, and async callable or...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableLambda.html
91e216eb5365-2
bind(**kwargs) Bind arguments to a Runnable, returning a new Runnable. config_schema(*[, include]) The type of config this runnable accepts specified as a pydantic model. get_input_schema([config]) The pydantic schema for the input to this runnable. get_output_schema([config]) Get a pydantic model that can be used to v...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableLambda.html
91e216eb5365-3
Bind input and output types to a Runnable, returning a new Runnable. __init__(func: Union[Union[Callable[[Input], Output], Callable[[Input, RunnableConfig], Output], Callable[[Input, CallbackManagerForChainRun], Output], Callable[[Input, CallbackManagerForChainRun, RunnableConfig], Output]], Union[Callable[[Input], Awa...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableLambda.html
91e216eb5365-4
Invoke this runnable 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. async astream_log(input: Any, confi...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableLambda.html
91e216eb5365-5
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.RunnableLambda.html
91e216eb5365-6
Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of stream, which calls invoke. Subclasses should override this method if they supp...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableLambda.html
91e216eb5365-7
on_end: Called after the runnable finishes running, with the Run object. on_error: Called if the runnable throws an error, with the Run object. The Run object contains information about the run, including its id, type, input, output, error, start_time, end_time, and any tags or metadata added to the run. with_retry(*, ...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableLambda.html
bbf66f0b0d50-0
langchain.schema.runnable.base.RunnableEach¶ class langchain.schema.runnable.base.RunnableEach[source]¶ Bases: RunnableEachBase[Input, Output] A runnable that delegates calls to another runnable with each element of the input sequence. Create a new model by parsing and validating input data from keyword arguments. Rais...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableEach.html
bbf66f0b0d50-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.RunnableEach.html
bbf66f0b0d50-2
e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → RunnableEach[Input, Output][source]¶ 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 ...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableEach.html
bbf66f0b0d50-3
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 creating the new model: you should trust this data deep – set to True to make a deep co...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableEach.html
bbf66f0b0d50-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.RunnableEach.html
bbf66f0b0d50-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.RunnableEach.html
bbf66f0b0d50-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) → RunnableEach[Input, Output][source]¶ Bind config to a Runnable, returning...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableEach.html
bbf66f0b0d50-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.RunnableEach.html
bbf66f0b0d50-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.RunnableEach.html
e2e1b5ce1d7c-0
langchain.schema.runnable.utils.ConfigurableFieldSingleOption¶ class langchain.schema.runnable.utils.ConfigurableFieldSingleOption(id: str, options: Mapping[str, Any], default: str, name: Optional[str] = None, description: Optional[str] = None)[source]¶ A field that can be configured by the user with a default value. C...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.ConfigurableFieldSingleOption.html
c5797a5da699-0
langchain.schema.runnable.configurable.StrEnum¶ class langchain.schema.runnable.configurable.StrEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶ A string enum.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.configurable.StrEnum.html
acd8f82bbabe-0
langchain.schema.runnable.configurable.DynamicRunnable¶ class langchain.schema.runnable.configurable.DynamicRunnable[source]¶ Bases: RunnableSerializable[Input, Output] A Serializable Runnable that can be dynamically configured. Create a new model by parsing and validating input data from keyword arguments. Raises Vali...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.configurable.DynamicRunnable.html
acd8f82bbabe-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.configurable.DynamicRunnable.html
acd8f82bbabe-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.configurable.DynamicRunnable.html
acd8f82bbabe-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.configurable.DynamicRunnable.html
acd8f82bbabe-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.configurable.DynamicRunnable.html
acd8f82bbabe-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.configurable.DynamicRunnable.html
acd8f82bbabe-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.configurable.DynamicRunnable.html
acd8f82bbabe-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.configurable.DynamicRunnable.html
acd8f82bbabe-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.configurable.DynamicRunnable.html
ca2fc64fbb6d-0
langchain.schema.runnable.utils.ConfigurableField¶ class langchain.schema.runnable.utils.ConfigurableField(id: str, name: Optional[str] = None, description: Optional[str] = None, annotation: Optional[Any] = None)[source]¶ A field that can be configured by the user. Create new instance of ConfigurableField(id, name, des...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.ConfigurableField.html
be314d7bb5ec-0
langchain.schema.runnable.base.RunnableBindingBase¶ class langchain.schema.runnable.base.RunnableBindingBase[source]¶ Bases: RunnableSerializable[Input, Output] A runnable that delegates calls to another runnable with a set of kwargs. Use only if creating a new RunnableBinding subclass with different __init__ args. Cre...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBindingBase.html
be314d7bb5ec-1
the runnable did not implement a native async version of invoke. Subclasses should override this method if they can run asynchronously. async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output][source]¶ Default implementation of astream, which calls ainvoke. S...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBindingBase.html
be314d7bb5ec-2
input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output][source]¶ Default implementation runs invoke in parallel using a thread pool executor. The default implementation of...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBindingBase.html
be314d7bb5ec-3
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] = None, deep: bool = False) → Model¶ Duplicate a model, optionally...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBindingBase.html
be314d7bb5ec-4
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]¶ Get the namespace of the langchain object. For example, if the class is langchain.llms.openai.OpenAI, then the namespace is [“langchain”, “llms...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBindingBase.html
be314d7bb5ec-5
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: Optional[bool] = None, exclude_unset: bool = False, excl...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBindingBase.html
be314d7bb5ec-6
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output][source]¶ Default implementation of stream, which calls invoke. Subclasses should ov...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableBindingBase.html
be314d7bb5ec-7
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.base.RunnableBindingBase.html
be314d7bb5ec-8
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.base.RunnableBindingBase.html
dad58b6aa148-0
langchain.schema.runnable.passthrough.aidentity¶ async langchain.schema.runnable.passthrough.aidentity(x: Other) → Other[source]¶ An async identity function
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.passthrough.aidentity.html
25c4de52b9b8-0
langchain.schema.runnable.utils.GetLambdaSource¶ class langchain.schema.runnable.utils.GetLambdaSource[source]¶ Get the source code of a lambda function. Initialize the visitor. Methods __init__() Initialize the visitor. generic_visit(node) Called if no explicit visitor function exists for a node. visit(node) Visit a n...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.GetLambdaSource.html
e3ac21010b3e-0
langchain.schema.runnable.passthrough.RunnableAssign¶ class langchain.schema.runnable.passthrough.RunnableAssign[source]¶ Bases: RunnableSerializable[Dict[str, Any], Dict[str, Any]] A runnable that assigns key-value pairs to Dict[str, Any] inputs. Create a new model by parsing and validating input data from keyword arg...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.passthrough.RunnableAssign.html
e3ac21010b3e-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.passthrough.RunnableAssign.html
e3ac21010b3e-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.passthrough.RunnableAssign.html
e3ac21010b3e-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.passthrough.RunnableAssign.html
e3ac21010b3e-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.passthrough.RunnableAssign.html
e3ac21010b3e-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.passthrough.RunnableAssign.html
e3ac21010b3e-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.passthrough.RunnableAssign.html
e3ac21010b3e-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.passthrough.RunnableAssign.html
e3ac21010b3e-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.passthrough.RunnableAssign.html
ec7aa9c77030-0
langchain.schema.runnable.base.RunnableGenerator¶ class langchain.schema.runnable.base.RunnableGenerator(transform: Union[Callable[[Iterator[Input]], Iterator[Output]], Callable[[AsyncIterator[Input]], AsyncIterator[Output]]], atransform: Optional[Callable[[AsyncIterator[Input]], AsyncIterator[Output]]] = None)[source]...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableGenerator.html
ec7aa9c77030-1
get_output_schema([config]) Get a pydantic model that can be used to validate output to the runnable. invoke(input[, config]) Transform a single input into an output. map() Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. stream(input[, config]) Default impleme...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableGenerator.html
ec7aa9c77030-2
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]¶ Default implementation of ainvoke, calls invoke from a thread. The de...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableGenerator.html
ec7aa9c77030-3
The jsonpatch ops can be applied in order to construct state. atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Any) → AsyncIterator[Output][source]¶ Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they can s...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableGenerator.html
ec7aa9c77030-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. get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶ Get a pydantic model that can be used to vali...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableGenerator.html
ec7aa9c77030-5
Subclasses should override this method if they support streaming output. transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Any) → Iterator[Output][source]¶ Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they ca...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableGenerator.html
ec7aa9c77030-6
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.RunnableGenerator.html
5614e378e6d6-0
langchain.schema.runnable.configurable.make_options_spec¶ langchain.schema.runnable.configurable.make_options_spec(spec: Union[ConfigurableFieldSingleOption, ConfigurableFieldMultiOption], description: Optional[str]) → ConfigurableFieldSpec[source]¶ Make a ConfigurableFieldSpec for a ConfigurableFieldSingleOption or Co...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.configurable.make_options_spec.html
c288d11208ee-0
langchain.schema.runnable.configurable.RunnableConfigurableFields¶ class langchain.schema.runnable.configurable.RunnableConfigurableFields[source]¶ Bases: DynamicRunnable[Input, Output] A Runnable that can be dynamically configured. Create a new model by parsing and validating input data from keyword arguments. Raises ...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.configurable.RunnableConfigurableFields.html
c288d11208ee-1
Default implementation of astream, which calls ainvoke. 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, incl...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.configurable.RunnableConfigurableFields.html
c288d11208ee-2
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) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[Bas...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.configurable.RunnableConfigurableFields.html
c288d11208ee-3
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 creating the new model: you should trust this data deep – set to True to make a deep co...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.configurable.RunnableConfigurableFields.html
c288d11208ee-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.configurable.RunnableConfigurableFields.html
c288d11208ee-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.configurable.RunnableConfigurableFields.html
c288d11208ee-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.configurable.RunnableConfigurableFields.html
c288d11208ee-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.configurable.RunnableConfigurableFields.html
c288d11208ee-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.configurable.RunnableConfigurableFields.html
867445ce28eb-0
langchain.schema.runnable.base.Runnable¶ class langchain.schema.runnable.base.Runnable[source]¶ A unit of work that can be invoked, batched, streamed, transformed and composed. invoke/ainvoke: Transforms a single input into an output. batch/abatch: Efficiently transforms multiple inputs into outputs. stream/astream: St...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.Runnable.html
867445ce28eb-1
# A RunnableSequence constructed using the `|` operator sequence = RunnableLambda(lambda x: x + 1) | RunnableLambda(lambda x: x * 2) sequence.invoke(1) # 4 sequence.batch([1, 2, 3]) # [4, 6, 8] # A sequence that contains a RunnableParallel constructed using a dict literal sequence = RunnableLambda(lambda x: x + 1) | { ...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.Runnable.html
867445ce28eb-2
print(sequence.output_schema.schema()) # Show inferred output schema print(sequence.invoke(2)) # invoke the sequence (note the retry above!!) As the chains get longer, it can be useful to be able to see intermediate results to debug and trace the chain. You can set the global debug flag to True to enable debug output f...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.Runnable.html
867445ce28eb-3
Default implementation runs invoke in parallel using a thread pool executor. bind(**kwargs) Bind arguments to a Runnable, returning a new Runnable. config_schema(*[, include]) The type of config this runnable accepts specified as a pydantic model. get_input_schema([config]) Get a pydantic model that can be used to vali...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.Runnable.html
867445ce28eb-4
Default implementation runs ainvoke in parallel using asyncio.gather. 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, co...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.Runnable.html
867445ce28eb-5
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: Literal[False], include_names: Optional[Sequence[str]] = 'None', include_types: Optional[Sequence[str]] = 'None', include_tags: Optional[Sequence[str]] = 'None', exclude_names: Optional[Sequence[str]] = 'None', exclude_types: Optional[Seque...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.Runnable.html
867445ce28eb-6
bind(**kwargs: Any) → Runnable[Input, Output][source]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel][source]¶ The type of config this runnable accepts specified as a pydantic model. To mark a field as configurable, see the configurabl...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.Runnable.html
867445ce28eb-7
Transform a single input into an output. Override to implement. Parameters input – The input to the runnable. config – A config to use when invoking the runnable. The config supports standard keys like ‘tags’, ‘metadata’ for tracing purposes, ‘max_concurrency’ for controlling how much work to do in parallel, and other ...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.Runnable.html
867445ce28eb-8
exceptions_to_handle – A tuple of exception types to handle. Returns A new Runnable that will try the original runnable, and then each 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...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.Runnable.html
be89f6ba731b-0
langchain.schema.runnable.history.RunnableWithMessageHistory¶ class langchain.schema.runnable.history.RunnableWithMessageHistory[source]¶ Bases: RunnableBindingBase A runnable that manages chat message history for another runnable. Base runnable must have inputs and outputs that can be converted to a list ofBaseMessage...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.history.RunnableWithMessageHistory.html
be89f6ba731b-1
Must take as input one of: - A sequence of BaseMessages - A dict with one key for all messages - A dict with one key for the current input string/message(s) and a separate key for historical messages. If the input key points to a string, it will be treated as a HumanMessage in history. Must return as output one of: - A...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.history.RunnableWithMessageHistory.html
be89f6ba731b-2
param input_messages_key: Optional[str] = None¶ param kwargs: Mapping[str, Any] [Optional]¶ param output_messages_key: Optional[str] = None¶ async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.history.RunnableWithMessageHistory.html