|
|
|
@ -834,15 +834,15 @@ class RunnableBranch(Serializable, Runnable[Input, Output]):
|
|
|
|
|
class Config:
|
|
|
|
|
arbitrary_types_allowed = True
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def lc_serializable(self) -> bool:
|
|
|
|
|
@classmethod
|
|
|
|
|
def is_lc_serializable(cls) -> bool:
|
|
|
|
|
"""RunnableBranch is serializable if all its branches are serializable."""
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def lc_namespace(self) -> List[str]:
|
|
|
|
|
@classmethod
|
|
|
|
|
def get_lc_namespace(cls) -> List[str]:
|
|
|
|
|
"""The namespace of a RunnableBranch is the namespace of its default branch."""
|
|
|
|
|
return self.__class__.__module__.split(".")[:-1]
|
|
|
|
|
return cls.__module__.split(".")[:-1]
|
|
|
|
|
|
|
|
|
|
def invoke(self, input: Input, config: Optional[RunnableConfig] = None) -> Output:
|
|
|
|
|
"""First evaluates the condition, then delegate to true or false branch."""
|
|
|
|
@ -946,13 +946,13 @@ class RunnableWithFallbacks(Serializable, Runnable[Input, Output]):
|
|
|
|
|
class Config:
|
|
|
|
|
arbitrary_types_allowed = True
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def lc_serializable(self) -> bool:
|
|
|
|
|
@classmethod
|
|
|
|
|
def is_lc_serializable(cls) -> bool:
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def lc_namespace(self) -> List[str]:
|
|
|
|
|
return self.__class__.__module__.split(".")[:-1]
|
|
|
|
|
@classmethod
|
|
|
|
|
def get_lc_namespace(cls) -> List[str]:
|
|
|
|
|
return cls.__module__.split(".")[:-1]
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def runnables(self) -> Iterator[Runnable[Input, Output]]:
|
|
|
|
@ -1184,13 +1184,13 @@ class RunnableSequence(Serializable, Runnable[Input, Output]):
|
|
|
|
|
def steps(self) -> List[Runnable[Any, Any]]:
|
|
|
|
|
return [self.first] + self.middle + [self.last]
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def lc_serializable(self) -> bool:
|
|
|
|
|
@classmethod
|
|
|
|
|
def is_lc_serializable(cls) -> bool:
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def lc_namespace(self) -> List[str]:
|
|
|
|
|
return self.__class__.__module__.split(".")[:-1]
|
|
|
|
|
@classmethod
|
|
|
|
|
def get_lc_namespace(cls) -> List[str]:
|
|
|
|
|
return cls.__module__.split(".")[:-1]
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
arbitrary_types_allowed = True
|
|
|
|
@ -1674,13 +1674,13 @@ class RunnableMap(Serializable, Runnable[Input, Dict[str, Any]]):
|
|
|
|
|
) -> None:
|
|
|
|
|
super().__init__(steps={key: coerce_to_runnable(r) for key, r in steps.items()})
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def lc_serializable(self) -> bool:
|
|
|
|
|
@classmethod
|
|
|
|
|
def is_lc_serializable(cls) -> bool:
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def lc_namespace(self) -> List[str]:
|
|
|
|
|
return self.__class__.__module__.split(".")[:-1]
|
|
|
|
|
@classmethod
|
|
|
|
|
def get_lc_namespace(cls) -> List[str]:
|
|
|
|
|
return cls.__module__.split(".")[:-1]
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
arbitrary_types_allowed = True
|
|
|
|
@ -2061,13 +2061,13 @@ class RunnableEach(Serializable, Runnable[List[Input], List[Output]]):
|
|
|
|
|
class Config:
|
|
|
|
|
arbitrary_types_allowed = True
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def lc_serializable(self) -> bool:
|
|
|
|
|
@classmethod
|
|
|
|
|
def is_lc_serializable(cls) -> bool:
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def lc_namespace(self) -> List[str]:
|
|
|
|
|
return self.__class__.__module__.split(".")[:-1]
|
|
|
|
|
@classmethod
|
|
|
|
|
def get_lc_namespace(cls) -> List[str]:
|
|
|
|
|
return cls.__module__.split(".")[:-1]
|
|
|
|
|
|
|
|
|
|
def bind(self, **kwargs: Any) -> RunnableEach[Input, Output]:
|
|
|
|
|
return RunnableEach(bound=self.bound.bind(**kwargs))
|
|
|
|
@ -2117,13 +2117,13 @@ class RunnableBinding(Serializable, Runnable[Input, Output]):
|
|
|
|
|
class Config:
|
|
|
|
|
arbitrary_types_allowed = True
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def lc_serializable(self) -> bool:
|
|
|
|
|
@classmethod
|
|
|
|
|
def is_lc_serializable(cls) -> bool:
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def lc_namespace(self) -> List[str]:
|
|
|
|
|
return self.__class__.__module__.split(".")[:-1]
|
|
|
|
|
@classmethod
|
|
|
|
|
def get_lc_namespace(cls) -> List[str]:
|
|
|
|
|
return cls.__module__.split(".")[:-1]
|
|
|
|
|
|
|
|
|
|
def _merge_config(self, config: Optional[RunnableConfig]) -> RunnableConfig:
|
|
|
|
|
copy = cast(RunnableConfig, dict(self.config))
|
|
|
|
|