mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-24 03:52:10 +00:00
core: Auto-fix some docstrings (#29337)
This commit is contained in:
committed by
GitHub
parent
86a0720310
commit
1c4ce7b42b
@@ -98,13 +98,15 @@ class BasePromptTemplate(
|
||||
@classmethod
|
||||
def get_lc_namespace(cls) -> list[str]:
|
||||
"""Get the namespace of the langchain object.
|
||||
Returns ["langchain", "schema", "prompt_template"]."""
|
||||
Returns ["langchain", "schema", "prompt_template"].
|
||||
"""
|
||||
return ["langchain", "schema", "prompt_template"]
|
||||
|
||||
@classmethod
|
||||
def is_lc_serializable(cls) -> bool:
|
||||
"""Return whether this class is serializable.
|
||||
Returns True."""
|
||||
Returns True.
|
||||
"""
|
||||
return True
|
||||
|
||||
model_config = ConfigDict(
|
||||
|
@@ -54,7 +54,8 @@ class BaseMessagePromptTemplate(Serializable, ABC):
|
||||
@classmethod
|
||||
def is_lc_serializable(cls) -> bool:
|
||||
"""Return whether or not the class is serializable.
|
||||
Returns: True"""
|
||||
Returns: True.
|
||||
"""
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
@@ -392,8 +393,7 @@ class BaseStringMessagePromptTemplate(BaseMessagePromptTemplate, ABC):
|
||||
|
||||
@property
|
||||
def input_variables(self) -> list[str]:
|
||||
"""
|
||||
Input variables for this prompt template.
|
||||
"""Input variables for this prompt template.
|
||||
|
||||
Returns:
|
||||
List of input variable names.
|
||||
@@ -624,8 +624,7 @@ class _StringImageMessagePromptTemplate(BaseMessagePromptTemplate):
|
||||
|
||||
@property
|
||||
def input_variables(self) -> list[str]:
|
||||
"""
|
||||
Input variables for this prompt template.
|
||||
"""Input variables for this prompt template.
|
||||
|
||||
Returns:
|
||||
List of input variable names.
|
||||
@@ -742,8 +741,7 @@ class BaseChatPromptTemplate(BasePromptTemplate, ABC):
|
||||
|
||||
@property
|
||||
def lc_attributes(self) -> dict:
|
||||
"""
|
||||
Return a list of attribute names that should be included in the
|
||||
"""Return a list of attribute names that should be included in the
|
||||
serialized kwargs. These attributes must be accepted by the
|
||||
constructor.
|
||||
"""
|
||||
@@ -980,7 +978,6 @@ class ChatPromptTemplate(BaseChatPromptTemplate):
|
||||
A chat prompt template.
|
||||
|
||||
Examples:
|
||||
|
||||
Instantiation from a list of message templates:
|
||||
|
||||
.. code-block:: python
|
||||
@@ -1173,7 +1170,6 @@ class ChatPromptTemplate(BaseChatPromptTemplate):
|
||||
"""Create a chat prompt template from a variety of message formats.
|
||||
|
||||
Examples:
|
||||
|
||||
Instantiation from a list of message templates:
|
||||
|
||||
.. code-block:: python
|
||||
|
@@ -265,7 +265,6 @@ class FewShotChatMessagePromptTemplate(
|
||||
to dynamically select examples based on the input.
|
||||
|
||||
Examples:
|
||||
|
||||
Prompt template with a fixed list of examples (matching the sample
|
||||
conversation above):
|
||||
|
||||
|
@@ -184,8 +184,7 @@ def _load_prompt_from_file(
|
||||
|
||||
|
||||
def _load_chat_prompt(config: dict) -> ChatPromptTemplate:
|
||||
"""Load chat prompt from config"""
|
||||
|
||||
"""Load chat prompt from config."""
|
||||
messages = config.pop("messages")
|
||||
template = messages[0]["prompt"].pop("template") if messages else None
|
||||
config.pop("input_variables")
|
||||
|
@@ -23,8 +23,7 @@ def _get_inputs(inputs: dict, input_variables: list[str]) -> dict:
|
||||
),
|
||||
)
|
||||
class PipelinePromptTemplate(BasePromptTemplate):
|
||||
"""
|
||||
This has been deprecated in favor of chaining individual prompts together in your
|
||||
"""This has been deprecated in favor of chaining individual prompts together in your
|
||||
code. E.g. using a for loop, you could do:
|
||||
|
||||
.. code-block:: python
|
||||
|
@@ -284,7 +284,6 @@ class PromptTemplate(StringPromptTemplate):
|
||||
Returns:
|
||||
The prompt template loaded from the template.
|
||||
"""
|
||||
|
||||
input_variables = get_template_variables(template, template_format)
|
||||
_partial_variables = partial_variables or {}
|
||||
|
||||
|
@@ -64,8 +64,7 @@ def jinja2_formatter(template: str, /, **kwargs: Any) -> str:
|
||||
|
||||
|
||||
def validate_jinja2(template: str, input_variables: list[str]) -> None:
|
||||
"""
|
||||
Validate that the input variables are valid for the template.
|
||||
"""Validate that the input variables are valid for the template.
|
||||
Issues a warning if missing or extra variables are found.
|
||||
|
||||
Args:
|
||||
|
@@ -72,7 +72,6 @@ class StructuredPrompt(ChatPromptTemplate):
|
||||
"""Create a chat prompt template from a variety of message formats.
|
||||
|
||||
Examples:
|
||||
|
||||
Instantiation from a list of message templates:
|
||||
|
||||
.. code-block:: python
|
||||
|
Reference in New Issue
Block a user