mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-27 17:08:47 +00:00
core: docstrings outputs
(#23889)
Added missed docstrings. Formatted docstrings to the consistent form.
This commit is contained in:
parent
1eca98ec56
commit
12c92b6c19
@ -32,7 +32,17 @@ class ChatGeneration(Generation):
|
|||||||
|
|
||||||
@root_validator(pre=False, skip_on_failure=True)
|
@root_validator(pre=False, skip_on_failure=True)
|
||||||
def set_text(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
def set_text(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
"""Set the text attribute to be the contents of the message."""
|
"""Set the text attribute to be the contents of the message.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
values: The values of the object.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The values of the object with the text attribute set.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
ValueError: If the message is not a string or a list.
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
text = ""
|
text = ""
|
||||||
if isinstance(values["message"].content, str):
|
if isinstance(values["message"].content, str):
|
||||||
@ -65,12 +75,10 @@ class ChatGeneration(Generation):
|
|||||||
class ChatGenerationChunk(ChatGeneration):
|
class ChatGenerationChunk(ChatGeneration):
|
||||||
"""ChatGeneration chunk, which can be concatenated with other
|
"""ChatGeneration chunk, which can be concatenated with other
|
||||||
ChatGeneration chunks.
|
ChatGeneration chunks.
|
||||||
|
|
||||||
Attributes:
|
|
||||||
message: The message chunk output by the chat model.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
message: BaseMessageChunk
|
message: BaseMessageChunk
|
||||||
|
"""The message chunk output by the chat model."""
|
||||||
# Override type to be ChatGeneration, ignore mypy error as this is intentional
|
# Override type to be ChatGeneration, ignore mypy error as this is intentional
|
||||||
type: Literal["ChatGenerationChunk"] = "ChatGenerationChunk" # type: ignore[assignment]
|
type: Literal["ChatGenerationChunk"] = "ChatGenerationChunk" # type: ignore[assignment]
|
||||||
"""Type is used exclusively for serialization purposes."""
|
"""Type is used exclusively for serialization purposes."""
|
||||||
|
@ -31,7 +31,8 @@ class Generation(Serializable):
|
|||||||
May include things like the reason for finishing or token log probabilities.
|
May include things like the reason for finishing or token log probabilities.
|
||||||
"""
|
"""
|
||||||
type: Literal["Generation"] = "Generation"
|
type: Literal["Generation"] = "Generation"
|
||||||
"""Type is used exclusively for serialization purposes."""
|
"""Type is used exclusively for serialization purposes.
|
||||||
|
Set to "Generation" for this class."""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_lc_serializable(cls) -> bool:
|
def is_lc_serializable(cls) -> bool:
|
||||||
|
@ -8,7 +8,7 @@ from langchain_core.pydantic_v1 import BaseModel
|
|||||||
class RunInfo(BaseModel):
|
class RunInfo(BaseModel):
|
||||||
"""Class that contains metadata for a single execution of a Chain or model.
|
"""Class that contains metadata for a single execution of a Chain or model.
|
||||||
|
|
||||||
Here for backwards compatibility with older versions of langchain_core.
|
Defined for backwards compatibility with older versions of langchain_core.
|
||||||
|
|
||||||
This model will likely be deprecated in the future.
|
This model will likely be deprecated in the future.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user