mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-08 14:05:16 +00:00
Slightly modified the docstring in BasePromptTemplate
and StringPromptTemplate
. (#1755)
Regarding [this issue](https://github.com/hwchase17/langchain/issues/1754), `BasePromptTample` class docstring is a little outdated, thus it requires new method `format_prompt` for now. As such, I have made some modifications to the docstring to bring it up to date. I tried to adhere to the established document style, and would appreciate you for taking a look at this PR.
This commit is contained in:
parent
779790167e
commit
e635c86145
@ -72,7 +72,7 @@ class StringPromptValue(PromptValue):
|
|||||||
|
|
||||||
|
|
||||||
class BasePromptTemplate(BaseModel, ABC):
|
class BasePromptTemplate(BaseModel, ABC):
|
||||||
"""Base prompt should expose the format method, returning a prompt."""
|
"""Base class for all prompt templates, returning a prompt."""
|
||||||
|
|
||||||
input_variables: List[str]
|
input_variables: List[str]
|
||||||
"""A list of the names of the variables the prompt template expects."""
|
"""A list of the names of the variables the prompt template expects."""
|
||||||
@ -196,6 +196,8 @@ class BasePromptTemplate(BaseModel, ABC):
|
|||||||
|
|
||||||
|
|
||||||
class StringPromptTemplate(BasePromptTemplate, ABC):
|
class StringPromptTemplate(BasePromptTemplate, ABC):
|
||||||
|
"""String prompt should expose the format method, returning a prompt."""
|
||||||
|
|
||||||
def format_prompt(self, **kwargs: Any) -> PromptValue:
|
def format_prompt(self, **kwargs: Any) -> PromptValue:
|
||||||
"""Create Chat Messages."""
|
"""Create Chat Messages."""
|
||||||
return StringPromptValue(text=self.format(**kwargs))
|
return StringPromptValue(text=self.format(**kwargs))
|
||||||
|
Loading…
Reference in New Issue
Block a user