core[patch]: Fix runnable map ser/de (#20631)

This commit is contained in:
Nuno Campos
2024-04-18 18:52:33 -07:00
committed by GitHub
parent 1cbab0ebda
commit 48307e46a3
5 changed files with 36 additions and 30 deletions

View File

@@ -21,7 +21,7 @@
"RunnableParallel"
],
"kwargs": {
"steps": {
"steps__": {
"buz": {
"lc": 1,
"type": "not_implemented",
@@ -569,7 +569,7 @@
"RunnableParallel"
],
"kwargs": {
"steps": {
"steps__": {
"text": {
"lc": 1,
"type": "constructor",

View File

@@ -2051,7 +2051,7 @@
"RunnableParallel"
],
"kwargs": {
"steps": {
"steps__": {
"key": {
"lc": 1,
"type": "not_implemented",
@@ -2073,7 +2073,7 @@
"RunnableParallel"
],
"kwargs": {
"steps": {
"steps__": {
"question": {
"lc": 1,
"type": "not_implemented",
@@ -4459,7 +4459,7 @@
"RunnableParallel"
],
"kwargs": {
"steps": {
"steps__": {
"key": {
"lc": 1,
"type": "not_implemented",
@@ -4481,7 +4481,7 @@
"RunnableParallel"
],
"kwargs": {
"steps": {
"steps__": {
"question": {
"lc": 1,
"type": "not_implemented",
@@ -8760,7 +8760,7 @@
"RunnableParallel"
],
"kwargs": {
"steps": {
"steps__": {
"question": {
"lc": 1,
"type": "constructor",
@@ -9860,7 +9860,7 @@
"RunnableParallel"
],
"kwargs": {
"steps": {
"steps__": {
"chat": {
"lc": 1,
"type": "not_implemented",
@@ -10352,7 +10352,7 @@
"RunnableParallel"
],
"kwargs": {
"steps": {
"steps__": {
"chat": {
"lc": 1,
"type": "constructor",

View File

@@ -35,6 +35,7 @@ from langchain_core.language_models import (
FakeStreamingListLLM,
)
from langchain_core.load import dumpd, dumps
from langchain_core.load.load import loads
from langchain_core.messages import (
AIMessage,
AIMessageChunk,
@@ -76,7 +77,7 @@ from langchain_core.runnables import (
add,
chain,
)
from langchain_core.runnables.base import RunnableSerializable
from langchain_core.runnables.base import RunnableMap, RunnableSerializable
from langchain_core.runnables.utils import Input, Output
from langchain_core.tools import BaseTool, tool
from langchain_core.tracers import (
@@ -3553,6 +3554,9 @@ async def test_map_astream_iterator_input() -> None:
assert final_value.get("llm") == "i'm a textbot"
assert final_value.get("passthrough") == llm_res
simple_map = RunnableMap(passthrough=RunnablePassthrough())
assert loads(dumps(simple_map)) == simple_map
def test_with_config_with_config() -> None:
llm = FakeListLLM(responses=["i'm a textbot"])