mirror of
https://github.com/hwchase17/langchain
synced 2024-11-16 06:13:16 +00:00
RunnableWithMessageHistory: Fix input schema (#14516)
Input schema should not have history key
This commit is contained in:
parent
d9bfdc95ea
commit
c0f4b95aa9
@ -197,8 +197,6 @@ class RunnableWithMessageHistory(RunnableBindingBase):
|
|||||||
fields[self.input_messages_key] = (Sequence[BaseMessage], ...)
|
fields[self.input_messages_key] = (Sequence[BaseMessage], ...)
|
||||||
else:
|
else:
|
||||||
fields["__root__"] = (Sequence[BaseMessage], ...)
|
fields["__root__"] = (Sequence[BaseMessage], ...)
|
||||||
if self.history_messages_key:
|
|
||||||
fields[self.history_messages_key] = (Sequence[BaseMessage], ...)
|
|
||||||
return create_model( # type: ignore[call-overload]
|
return create_model( # type: ignore[call-overload]
|
||||||
"RunnableWithChatHistoryInput",
|
"RunnableWithChatHistoryInput",
|
||||||
**fields,
|
**fields,
|
||||||
|
@ -178,7 +178,6 @@ def test_output_dict() -> None:
|
|||||||
def test_get_input_schema_input_dict() -> None:
|
def test_get_input_schema_input_dict() -> None:
|
||||||
class RunnableWithChatHistoryInput(BaseModel):
|
class RunnableWithChatHistoryInput(BaseModel):
|
||||||
input: Union[str, BaseMessage, Sequence[BaseMessage]]
|
input: Union[str, BaseMessage, Sequence[BaseMessage]]
|
||||||
history: Sequence[BaseMessage]
|
|
||||||
|
|
||||||
runnable = RunnableLambda(
|
runnable = RunnableLambda(
|
||||||
lambda input: {
|
lambda input: {
|
||||||
|
Loading…
Reference in New Issue
Block a user