initial commit
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
"""LangChain **Runnable** and the **LangChain Expression Language (LCEL)**.
|
||||
|
||||
The LangChain Expression Language (LCEL) offers a declarative method to build
|
||||
production-grade programs that harness the power of LLMs.
|
||||
|
||||
Programs created using LCEL and LangChain Runnables inherently support
|
||||
synchronous, asynchronous, batch, and streaming operations.
|
||||
|
||||
Support for **async** allows servers hosting LCEL based programs to scale better
|
||||
for higher concurrent loads.
|
||||
|
||||
**Streaming** of intermediate outputs as they're being generated allows for
|
||||
creating more responsive UX.
|
||||
|
||||
This module contains schema and implementation of LangChain Runnables primitives.
|
||||
"""
|
||||
|
||||
from langchain_core.runnables.base import (
|
||||
Runnable,
|
||||
RunnableBinding,
|
||||
RunnableGenerator,
|
||||
RunnableLambda,
|
||||
RunnableMap,
|
||||
RunnableParallel,
|
||||
RunnableSequence,
|
||||
RunnableSerializable,
|
||||
)
|
||||
from langchain_core.runnables.branch import RunnableBranch
|
||||
from langchain_core.runnables.config import RunnableConfig, patch_config
|
||||
from langchain_core.runnables.fallbacks import RunnableWithFallbacks
|
||||
from langchain_core.runnables.passthrough import RunnablePassthrough
|
||||
from langchain_core.runnables.router import RouterInput, RouterRunnable
|
||||
from langchain_core.runnables.utils import (
|
||||
ConfigurableField,
|
||||
ConfigurableFieldMultiOption,
|
||||
ConfigurableFieldSingleOption,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"ConfigurableField",
|
||||
"ConfigurableFieldMultiOption",
|
||||
"ConfigurableFieldSingleOption",
|
||||
"RouterInput",
|
||||
"RouterRunnable",
|
||||
"Runnable",
|
||||
"RunnableBinding",
|
||||
"RunnableBranch",
|
||||
"RunnableConfig",
|
||||
"RunnableGenerator",
|
||||
"RunnableLambda",
|
||||
"RunnableMap",
|
||||
"RunnableParallel",
|
||||
"RunnablePassthrough",
|
||||
"RunnableSequence",
|
||||
"RunnableSerializable",
|
||||
"RunnableWithFallbacks",
|
||||
"patch_config",
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,38 @@
|
||||
from langchain_core.runnables.base import (
|
||||
Other,
|
||||
Runnable,
|
||||
RunnableBinding,
|
||||
RunnableBindingBase,
|
||||
RunnableEach,
|
||||
RunnableEachBase,
|
||||
RunnableGenerator,
|
||||
RunnableLambda,
|
||||
RunnableLike,
|
||||
RunnableParallel,
|
||||
RunnableSequence,
|
||||
RunnableSerializable,
|
||||
coerce_to_runnable,
|
||||
)
|
||||
from langchain_core.runnables.utils import Input, Output
|
||||
|
||||
# Backwards compatibility.
|
||||
RunnableMap = RunnableParallel
|
||||
|
||||
__all__ = [
|
||||
"Input",
|
||||
"Other",
|
||||
"Output",
|
||||
"Runnable",
|
||||
"RunnableBinding",
|
||||
"RunnableBindingBase",
|
||||
"RunnableEach",
|
||||
"RunnableEachBase",
|
||||
"RunnableGenerator",
|
||||
"RunnableLambda",
|
||||
"RunnableLike",
|
||||
"RunnableMap",
|
||||
"RunnableParallel",
|
||||
"RunnableSequence",
|
||||
"RunnableSerializable",
|
||||
"coerce_to_runnable",
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
from langchain_core.runnables.branch import RunnableBranch
|
||||
|
||||
__all__ = ["RunnableBranch"]
|
||||
@@ -0,0 +1,27 @@
|
||||
from langchain_core.runnables.config import (
|
||||
EmptyDict,
|
||||
RunnableConfig,
|
||||
acall_func_with_variable_args,
|
||||
call_func_with_variable_args,
|
||||
ensure_config,
|
||||
get_async_callback_manager_for_config,
|
||||
get_callback_manager_for_config,
|
||||
get_config_list,
|
||||
get_executor_for_config,
|
||||
merge_configs,
|
||||
patch_config,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"EmptyDict",
|
||||
"RunnableConfig",
|
||||
"acall_func_with_variable_args",
|
||||
"call_func_with_variable_args",
|
||||
"ensure_config",
|
||||
"get_async_callback_manager_for_config",
|
||||
"get_callback_manager_for_config",
|
||||
"get_config_list",
|
||||
"get_executor_for_config",
|
||||
"merge_configs",
|
||||
"patch_config",
|
||||
]
|
||||
@@ -0,0 +1,15 @@
|
||||
from langchain_core.runnables.configurable import (
|
||||
DynamicRunnable,
|
||||
RunnableConfigurableAlternatives,
|
||||
RunnableConfigurableFields,
|
||||
StrEnum,
|
||||
make_options_spec,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"DynamicRunnable",
|
||||
"RunnableConfigurableAlternatives",
|
||||
"RunnableConfigurableFields",
|
||||
"StrEnum",
|
||||
"make_options_spec",
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
from langchain_core.runnables.fallbacks import RunnableWithFallbacks
|
||||
|
||||
__all__ = ["RunnableWithFallbacks"]
|
||||
@@ -0,0 +1,11 @@
|
||||
from langchain_core.runnables.history import (
|
||||
GetSessionHistoryCallable,
|
||||
MessagesOrDictWithMessages,
|
||||
RunnableWithMessageHistory,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"GetSessionHistoryCallable",
|
||||
"MessagesOrDictWithMessages",
|
||||
"RunnableWithMessageHistory",
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
from langchain_core.runnables.passthrough import (
|
||||
RunnableAssign,
|
||||
RunnablePassthrough,
|
||||
aidentity,
|
||||
identity,
|
||||
)
|
||||
|
||||
__all__ = ["RunnableAssign", "RunnablePassthrough", "aidentity", "identity"]
|
||||
@@ -0,0 +1,3 @@
|
||||
from langchain_core.runnables.retry import RunnableRetry, U
|
||||
|
||||
__all__ = ["RunnableRetry", "U"]
|
||||
@@ -0,0 +1,3 @@
|
||||
from langchain_core.runnables.router import RouterInput, RouterRunnable
|
||||
|
||||
__all__ = ["RouterInput", "RouterRunnable"]
|
||||
@@ -0,0 +1,51 @@
|
||||
from langchain_core.runnables.utils import (
|
||||
Addable,
|
||||
AddableDict,
|
||||
AnyConfigurableField,
|
||||
ConfigurableField,
|
||||
ConfigurableFieldMultiOption,
|
||||
ConfigurableFieldSingleOption,
|
||||
ConfigurableFieldSpec,
|
||||
GetLambdaSource,
|
||||
Input,
|
||||
IsFunctionArgDict,
|
||||
IsLocalDict,
|
||||
Output,
|
||||
SupportsAdd,
|
||||
aadd,
|
||||
accepts_config,
|
||||
accepts_run_manager,
|
||||
add,
|
||||
gated_coro,
|
||||
gather_with_concurrency,
|
||||
get_function_first_arg_dict_keys,
|
||||
get_lambda_source,
|
||||
get_unique_config_specs,
|
||||
indent_lines_after_first,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Addable",
|
||||
"AddableDict",
|
||||
"AnyConfigurableField",
|
||||
"ConfigurableField",
|
||||
"ConfigurableFieldMultiOption",
|
||||
"ConfigurableFieldSingleOption",
|
||||
"ConfigurableFieldSpec",
|
||||
"GetLambdaSource",
|
||||
"Input",
|
||||
"IsFunctionArgDict",
|
||||
"IsLocalDict",
|
||||
"Output",
|
||||
"SupportsAdd",
|
||||
"aadd",
|
||||
"accepts_config",
|
||||
"accepts_run_manager",
|
||||
"add",
|
||||
"gated_coro",
|
||||
"gather_with_concurrency",
|
||||
"get_function_first_arg_dict_keys",
|
||||
"get_lambda_source",
|
||||
"get_unique_config_specs",
|
||||
"indent_lines_after_first",
|
||||
]
|
||||
Reference in New Issue
Block a user