mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
core[patch]: Fix one unit test for chat prompt template (#24362)
Minor change that fixes a unit test that had missing assertions.
This commit is contained in:
parent
81639243e2
commit
9e4a0e76f6
@ -794,14 +794,15 @@ def test_chat_input_schema(snapshot: SnapshotAssertion) -> None:
|
||||
prompt_all_required = ChatPromptTemplate.from_messages(
|
||||
messages=[MessagesPlaceholder("history", optional=False), ("user", "${input}")]
|
||||
)
|
||||
prompt_all_required.input_variables == {"input"}
|
||||
prompt_all_required.optional_variables == {"history"}
|
||||
assert set(prompt_all_required.input_variables) == {"input", "history"}
|
||||
assert prompt_all_required.optional_variables == []
|
||||
with pytest.raises(ValidationError):
|
||||
prompt_all_required.input_schema(input="")
|
||||
assert prompt_all_required.input_schema.schema() == snapshot(name="required")
|
||||
prompt_optional = ChatPromptTemplate.from_messages(
|
||||
messages=[MessagesPlaceholder("history", optional=True), ("user", "${input}")]
|
||||
)
|
||||
prompt_optional.input_variables == {"history", "input"}
|
||||
# input variables only lists required variables
|
||||
assert set(prompt_optional.input_variables) == {"input"}
|
||||
prompt_optional.input_schema(input="") # won't raise error
|
||||
prompt_optional.input_schema.schema() == snapshot(name="partial")
|
||||
assert prompt_optional.input_schema.schema() == snapshot(name="partial")
|
||||
|
Loading…
Reference in New Issue
Block a user