Skip to content

Commit

Permalink
runnable -> runnables
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan committed Nov 20, 2023
1 parent e4eb756 commit d141f63
Show file tree
Hide file tree
Showing 55 changed files with 104 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from langchain_core.callbacks.tracers.base import BaseTracer
from langchain_core.callbacks.tracers.schemas import Run
from langchain_core.runnable.config import (
from langchain_core.runnables.config import (
RunnableConfig,
call_func_with_variable_args,
)
Expand Down
2 changes: 1 addition & 1 deletion libs/core/langchain_core/chat_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from langchain_core.prompts.base import StringPromptValue
from langchain_core.prompts.chat import ChatPromptValue
from langchain_core.pydantic_v1 import Field, root_validator
from langchain_core.runnable import RunnableConfig
from langchain_core.runnables import RunnableConfig
from langchain_core.schema import (
ChatGeneration,
ChatResult,
Expand Down
4 changes: 2 additions & 2 deletions libs/core/langchain_core/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
from langchain_core.prompts.base import StringPromptValue
from langchain_core.prompts.chat import ChatPromptValue
from langchain_core.pydantic_v1 import Field, root_validator, validator
from langchain_core.runnable import RunnableConfig
from langchain_core.runnable.config import get_config_list
from langchain_core.runnables import RunnableConfig
from langchain_core.runnables.config import get_config_list
from langchain_core.schema import Generation, LLMResult, PromptValue, RunInfo
from langchain_core.schema.language_model import BaseLanguageModel, LanguageModelInput
from langchain_core.schema.messages import AIMessage, BaseMessage, get_buffer_string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
This module contains schema and implementation of LangChain Runnables primitives.
"""
from langchain_core.runnable.base import (
from langchain_core.runnables.base import (
Runnable,
RunnableBinding,
RunnableGenerator,
Expand All @@ -24,12 +24,12 @@
RunnableSequence,
RunnableSerializable,
)
from langchain_core.runnable.branch import RunnableBranch
from langchain_core.runnable.config import RunnableConfig, patch_config
from langchain_core.runnable.fallbacks import RunnableWithFallbacks
from langchain_core.runnable.passthrough import RunnablePassthrough
from langchain_core.runnable.router import RouterInput, RouterRunnable
from langchain_core.runnable.utils import (
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
)
from langchain_core.callbacks.tracers.log_stream import RunLog, RunLogPatch
from langchain_core.callbacks.tracers.root_listeners import Listener
from langchain_core.runnable.fallbacks import (
from langchain_core.runnables.fallbacks import (
RunnableWithFallbacks as RunnableWithFallbacksT,
)

from langchain_core.load.dump import dumpd
from langchain_core.load.serializable import Serializable
from langchain_core.pydantic_v1 import BaseModel, Field, create_model
from langchain_core.runnable.config import (
from langchain_core.runnables.config import (
RunnableConfig,
acall_func_with_variable_args,
call_func_with_variable_args,
Expand All @@ -57,7 +57,7 @@
merge_configs,
patch_config,
)
from langchain_core.runnable.utils import (
from langchain_core.runnables.utils import (
AddableDict,
AnyConfigurableField,
ConfigurableField,
Expand Down Expand Up @@ -126,7 +126,7 @@ class Runnable(Generic[Input, Output], ABC):
.. code-block:: python
from langchain_core.runnable import RunnableLambda
from langchain_core.runnables import RunnableLambda
# A RunnableSequence constructed using the `|` operator
sequence = RunnableLambda(lambda x: x + 1) | RunnableLambda(lambda x: x * 2)
Expand Down Expand Up @@ -154,7 +154,7 @@ class Runnable(Generic[Input, Output], ABC):
.. code-block:: python
from langchain_core.runnable import RunnableLambda
from langchain_core.runnables import RunnableLambda
import random
Expand Down Expand Up @@ -777,7 +777,7 @@ def with_retry(
Returns:
A new Runnable that retries the original runnable on exceptions.
"""
from langchain_core.runnable.retry import RunnableRetry
from langchain_core.runnables.retry import RunnableRetry

return RunnableRetry(
bound=self,
Expand Down Expand Up @@ -811,7 +811,7 @@ def with_fallbacks(
A new Runnable that will try the original runnable, and then each
fallback in order, upon failures.
"""
from langchain_core.runnable.fallbacks import RunnableWithFallbacks
from langchain_core.runnables.fallbacks import RunnableWithFallbacks

return RunnableWithFallbacks(
runnable=self,
Expand Down Expand Up @@ -1189,7 +1189,7 @@ class RunnableSerializable(Serializable, Runnable[Input, Output]):
def configurable_fields(
self, **kwargs: AnyConfigurableField
) -> RunnableSerializable[Input, Output]:
from langchain_core.runnable.configurable import RunnableConfigurableFields
from langchain_core.runnables.configurable import RunnableConfigurableFields

for key in kwargs:
if key not in self.__fields__:
Expand All @@ -1206,7 +1206,7 @@ def configurable_alternatives(
default_key: str = "default",
**kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]],
) -> RunnableSerializable[Input, Output]:
from langchain_core.runnable.configurable import (
from langchain_core.runnables.configurable import (
RunnableConfigurableAlternatives,
)

Expand Down Expand Up @@ -1254,7 +1254,7 @@ class RunnableSequence(RunnableSerializable[Input, Output]):
.. code-block:: python
from langchain_core.runnable import RunnableLambda
from langchain_core.runnables import RunnableLambda
def add_one(x: int) -> int:
return x + 1
Expand Down Expand Up @@ -1331,7 +1331,7 @@ def OutputType(self) -> Type[Output]:
def get_input_schema(
self, config: Optional[RunnableConfig] = None
) -> Type[BaseModel]:
from langchain_core.runnable.passthrough import RunnableAssign
from langchain_core.runnables.passthrough import RunnableAssign

if isinstance(self.first, RunnableAssign):
first = cast(RunnableAssign, self.first)
Expand Down Expand Up @@ -2273,7 +2273,7 @@ class RunnableLambda(Runnable[Input, Output]):
.. code-block:: python
# This is a RunnableLambda
from langchain_core.runnable import RunnableLambda
from langchain_core.runnables import RunnableLambda
def add_one(x: int) -> int:
return x + 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@

from langchain_core.load.dump import dumpd
from langchain_core.pydantic_v1 import BaseModel
from langchain_core.runnable.base import (
from langchain_core.runnables.base import (
Runnable,
RunnableLike,
RunnableSerializable,
coerce_to_runnable,
)
from langchain_core.runnable.config import (
from langchain_core.runnables.config import (
RunnableConfig,
ensure_config,
get_callback_manager_for_config,
patch_config,
)
from langchain_core.runnable.utils import (
from langchain_core.runnables.utils import (
ConfigurableFieldSpec,
Input,
Output,
Expand All @@ -49,7 +49,7 @@ class RunnableBranch(RunnableSerializable[Input, Output]):
.. code-block:: python
from langchain_core.runnable import RunnableBranch
from langchain_core.runnables import RunnableBranch
branch = RunnableBranch(
(lambda x: isinstance(x, str), lambda x: x.upper()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from typing_extensions import TypedDict

from langchain_core.runnable.utils import (
from langchain_core.runnables.utils import (
Input,
Output,
accepts_config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
from weakref import WeakValueDictionary

from langchain_core.pydantic_v1 import BaseModel
from langchain_core.runnable.base import Runnable, RunnableSerializable
from langchain_core.runnable.config import (
from langchain_core.runnables.base import Runnable, RunnableSerializable
from langchain_core.runnables.config import (
RunnableConfig,
get_config_list,
get_executor_for_config,
)
from langchain_core.runnable.utils import (
from langchain_core.runnables.utils import (
AnyConfigurableField,
ConfigurableField,
ConfigurableFieldMultiOption,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@

from langchain_core.load.dump import dumpd
from langchain_core.pydantic_v1 import BaseModel
from langchain_core.runnable.base import Runnable, RunnableSerializable
from langchain_core.runnable.config import (
from langchain_core.runnables.base import Runnable, RunnableSerializable
from langchain_core.runnables.config import (
RunnableConfig,
ensure_config,
get_async_callback_manager_for_config,
get_callback_manager_for_config,
get_config_list,
patch_config,
)
from langchain_core.runnable.utils import (
from langchain_core.runnables.utils import (
ConfigurableFieldSpec,
Input,
Output,
Expand Down Expand Up @@ -67,7 +67,7 @@ class RunnableWithFallbacks(RunnableSerializable[Input, Output]):
from langchain_core.prompts import PromptTemplate
from langchain_core.schema.output_parser import StrOutputParser
from langchain_core.runnable import RunnableLambda
from langchain_core.runnables import RunnableLambda
def when_all_is_lost(inputs):
return ("Looks like our LLM providers are down. "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@

from langchain_core.load import load
from langchain_core.pydantic_v1 import BaseModel, create_model
from langchain_core.runnable.base import Runnable, RunnableBindingBase, RunnableLambda
from langchain_core.runnable.passthrough import RunnablePassthrough
from langchain_core.runnable.utils import (
from langchain_core.runnables.base import Runnable, RunnableBindingBase, RunnableLambda
from langchain_core.runnables.passthrough import RunnablePassthrough
from langchain_core.runnables.utils import (
ConfigurableFieldSpec,
get_unique_config_specs,
)
from langchain_core.schema.chat_history import BaseChatMessageHistory

if TYPE_CHECKING:
from langchain_core.callbacks.tracers.schemas import Run
from langchain_core.runnable.config import RunnableConfig
from langchain_core.runnables.config import RunnableConfig
from langchain_core.schema.messages import BaseMessage

MessagesOrDictWithMessages = Union[Sequence["BaseMessage"], Dict[str, Any]]
Expand All @@ -49,7 +49,7 @@ class RunnableWithMessageHistory(RunnableBindingBase):
from langchain_core.chat_models import ChatAnthropic
from langchain_core.memory.chat_message_histories import RedisChatMessageHistory
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.runnable.history import RunnableWithMessageHistory
from langchain_core.runnables.history import RunnableWithMessageHistory
prompt = ChatPromptTemplate.from_messages([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
)

from langchain_core.pydantic_v1 import BaseModel, create_model
from langchain_core.runnable.base import (
from langchain_core.runnables.base import (
Other,
Runnable,
RunnableParallel,
RunnableSerializable,
)
from langchain_core.runnable.config import (
from langchain_core.runnables.config import (
RunnableConfig,
acall_func_with_variable_args,
call_func_with_variable_args,
get_executor_for_config,
)
from langchain_core.runnable.utils import AddableDict, ConfigurableFieldSpec
from langchain_core.runnables.utils import AddableDict, ConfigurableFieldSpec
from langchain_core.utils.aiter import atee, py_anext
from langchain_core.utils.iter import safetee

Expand Down Expand Up @@ -62,7 +62,7 @@ class RunnablePassthrough(RunnableSerializable[Other, Other]):
.. code-block:: python
from langchain_core.runnable import RunnablePassthrough, RunnableParallel
from langchain_core.runnables import RunnablePassthrough, RunnableParallel
runnable = RunnableParallel(
origin=RunnablePassthrough(),
Expand All @@ -87,7 +87,7 @@ def fake_llm(prompt: str) -> str: # Fake LLM for the example
.. code-block:: python
from langchain_core.runnable import RunnablePassthrough, RunnableParallel
from langchain_core.runnables import RunnablePassthrough, RunnableParallel
def fake_llm(prompt: str) -> str: # Fake LLM for the example
return "completion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
wait_exponential_jitter,
)

from langchain_core.runnable.base import Input, Output, RunnableBindingBase
from langchain_core.runnable.config import RunnableConfig, patch_config
from langchain_core.runnables.base import Input, Output, RunnableBindingBase
from langchain_core.runnables.config import RunnableConfig, patch_config

if TYPE_CHECKING:
from langchain_core.callbacks.manager import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@

from typing_extensions import TypedDict

from langchain_core.runnable.base import (
from langchain_core.runnables.base import (
Input,
Output,
Runnable,
RunnableSerializable,
coerce_to_runnable,
)
from langchain_core.runnable.config import (
from langchain_core.runnables.config import (
RunnableConfig,
get_config_list,
get_executor_for_config,
)
from langchain_core.runnable.utils import (
from langchain_core.runnables.utils import (
ConfigurableFieldSpec,
gather_with_concurrency,
get_unique_config_specs,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion libs/core/langchain_core/schema/language_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from typing_extensions import TypeAlias

from langchain_core.runnable import RunnableSerializable
from langchain_core.runnables import RunnableSerializable
from langchain_core.schema.messages import AnyMessage, BaseMessage, get_buffer_string
from langchain_core.schema.output import LLMResult
from langchain_core.schema.prompt import PromptValue
Expand Down
2 changes: 1 addition & 1 deletion libs/core/langchain_core/schema/output_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from typing_extensions import get_args

from langchain_core.runnable import RunnableConfig, RunnableSerializable
from langchain_core.runnables import RunnableConfig, RunnableSerializable
from langchain_core.schema.messages import AnyMessage, BaseMessage, BaseMessageChunk
from langchain_core.schema.output import (
ChatGeneration,
Expand Down
2 changes: 1 addition & 1 deletion libs/core/langchain_core/schema/prompt_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import yaml

from langchain_core.pydantic_v1 import BaseModel, Field, create_model, root_validator
from langchain_core.runnable import RunnableConfig, RunnableSerializable
from langchain_core.runnables import RunnableConfig, RunnableSerializable
from langchain_core.schema.document import Document
from langchain_core.schema.output_parser import BaseOutputParser
from langchain_core.schema.prompt import PromptValue
Expand Down
2 changes: 1 addition & 1 deletion libs/core/langchain_core/schema/retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import TYPE_CHECKING, Any, Dict, List, Optional

from langchain_core.load.dump import dumpd
from langchain_core.runnable import RunnableConfig, RunnableSerializable
from langchain_core.runnables import RunnableConfig, RunnableSerializable
from langchain_core.schema.document import Document

if TYPE_CHECKING:
Expand Down
Loading

0 comments on commit d141f63

Please sign in to comment.