Skip to content

Commit c3dd838

Browse files
committed
Remove string formatting deprecation warning from prompt.py and instructions.py
1 parent e80ba5c commit c3dd838

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

guardrails/prompt/instructions.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Instructions to the LLM, to be passed in the prompt."""
22
from string import Template
3-
from warnings import warn
43

54
from guardrails.utils.parsing_utils import get_template_variables
65

@@ -30,12 +29,6 @@ def format(self, **kwargs):
3029
# Only use the keyword arguments that are present in the prompt.
3130
vars = get_template_variables(self.source)
3231
filtered_kwargs = {k: v for k, v in kwargs.items() if k in vars}
33-
if len(filtered_kwargs) == 0:
34-
warn(
35-
"Instructions do not have any variables, "
36-
"if you are migrating follow the new variable convention "
37-
"documented here: https://docs.guardrailsai.com/0-2-migration/"
38-
)
3932

4033
# Return another instance of the class with the formatted prompt.
4134
formatted_instructions = Template(self.source).safe_substitute(

guardrails/prompt/prompt.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""The LLM prompt."""
2-
import warnings
32
from string import Template
43

54
from guardrails.utils.parsing_utils import get_template_variables
@@ -21,12 +20,6 @@ def format(self, **kwargs):
2120
# Only use the keyword arguments that are present in the prompt.
2221
vars = get_template_variables(self.source)
2322
filtered_kwargs = {k: v for k, v in kwargs.items() if k in vars}
24-
if len(filtered_kwargs) == 0:
25-
warnings.warn(
26-
"Prompt does not have any variables, "
27-
"if you are migrating follow the new variable convention "
28-
"documented here: https://docs.guardrailsai.com/0-2-migration/"
29-
)
3023

3124
# Return another instance of the class with the formatted prompt.
3225
formatted_prompt = Template(self.source).safe_substitute(**filtered_kwargs)

0 commit comments

Comments
 (0)