mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-28 15:00:23 +00:00
core[patch]: Add kwargs to Runnable (#27008)
Fixes #26685 --------- Co-authored-by: Tibor Reiss <tibor.reiss@gmail.com>
This commit is contained in:
@@ -723,7 +723,9 @@ class Runnable(Generic[Input, Output], ABC):
|
||||
""" --- Public API --- """
|
||||
|
||||
@abstractmethod
|
||||
def invoke(self, input: Input, config: Optional[RunnableConfig] = None) -> Output:
|
||||
def invoke(
|
||||
self, input: Input, config: Optional[RunnableConfig] = None, **kwargs: Any
|
||||
) -> Output:
|
||||
"""Transform a single input into an output. Override to implement.
|
||||
|
||||
Args:
|
||||
@@ -3669,7 +3671,7 @@ class RunnableParallel(RunnableSerializable[Input, dict[str, Any]]):
|
||||
return "{\n " + map_for_repr + "\n}"
|
||||
|
||||
def invoke(
|
||||
self, input: Input, config: Optional[RunnableConfig] = None
|
||||
self, input: Input, config: Optional[RunnableConfig] = None, **kwargs: Any
|
||||
) -> dict[str, Any]:
|
||||
from langchain_core.callbacks.manager import CallbackManager
|
||||
|
||||
|
@@ -96,7 +96,7 @@ class RouterRunnable(RunnableSerializable[RouterInput, Output]):
|
||||
return ["langchain", "schema", "runnable"]
|
||||
|
||||
def invoke(
|
||||
self, input: RouterInput, config: Optional[RunnableConfig] = None
|
||||
self, input: RouterInput, config: Optional[RunnableConfig] = None, **kwargs: Any
|
||||
) -> Output:
|
||||
key = input["key"]
|
||||
actual_input = input["input"]
|
||||
|
Reference in New Issue
Block a user