docs: change for optional variables in chatprompt (#25017)

Fixes #24884
This commit is contained in:
BhujayKumarBhatta 2024-08-06 05:27:44 +05:30 committed by GitHub
parent 423d286546
commit 8f33fce871
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View File

@ -46,7 +46,9 @@ class BasePromptTemplate(
"""A list of the names of the variables whose values are required as inputs to the """A list of the names of the variables whose values are required as inputs to the
prompt.""" prompt."""
optional_variables: List[str] = Field(default=[]) optional_variables: List[str] = Field(default=[])
"""A list of the names of the variables that are optional in the prompt.""" """optional_variables: A list of the names of the variables for placeholder
or MessagePlaceholder that are optional. These variables are auto inferred
from the prompt and user need not provide them."""
input_types: Dict[str, Any] = Field(default_factory=dict, exclude=True) input_types: Dict[str, Any] = Field(default_factory=dict, exclude=True)
"""A dictionary of the types of the variables the prompt template expects. """A dictionary of the types of the variables the prompt template expects.
If not provided, all variables are assumed to be strings.""" If not provided, all variables are assumed to be strings."""

View File

@ -946,8 +946,9 @@ class ChatPromptTemplate(BaseChatPromptTemplate):
template_format: format of the template. Defaults to "f-string". template_format: format of the template. Defaults to "f-string".
input_variables: A list of the names of the variables whose values are input_variables: A list of the names of the variables whose values are
required as inputs to the prompt. required as inputs to the prompt.
optional_variables: A list of the names of the variables that are optional optional_variables: A list of the names of the variables for placeholder
in the prompt. or MessagePlaceholder that are optional. These variables are auto inferred
from the prompt and user need not provide them.
partial_variables: A dictionary of the partial variables the prompt partial_variables: A dictionary of the partial variables the prompt
template carries. Partial variables populate the template so that you template carries. Partial variables populate the template so that you
don't need to pass them in every time you call the prompt. don't need to pass them in every time you call the prompt.