mirror of
https://github.com/hwchase17/langchain
synced 2024-10-29 17:07:25 +00:00
dbbc340f25
`langchain.prompts.PromptTemplate` and `langchain.prompts.FewShotPromptTemplate` do not validate `input_variables` when initialized as `jinja2` template. ```python # Using langchain v0.0.144 template = """"\ Your variable: {{ foo }} {% if bar %} You just set bar boolean variable to true {% endif %} """ # Missing variable, should raise ValueError prompt_template = PromptTemplate(template=template, input_variables=["bar"], template_format="jinja2", validate_template=True) # Extra variable, should raise ValueError prompt_template = PromptTemplate(template=template, input_variables=["bar", "foo", "extra", "thing"], template_format="jinja2", validate_template=True) ``` |
||
---|---|---|
.. | ||
__init__.py | ||
test_chat.py | ||
test_few_shot_with_templates.py | ||
test_few_shot.py | ||
test_length_based_example_selector.py | ||
test_loading.py | ||
test_prompt.py | ||
test_utils.py |