Skip to content

Commit 4e0fd33

Browse files
committed
fix: update content_blocks property docstring
1 parent 2d9fe70 commit 4e0fd33

File tree

1 file changed

+18
-8
lines changed
  • libs/core/langchain_core/messages

1 file changed

+18
-8
lines changed

libs/core/langchain_core/messages/base.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,29 @@ def get_lc_namespace(cls) -> list[str]:
108108

109109
@property
110110
def content_blocks(self) -> list[types.ContentBlock]:
111-
"""Return the content as a list of standard ``ContentBlock``s.
111+
r"""Return ``content`` as a list of standardized :class:`~langchain_core.messages.content.ContentBlock`\s.
112112
113-
To use this property, the corresponding chat model must support
114-
``message_version='v1'`` or higher:
113+
.. important::
115114
116-
.. code-block:: python
115+
To use this property correctly, the corresponding ``ChatModel`` must support
116+
``message_version='v1'`` or higher (and it must be set):
117117
118-
from langchain.chat_models import init_chat_model
119-
llm = init_chat_model("...", message_version="v1")
118+
.. code-block:: python
120119
121-
Otherwise, does best-effort parsing to standard types.
120+
from langchain.chat_models import init_chat_model
121+
llm = init_chat_model("...", message_version="v1")
122122
123-
"""
123+
# or
124+
125+
from langchain-openai import ChatOpenAI
126+
llm = ChatOpenAI(model="gpt-4o", message_version="v1")
127+
128+
Otherwise, the property will perform best-effort parsing to standard types,
129+
though some content may be misinterpreted.
130+
131+
.. versionadded:: 1.0.0
132+
133+
""" # noqa: E501
124134
from langchain_core.messages import content as types
125135
from langchain_core.messages.block_translators.anthropic import (
126136
_convert_to_v1_from_anthropic_input,

0 commit comments

Comments
 (0)