🔨 refactor(prompts.py): swap suffix and format_instructions fields
🔨 refactor(util.py): add format_instructions to the list of fields to format in format_dict function
The suffix and format_instructions fields in the ZeroShotPromptNode class were swapped to improve the readability of the code. The format_instructions field is now above the suffix field, which makes more sense as it is a required field. In the util.py file, the format_instructions field was added to the list of fields to format in the format_dict function. This ensures that the format_instructions field is properly formatted when the function is called.
This commit is contained in:
parent
a0da588537
commit
46959acaa9
2 changed files with 10 additions and 5 deletions
|
|
@ -89,18 +89,18 @@ class ZeroShotPromptNode(BasePromptFrontendNode):
|
||||||
is_list=False,
|
is_list=False,
|
||||||
show=True,
|
show=True,
|
||||||
multiline=True,
|
multiline=True,
|
||||||
value=prompt.SUFFIX,
|
value=prompt.FORMAT_INSTRUCTIONS,
|
||||||
name="suffix",
|
name="format_instructions",
|
||||||
),
|
),
|
||||||
TemplateField(
|
TemplateField(
|
||||||
field_type="str",
|
field_type="str",
|
||||||
required=False,
|
required=True,
|
||||||
placeholder="",
|
placeholder="",
|
||||||
is_list=False,
|
is_list=False,
|
||||||
show=True,
|
show=True,
|
||||||
multiline=True,
|
multiline=True,
|
||||||
value=prompt.FORMAT_INSTRUCTIONS,
|
value=prompt.SUFFIX,
|
||||||
name="format_instructions",
|
name="suffix",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
@ -109,3 +109,7 @@ class ZeroShotPromptNode(BasePromptFrontendNode):
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return super().to_dict()
|
return super().to_dict()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def format_field(field: TemplateField, name: Optional[str] = None) -> None:
|
||||||
|
PromptFrontendNode.format_field(field, name)
|
||||||
|
|
|
||||||
|
|
@ -273,6 +273,7 @@ def format_dict(d, name: Optional[str] = None):
|
||||||
"examples",
|
"examples",
|
||||||
"code",
|
"code",
|
||||||
"headers",
|
"headers",
|
||||||
|
"format_instructions",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Replace dict type with str
|
# Replace dict type with str
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue