mirror of
https://github.com/hwchase17/langchain
synced 2024-10-31 15:20:26 +00:00
15 lines
660 B
Plaintext
15 lines
660 B
Plaintext
|
# Validate template
|
||
|
|
||
|
By default, `PromptTemplate` will validate the `template` string by checking whether the `input_variables` match the variables defined in `template`. You can disable this behavior by setting `validate_template` to `False`
|
||
|
|
||
|
```python
|
||
|
template = "I am learning langchain because {reason}."
|
||
|
|
||
|
prompt_template = PromptTemplate(template=template,
|
||
|
input_variables=["reason", "foo"]) # ValueError due to extra variables
|
||
|
prompt_template = PromptTemplate(template=template,
|
||
|
input_variables=["reason", "foo"],
|
||
|
validate_template=False) # No error
|
||
|
```
|
||
|
|