initial commit

This commit is contained in:
2026-05-11 12:36:20 +05:30
commit 384cbe8019
15377 changed files with 2360544 additions and 0 deletions

View File

@@ -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",
]

View File

@@ -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",
]

View File

@@ -0,0 +1,3 @@
from langchain_core.runnables.branch import RunnableBranch
__all__ = ["RunnableBranch"]

View File

@@ -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",
]

View File

@@ -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",
]

View File

@@ -0,0 +1,3 @@
from langchain_core.runnables.fallbacks import RunnableWithFallbacks
__all__ = ["RunnableWithFallbacks"]

View File

@@ -0,0 +1,11 @@
from langchain_core.runnables.history import (
GetSessionHistoryCallable,
MessagesOrDictWithMessages,
RunnableWithMessageHistory,
)
__all__ = [
"GetSessionHistoryCallable",
"MessagesOrDictWithMessages",
"RunnableWithMessageHistory",
]

View File

@@ -0,0 +1,8 @@
from langchain_core.runnables.passthrough import (
RunnableAssign,
RunnablePassthrough,
aidentity,
identity,
)
__all__ = ["RunnableAssign", "RunnablePassthrough", "aidentity", "identity"]

View File

@@ -0,0 +1,3 @@
from langchain_core.runnables.retry import RunnableRetry, U
__all__ = ["RunnableRetry", "U"]

View File

@@ -0,0 +1,3 @@
from langchain_core.runnables.router import RouterInput, RouterRunnable
__all__ = ["RouterInput", "RouterRunnable"]

View File

@@ -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",
]