This commit is contained in:
Eugene Yurtsev 2024-11-22 16:30:34 -05:00
parent c0c6d61fa5
commit 33b3e22083
4 changed files with 7 additions and 4 deletions

View File

@ -5217,7 +5217,7 @@ class RunnableBindingBase(RunnableSerializable[Input, Output]):
kwargs. kwargs.
""" """
config: RunnableConfig = Field(default_factory=dict) config: RunnableConfig = Field(default_factory=RunnableConfig)
"""The config to bind to the underlying Runnable.""" """The config to bind to the underlying Runnable."""
config_factories: list[Callable[[RunnableConfig], RunnableConfig]] = Field( config_factories: list[Callable[[RunnableConfig], RunnableConfig]] = Field(

View File

@ -211,7 +211,7 @@ def pre_init(func: Callable) -> Any:
name not in values or values[name] is None name not in values or values[name] is None
) and not field_info.is_required(): ) and not field_info.is_required():
if field_info.default_factory is not None: if field_info.default_factory is not None:
values[name] = field_info.default_factory() values[name] = field_info.default_factory() # type: ignore
else: else:
values[name] = field_info.default values[name] = field_info.default

View File

@ -14047,7 +14047,8 @@
"stop": [ "stop": [
"Thought:" "Thought:"
] ]
} },
"config": {}
}, },
"name": "FakeListChatModel" "name": "FakeListChatModel"
}, },

View File

@ -2949,7 +2949,9 @@ def test_seq_prompt_map(mocker: MockerFixture, snapshot: SnapshotAssertion) -> N
assert chain.first == prompt assert chain.first == prompt
assert chain.middle == [RunnableLambda(passthrough)] assert chain.middle == [RunnableLambda(passthrough)]
assert isinstance(chain.last, RunnableParallel) assert isinstance(chain.last, RunnableParallel)
assert dumps(chain, pretty=True) == snapshot
if (PYDANTIC_MAJOR_VERSION, PYDANTIC_MINOR_VERSION) >= (2, 10):
assert dumps(chain, pretty=True) == snapshot
# Test invoke # Test invoke
prompt_spy = mocker.spy(prompt.__class__, "invoke") prompt_spy = mocker.spy(prompt.__class__, "invoke")