mirror of
https://github.com/hwchase17/langchain.git
synced 2026-02-21 06:33:41 +00:00
chore: more content block docstring formatting
This commit is contained in:
@@ -201,7 +201,7 @@ class AIMessage(BaseMessage):
|
||||
content_blocks: Optional[list[types.ContentBlock]] = None,
|
||||
**kwargs: Any,
|
||||
) -> None:
|
||||
"""Specify content as a positional arg or content_blocks for typing support."""
|
||||
"""Specify ``content`` as positional arg or ``content_blocks`` for typing."""
|
||||
if content_blocks is not None:
|
||||
# If there are tool calls in content_blocks, but not in tool_calls, add them
|
||||
content_tool_calls = [
|
||||
|
||||
@@ -83,7 +83,7 @@ class BaseMessage(Serializable):
|
||||
content_blocks: Optional[list[types.ContentBlock]] = None,
|
||||
**kwargs: Any,
|
||||
) -> None:
|
||||
"""Specify content as a positional arg or content_blocks for typing support."""
|
||||
"""Specify ``content`` as positional arg or ``content_blocks`` for typing."""
|
||||
if content_blocks is not None:
|
||||
super().__init__(content=content_blocks, **kwargs)
|
||||
else:
|
||||
@@ -108,17 +108,18 @@ class BaseMessage(Serializable):
|
||||
|
||||
@property
|
||||
def content_blocks(self) -> list[types.ContentBlock]:
|
||||
"""Return the content as a list of standard ContentBlocks.
|
||||
"""Return the content as a list of standard ``ContentBlock``s.
|
||||
|
||||
To use this property, the corresponding chat model must support
|
||||
``message_version="v1"`` or higher:
|
||||
``message_version='v1'`` or higher:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from langchain.chat_models import init_chat_model
|
||||
llm = init_chat_model("...", message_version="v1")
|
||||
|
||||
otherwise, does best-effort parsing to standard types.
|
||||
Otherwise, does best-effort parsing to standard types.
|
||||
|
||||
"""
|
||||
blocks: list[types.ContentBlock] = []
|
||||
content = (
|
||||
|
||||
@@ -63,7 +63,7 @@ class HumanMessage(BaseMessage):
|
||||
content_blocks: Optional[list[types.ContentBlock]] = None,
|
||||
**kwargs: Any,
|
||||
) -> None:
|
||||
"""Specify content as a positional arg or content_blocks for typing support."""
|
||||
"""Specify ``content`` as positional arg or ``content_blocks`` for typing."""
|
||||
if content_blocks is not None:
|
||||
super().__init__(
|
||||
content=cast("Union[str, list[Union[str, dict]]]", content_blocks),
|
||||
|
||||
@@ -56,7 +56,7 @@ class SystemMessage(BaseMessage):
|
||||
content_blocks: Optional[list[types.ContentBlock]] = None,
|
||||
**kwargs: Any,
|
||||
) -> None:
|
||||
"""Specify content as a positional arg or content_blocks for typing support."""
|
||||
"""Specify ``content`` as positional arg or ``content_blocks`` for typing."""
|
||||
if content_blocks is not None:
|
||||
super().__init__(
|
||||
content=cast("Union[str, list[Union[str, dict]]]", content_blocks),
|
||||
|
||||
@@ -157,7 +157,7 @@ class ToolMessage(BaseMessage, ToolOutputMixin):
|
||||
content_blocks: Optional[list[types.ContentBlock]] = None,
|
||||
**kwargs: Any,
|
||||
) -> None:
|
||||
"""Specify content as a positional arg or content_blocks for typing support."""
|
||||
"""Specify ``content`` as positional arg or ``content_blocks`` for typing."""
|
||||
if content_blocks is not None:
|
||||
super().__init__(
|
||||
content=cast("Union[str, list[Union[str, dict]]]", content_blocks),
|
||||
|
||||
Reference in New Issue
Block a user