id stringlengths 14 15 | text stringlengths 13 2.7k | source stringlengths 60 181 |
|---|---|---|
b561d6085f9a-4 | e.g., if the underlying runnable uses an API which supports a batch mode.
async ainvoke(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Output¶
Default implementation of ainvoke, calls invoke from a thread.
The default implementation allows usage of async code even if
the runnable did ... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.history.RunnableWithMessageHistory.html |
b561d6085f9a-5 | diff – Whether to yield diffs between each step, or the current state.
with_streamed_output_list – Whether to yield the streamed_output list.
include_names – Only include logs with these names.
include_types – Only include logs with these types.
include_tags – Only include logs with these tags.
exclude_names – Exclude ... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.history.RunnableWithMessageHistory.html |
b561d6085f9a-6 | Returns
A pydantic model that can be used to validate config.
configurable_alternatives(which: ConfigurableField, *, default_key: str = 'default', prefix_keys: bool = False, **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶
configurable_fields(**kwar... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.history.RunnableWithMessageHistory.html |
b561d6085f9a-7 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.history.RunnableWithMessageHistory.html |
b561d6085f9a-8 | Returns
A pydantic model that can be used to validate output.
invoke(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Output¶
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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.history.RunnableWithMessageHistory.html |
b561d6085f9a-9 | 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¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = No... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.history.RunnableWithMessageHistory.html |
b561d6085f9a-10 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.history.RunnableWithMessageHistory.html |
b561d6085f9a-11 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.history.RunnableWithMessageHistory.html |
d1d6a41cf14c-0 | langchain_core.runnables.base.RunnableBindingBase¶
class langchain_core.runnables.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.
See d... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableBindingBase.html |
d1d6a41cf14c-1 | param custom_output_type: Optional[Any] = None¶
Override the output type of the underlying runnable with a custom type.
The type can be a pydantic model, or a type annotation (e.g., List[str]).
param kwargs: Mapping[str, Any] [Optional]¶
kwargs to pass to the underlying runnable when running.
For example, when the runn... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableBindingBase.html |
d1d6a41cf14c-2 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, with_streamed_output_list: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Option... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableBindingBase.html |
d1d6a41cf14c-3 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableBindingBase.html |
d1d6a41cf14c-4 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableBindingBase.html |
d1d6a41cf14c-5 | 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]¶
Get the namespace of the langchain object.
get_output_schema(config: Op... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableBindingBase.html |
d1d6a41cf14c-6 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableBindingBase.html |
d1d6a41cf14c-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][source]¶
Default implementation of stream, which calls invoke.
Subclasses should ov... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableBindingBase.html |
d1d6a41cf14c-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 ... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableBindingBase.html |
d1d6a41cf14c-9 | property OutputType: Type[langchain_core.runnables.utils.Output]¶
The type of output this runnable produces specified as a type annotation.
property config_specs: List[langchain_core.runnables.utils.ConfigurableFieldSpec]¶
List configurable fields for this runnable.
property input_schema: Type[pydantic.main.BaseModel]¶... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableBindingBase.html |
1987d20d268a-0 | langchain_core.runnables.utils.gather_with_concurrency¶
async langchain_core.runnables.utils.gather_with_concurrency(n: Optional[int], *coros: Coroutine) → list[source]¶
Gather coroutines with a limit on the number of concurrent coroutines. | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.utils.gather_with_concurrency.html |
a121dab74793-0 | langchain_core.runnables.configurable.DynamicRunnable¶
class langchain_core.runnables.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 Valida... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.DynamicRunnable.html |
a121dab74793-1 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, with_streamed_output_list: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Option... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.DynamicRunnable.html |
a121dab74793-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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.DynamicRunnable.html |
a121dab74793-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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.DynamicRunnable.html |
a121dab74793-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]¶
Get the namespace of the langchain object.
get_output_schema(config: Op... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.DynamicRunnable.html |
a121dab74793-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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.DynamicRunnable.html |
a121dab74793-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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.DynamicRunnable.html |
a121dab74793-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 ... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.DynamicRunnable.html |
a121dab74793-8 | property OutputType: Type[langchain_core.runnables.utils.Output]¶
The type of output this runnable produces specified as a type annotation.
property config_specs: List[langchain_core.runnables.utils.ConfigurableFieldSpec]¶
List configurable fields for this runnable.
property input_schema: Type[pydantic.main.BaseModel]¶... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.DynamicRunnable.html |
2eda8af24c19-0 | langchain_core.runnables.utils.IsLocalDict¶
class langchain_core.runnables.utils.IsLocalDict(name: str, keys: Set[str])[source]¶
Check if a name is a local dict.
Methods
__init__(name, keys)
generic_visit(node)
Called if no explicit visitor function exists for a node.
visit(node)
Visit a node.
visit_Call(node)
visit_Co... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.utils.IsLocalDict.html |
ce6ca5c1809c-0 | langchain_core.runnables.utils.GetLambdaSource¶
class langchain_core.runnables.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 nod... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.utils.GetLambdaSource.html |
93e77f347505-0 | langchain_core.runnables.config.get_async_callback_manager_for_config¶
langchain_core.runnables.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 man... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.config.get_async_callback_manager_for_config.html |
33b00e8a0006-0 | langchain_core.runnables.config.merge_configs¶
langchain_core.runnables.config.merge_configs(*configs: Optional[RunnableConfig]) → RunnableConfig[source]¶
Merge multiple configs into one.
Parameters
*configs (Optional[RunnableConfig]) – The configs to merge.
Returns
The merged config.
Return type
RunnableConfig | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.config.merge_configs.html |
3cd06abaaf1b-0 | langchain.runnables.hub.HubRunnable¶
class langchain.runnables.hub.HubRunnable[source]¶
Bases: RunnableBindingBase[Input, Output]
An instance of a runnable stored in the LangChain Hub.
Create a RunnableBinding from a runnable and kwargs.
Parameters
bound – The underlying runnable that this runnable delegates calls to.
... | https://api.python.langchain.com/en/latest/runnables/langchain.runnables.hub.HubRunnable.html |
3cd06abaaf1b-1 | For example, when the runnable binding is invoked the underlying
runnable will be invoked with the same input but with these additional
kwargs.
param owner_repo_commit: str [Required]¶
async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = Fa... | https://api.python.langchain.com/en/latest/runnables/langchain.runnables.hub.HubRunnable.html |
3cd06abaaf1b-2 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, with_streamed_output_list: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Option... | https://api.python.langchain.com/en/latest/runnables/langchain.runnables.hub.HubRunnable.html |
3cd06abaaf1b-3 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain.runnables.hub.HubRunnable.html |
3cd06abaaf1b-4 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain.runnables.hub.HubRunnable.html |
3cd06abaaf1b-5 | 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]¶
Get the namespace of the langchain object.
get_output_schema(config: Optional[R... | https://api.python.langchain.com/en/latest/runnables/langchain.runnables.hub.HubRunnable.html |
3cd06abaaf1b-6 | 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, exclude_unset: bool = False, exclude_defa... | https://api.python.langchain.com/en/latest/runnables/langchain.runnables.hub.HubRunnable.html |
3cd06abaaf1b-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... | https://api.python.langchain.com/en/latest/runnables/langchain.runnables.hub.HubRunnable.html |
3cd06abaaf1b-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 ... | https://api.python.langchain.com/en/latest/runnables/langchain.runnables.hub.HubRunnable.html |
3cd06abaaf1b-9 | property OutputType: Type[langchain_core.runnables.utils.Output]¶
The type of output this runnable produces specified as a type annotation.
property config_specs: List[langchain_core.runnables.utils.ConfigurableFieldSpec]¶
List configurable fields for this runnable.
property input_schema: Type[pydantic.main.BaseModel]¶... | https://api.python.langchain.com/en/latest/runnables/langchain.runnables.hub.HubRunnable.html |
4ef2775a2f45-0 | langchain_core.runnables.config.patch_config¶
langchain_core.runnables.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, ... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.config.patch_config.html |
afd6c100d628-0 | langchain_core.runnables.base.RunnableEach¶
class langchain_core.runnables.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.
Raises... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableEach.html |
afd6c100d628-1 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, with_streamed_output_list: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Option... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableEach.html |
afd6c100d628-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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableEach.html |
afd6c100d628-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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableEach.html |
afd6c100d628-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]¶
Get the namespace of the langchain object.
get_output_schema(config: Op... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableEach.html |
afd6c100d628-5 | 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, exclude_unset: bool = False, exclude_defa... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableEach.html |
afd6c100d628-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]¶
Default implementation of stream, which calls invoke.
Subclasses should override t... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableEach.html |
afd6c100d628-7 | fallback in order, upon failures.
with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → RunnableEach[Input, Output][source]¶
Bind lifecycle listeners to a Runnable, returning a new Runnable.
on_start: Called before the runnable starts running, w... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableEach.html |
afd6c100d628-8 | The type of output this runnable produces specified as a type annotation.
property config_specs: List[langchain_core.runnables.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 m... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableEach.html |
6c5d93b1526a-0 | langchain_core.runnables.config.acall_func_with_variable_args¶
async langchain_core.runnables.config.acall_func_with_variable_args(func: Union[Callable[[Input], Awaitable[Output]], Callable[[Input, RunnableConfig], Awaitable[Output]], Callable[[Input, AsyncCallbackManagerForChainRun], Awaitable[Output]], Callable[[Inpu... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.config.acall_func_with_variable_args.html |
71928f753e7b-0 | langchain_core.runnables.branch.RunnableBranch¶
class langchain_core.runnables.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 ope... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.branch.RunnableBranch.html |
71928f753e7b-1 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.branch.RunnableBranch.html |
71928f753e7b-2 | diff – Whether to yield diffs between each step, or the current state.
with_streamed_output_list – Whether to yield the streamed_output list.
include_names – Only include logs with these names.
include_types – Only include logs with these types.
include_tags – Only include logs with these tags.
exclude_names – Exclude ... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.branch.RunnableBranch.html |
71928f753e7b-3 | Returns
A pydantic model that can be used to validate config.
configurable_alternatives(which: ConfigurableField, *, default_key: str = 'default', prefix_keys: bool = False, **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶
configurable_fields(**kwar... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.branch.RunnableBranch.html |
71928f753e7b-4 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.branch.RunnableBranch.html |
71928f753e7b-5 | Returns
A pydantic model that can be used to validate output.
invoke(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Any) → Output[source]¶
First evaluates the condition, then delegate to true or false branch.
classmethod is_lc_serializable() → bool[source]¶
RunnableBranch is serializable if all its br... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.branch.RunnableBranch.html |
71928f753e7b-6 | classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmet... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.branch.RunnableBranch.html |
71928f753e7b-7 | Add fallbacks to a runnable, returning a new Runnable.
Parameters
fallbacks – A sequence of runnables to try if the original runnable fails.
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_liste... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.branch.RunnableBranch.html |
71928f753e7b-8 | Bind input and output types to a Runnable, returning a new Runnable.
property InputType: Type[langchain_core.runnables.utils.Input]¶
The type of input this runnable accepts specified as a type annotation.
property OutputType: Type[langchain_core.runnables.utils.Output]¶
The type of output this runnable produces specifi... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.branch.RunnableBranch.html |
a62eed003cb6-0 | langchain_core.runnables.configurable.RunnableConfigurableAlternatives¶
class langchain_core.runnables.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 argument... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.RunnableConfigurableAlternatives.html |
a62eed003cb6-1 | 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¶
Default implementation of ainvoke, calls invoke from a thread.
The default im... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.RunnableConfigurableAlternatives.html |
a62eed003cb6-2 | input – The input to the runnable.
config – The config to use for the runnable.
diff – Whether to yield diffs between each step, or the current state.
with_streamed_output_list – Whether to yield the streamed_output list.
include_names – Only include logs with these names.
include_types – Only include logs with these t... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.RunnableConfigurableAlternatives.html |
a62eed003cb6-3 | Parameters
include – A list of fields to include in the config schema.
Returns
A pydantic model that can be used to validate config.
configurable_alternatives(which: ConfigurableField, *, default_key: str = 'default', prefix_keys: bool = False, **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Outpu... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.RunnableConfigurableAlternatives.html |
a62eed003cb6-4 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.RunnableConfigurableAlternatives.html |
a62eed003cb6-5 | Returns
A pydantic model that can be used to validate output.
invoke(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Any) → Output¶
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 conf... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.RunnableConfigurableAlternatives.html |
a62eed003cb6-6 | 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¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = No... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.RunnableConfigurableAlternatives.html |
a62eed003cb6-7 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.RunnableConfigurableAlternatives.html |
a62eed003cb6-8 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.RunnableConfigurableAlternatives.html |
baf6c677aa72-0 | langchain_core.runnables.utils.get_function_first_arg_dict_keys¶
langchain_core.runnables.utils.get_function_first_arg_dict_keys(func: Callable) → Optional[List[str]][source]¶
Get the keys of the first argument of a function if it is a dict. | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.utils.get_function_first_arg_dict_keys.html |
a4268d39d719-0 | langchain_core.runnables.config.RunnableConfig¶
class langchain_core.runnables.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
N... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.config.RunnableConfig.html |
a4268d39d719-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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.config.RunnableConfig.html |
368b0fd11a4d-0 | langchain_core.runnables.utils.ConfigurableFieldSingleOption¶
class langchain_core.runnables.utils.ConfigurableFieldSingleOption(id: str, options: Mapping[str, Any], default: str, name: Optional[str] = None, description: Optional[str] = None, is_shared: bool = False)[source]¶
A field that can be configured by the user ... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.utils.ConfigurableFieldSingleOption.html |
cf7a12fd496d-0 | langchain_core.runnables.configurable.make_options_spec¶
langchain_core.runnables.configurable.make_options_spec(spec: Union[ConfigurableFieldSingleOption, ConfigurableFieldMultiOption], description: Optional[str]) → ConfigurableFieldSpec[source]¶
Make a ConfigurableFieldSpec for a ConfigurableFieldSingleOption or
Conf... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.configurable.make_options_spec.html |
0517bdafebc8-0 | langchain_core.runnables.base.Runnable¶
class langchain_core.runnables.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: Stre... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.Runnable.html |
0517bdafebc8-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) | {
... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.Runnable.html |
0517bdafebc8-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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.Runnable.html |
0517bdafebc8-3 | 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 validate input to the runnable.
get_output_schema([config])
Get a pydantic model ... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.Runnable.html |
0517bdafebc8-4 | 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]... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.Runnable.html |
0517bdafebc8-5 | async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: Literal[False], with_streamed_output_list: bool = 'True', include_names: Optional[Sequence[str]] = 'None', include_types: Optional[Sequence[str]] = 'None', include_tags: Optional[Sequence[str]] = 'None', exclude_names: Optional[Sequence[str... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.Runnable.html |
0517bdafebc8-6 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.Runnable.html |
0517bdafebc8-7 | 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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.Runnable.html |
0517bdafebc8-8 | input is still being generated.
with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output][source]¶
Bind config to a Runnable, returning a new Runnable.
with_fallbacks(fallbacks: Sequence[Runnable[Input, Output]], *, exceptions_to_handle: Tuple[Type[BaseException], ...] = (<class 'Exc... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.Runnable.html |
0517bdafebc8-9 | 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_attempt – The maximum number of attempts to make before giving up
Returns
A new ... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.Runnable.html |
550e99faacbe-0 | langchain_core.runnables.utils.get_lambda_source¶
langchain_core.runnables.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 | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.utils.get_lambda_source.html |
ef097cf4b534-0 | langchain_core.runnables.utils.gated_coro¶
async langchain_core.runnables.utils.gated_coro(semaphore: Semaphore, coro: Coroutine) → Any[source]¶
Run a coroutine with a semaphore.
:param semaphore: The semaphore to use.
:param coro: The coroutine to run.
Returns
The result of the coroutine. | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.utils.gated_coro.html |
d68d11b6f827-0 | langchain_core.runnables.passthrough.RunnableAssign¶
class langchain_core.runnables.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 argum... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnableAssign.html |
d68d11b6f827-1 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, with_streamed_output_list: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Option... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnableAssign.html |
d68d11b6f827-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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnableAssign.html |
d68d11b6f827-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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnableAssign.html |
d68d11b6f827-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]¶
Get the namespace of the langchain object.
get_output_schema(config: Op... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnableAssign.html |
d68d11b6f827-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... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnableAssign.html |
d68d11b6f827-6 | classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
stream(input: Dict[str, Any], config: Optional[RunnableConfig] = None, **kwargs: Any) → Iterator[Dict[str, Any]][source]¶
Default implementation of stream, which calls invoke.
Subclasses sh... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnableAssign.html |
d68d11b6f827-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 ... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnableAssign.html |
d68d11b6f827-8 | property OutputType: Type[langchain_core.runnables.utils.Output]¶
The type of output this runnable produces specified as a type annotation.
property config_specs: List[langchain_core.runnables.utils.ConfigurableFieldSpec]¶
List configurable fields for this runnable.
property input_schema: Type[pydantic.main.BaseModel]¶... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnableAssign.html |
c472d0fd539a-0 | langchain_core.runnables.utils.ConfigurableFieldSpec¶
class langchain_core.runnables.utils.ConfigurableFieldSpec(id: str, annotation: Any, name: Optional[str] = None, description: Optional[str] = None, default: Any = None, is_shared: bool = False, dependencies: Optional[List[str]] = None)[source]¶
A field that can be c... | https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.utils.ConfigurableFieldSpec.html |
0dff34c4136e-0 | langchain.runnables.openai_functions.OpenAIFunction¶
class langchain.runnables.openai_functions.OpenAIFunction[source]¶
A function description for ChatOpenAI
Attributes
name
The name of the function.
description
The description of the function.
parameters
The parameters to the function.
Methods
__init__(*args, **kwargs... | https://api.python.langchain.com/en/latest/runnables/langchain.runnables.openai_functions.OpenAIFunction.html |
0dff34c4136e-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... | https://api.python.langchain.com/en/latest/runnables/langchain.runnables.openai_functions.OpenAIFunction.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.