RunnableWithMessageHistory: Fix input schema (#14516)

Input schema should not have history key
This commit is contained in:
Eugene Yurtsev 2023-12-10 23:33:02 -05:00 committed by GitHub
parent d9bfdc95ea
commit c0f4b95aa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 3 deletions

View File

@ -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,

View File

@ -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: {