langchain-core 1.0.0a8__py3-none-any.whl → 1.0.0rc2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of langchain-core might be problematic. Click here for more details.

Files changed (142) hide show
  1. langchain_core/__init__.py +1 -1
  2. langchain_core/_api/__init__.py +0 -1
  3. langchain_core/_api/beta_decorator.py +17 -20
  4. langchain_core/_api/deprecation.py +30 -35
  5. langchain_core/_import_utils.py +1 -1
  6. langchain_core/agents.py +10 -9
  7. langchain_core/caches.py +46 -56
  8. langchain_core/callbacks/__init__.py +1 -8
  9. langchain_core/callbacks/base.py +232 -243
  10. langchain_core/callbacks/file.py +33 -33
  11. langchain_core/callbacks/manager.py +353 -416
  12. langchain_core/callbacks/stdout.py +21 -22
  13. langchain_core/callbacks/streaming_stdout.py +32 -32
  14. langchain_core/callbacks/usage.py +54 -51
  15. langchain_core/chat_history.py +43 -58
  16. langchain_core/document_loaders/base.py +21 -21
  17. langchain_core/document_loaders/langsmith.py +22 -22
  18. langchain_core/documents/__init__.py +0 -1
  19. langchain_core/documents/base.py +46 -49
  20. langchain_core/documents/transformers.py +28 -29
  21. langchain_core/embeddings/fake.py +50 -54
  22. langchain_core/example_selectors/semantic_similarity.py +4 -6
  23. langchain_core/exceptions.py +7 -8
  24. langchain_core/indexing/api.py +19 -25
  25. langchain_core/indexing/base.py +24 -24
  26. langchain_core/language_models/__init__.py +11 -27
  27. langchain_core/language_models/_utils.py +53 -54
  28. langchain_core/language_models/base.py +30 -24
  29. langchain_core/language_models/chat_models.py +123 -148
  30. langchain_core/language_models/fake_chat_models.py +7 -7
  31. langchain_core/language_models/llms.py +14 -16
  32. langchain_core/load/dump.py +3 -4
  33. langchain_core/load/load.py +7 -16
  34. langchain_core/load/serializable.py +37 -36
  35. langchain_core/messages/__init__.py +1 -16
  36. langchain_core/messages/ai.py +122 -123
  37. langchain_core/messages/base.py +31 -31
  38. langchain_core/messages/block_translators/__init__.py +17 -17
  39. langchain_core/messages/block_translators/anthropic.py +3 -3
  40. langchain_core/messages/block_translators/bedrock_converse.py +3 -3
  41. langchain_core/messages/block_translators/google_genai.py +5 -4
  42. langchain_core/messages/block_translators/google_vertexai.py +4 -32
  43. langchain_core/messages/block_translators/groq.py +117 -21
  44. langchain_core/messages/block_translators/langchain_v0.py +3 -3
  45. langchain_core/messages/block_translators/openai.py +5 -5
  46. langchain_core/messages/chat.py +2 -6
  47. langchain_core/messages/content.py +222 -209
  48. langchain_core/messages/function.py +6 -10
  49. langchain_core/messages/human.py +17 -24
  50. langchain_core/messages/modifier.py +2 -2
  51. langchain_core/messages/system.py +12 -22
  52. langchain_core/messages/tool.py +53 -69
  53. langchain_core/messages/utils.py +399 -417
  54. langchain_core/output_parsers/__init__.py +1 -14
  55. langchain_core/output_parsers/base.py +46 -47
  56. langchain_core/output_parsers/json.py +3 -4
  57. langchain_core/output_parsers/list.py +2 -2
  58. langchain_core/output_parsers/openai_functions.py +46 -44
  59. langchain_core/output_parsers/openai_tools.py +11 -16
  60. langchain_core/output_parsers/pydantic.py +10 -11
  61. langchain_core/output_parsers/string.py +2 -2
  62. langchain_core/output_parsers/transform.py +2 -2
  63. langchain_core/output_parsers/xml.py +1 -1
  64. langchain_core/outputs/__init__.py +1 -1
  65. langchain_core/outputs/chat_generation.py +14 -14
  66. langchain_core/outputs/generation.py +6 -6
  67. langchain_core/outputs/llm_result.py +5 -5
  68. langchain_core/prompt_values.py +11 -11
  69. langchain_core/prompts/__init__.py +3 -23
  70. langchain_core/prompts/base.py +33 -38
  71. langchain_core/prompts/chat.py +222 -229
  72. langchain_core/prompts/dict.py +3 -3
  73. langchain_core/prompts/few_shot.py +76 -83
  74. langchain_core/prompts/few_shot_with_templates.py +7 -9
  75. langchain_core/prompts/image.py +12 -14
  76. langchain_core/prompts/loading.py +1 -1
  77. langchain_core/prompts/message.py +3 -3
  78. langchain_core/prompts/prompt.py +20 -23
  79. langchain_core/prompts/string.py +20 -8
  80. langchain_core/prompts/structured.py +26 -27
  81. langchain_core/rate_limiters.py +50 -58
  82. langchain_core/retrievers.py +41 -182
  83. langchain_core/runnables/base.py +565 -597
  84. langchain_core/runnables/branch.py +8 -8
  85. langchain_core/runnables/config.py +37 -44
  86. langchain_core/runnables/configurable.py +9 -10
  87. langchain_core/runnables/fallbacks.py +9 -9
  88. langchain_core/runnables/graph.py +46 -50
  89. langchain_core/runnables/graph_ascii.py +19 -18
  90. langchain_core/runnables/graph_mermaid.py +20 -31
  91. langchain_core/runnables/graph_png.py +7 -7
  92. langchain_core/runnables/history.py +22 -22
  93. langchain_core/runnables/passthrough.py +11 -11
  94. langchain_core/runnables/retry.py +3 -3
  95. langchain_core/runnables/router.py +2 -2
  96. langchain_core/runnables/schema.py +33 -33
  97. langchain_core/runnables/utils.py +30 -34
  98. langchain_core/stores.py +72 -102
  99. langchain_core/sys_info.py +27 -29
  100. langchain_core/tools/__init__.py +1 -14
  101. langchain_core/tools/base.py +70 -71
  102. langchain_core/tools/convert.py +100 -104
  103. langchain_core/tools/render.py +9 -9
  104. langchain_core/tools/retriever.py +7 -7
  105. langchain_core/tools/simple.py +6 -7
  106. langchain_core/tools/structured.py +18 -24
  107. langchain_core/tracers/__init__.py +1 -9
  108. langchain_core/tracers/base.py +35 -35
  109. langchain_core/tracers/context.py +12 -17
  110. langchain_core/tracers/event_stream.py +3 -3
  111. langchain_core/tracers/langchain.py +8 -8
  112. langchain_core/tracers/log_stream.py +17 -18
  113. langchain_core/tracers/memory_stream.py +3 -3
  114. langchain_core/tracers/root_listeners.py +2 -2
  115. langchain_core/tracers/schemas.py +0 -129
  116. langchain_core/tracers/stdout.py +1 -2
  117. langchain_core/utils/__init__.py +1 -1
  118. langchain_core/utils/aiter.py +32 -32
  119. langchain_core/utils/env.py +5 -5
  120. langchain_core/utils/function_calling.py +59 -154
  121. langchain_core/utils/html.py +4 -4
  122. langchain_core/utils/input.py +3 -3
  123. langchain_core/utils/interactive_env.py +1 -1
  124. langchain_core/utils/iter.py +20 -20
  125. langchain_core/utils/json.py +1 -1
  126. langchain_core/utils/json_schema.py +2 -2
  127. langchain_core/utils/mustache.py +5 -5
  128. langchain_core/utils/pydantic.py +17 -17
  129. langchain_core/utils/strings.py +5 -5
  130. langchain_core/utils/utils.py +25 -28
  131. langchain_core/vectorstores/base.py +55 -87
  132. langchain_core/vectorstores/in_memory.py +83 -85
  133. langchain_core/vectorstores/utils.py +2 -2
  134. langchain_core/version.py +1 -1
  135. {langchain_core-1.0.0a8.dist-info → langchain_core-1.0.0rc2.dist-info}/METADATA +23 -11
  136. langchain_core-1.0.0rc2.dist-info/RECORD +172 -0
  137. langchain_core/memory.py +0 -120
  138. langchain_core/pydantic_v1/__init__.py +0 -30
  139. langchain_core/pydantic_v1/dataclasses.py +0 -23
  140. langchain_core/pydantic_v1/main.py +0 -23
  141. langchain_core-1.0.0a8.dist-info/RECORD +0 -176
  142. {langchain_core-1.0.0a8.dist-info → langchain_core-1.0.0rc2.dist-info}/WHEEL +0 -0
@@ -5,7 +5,7 @@
5
5
  change in future releases.
6
6
 
7
7
  This module provides standardized data structures for representing inputs to and
8
- outputs from LLMs. The core abstraction is the **Content Block**, a ``TypedDict``.
8
+ outputs from LLMs. The core abstraction is the **Content Block**, a `TypedDict`.
9
9
 
10
10
  **Rationale**
11
11
 
@@ -20,59 +20,59 @@ blocks into the format required by its API.
20
20
  **Extensibility**
21
21
 
22
22
  Data **not yet mapped** to a standard block may be represented using the
23
- ``NonStandardContentBlock``, which allows for provider-specific data to be included
23
+ `NonStandardContentBlock`, which allows for provider-specific data to be included
24
24
  without losing the benefits of type checking and validation.
25
25
 
26
26
  Furthermore, provider-specific fields **within** a standard block are fully supported
27
- by default in the ``extras`` field of each block. This allows for additional metadata
27
+ by default in the `extras` field of each block. This allows for additional metadata
28
28
  to be included without breaking the standard structure.
29
29
 
30
30
  !!! warning
31
- Do not heavily rely on the ``extras`` field for provider-specific data! This field
31
+ Do not heavily rely on the `extras` field for provider-specific data! This field
32
32
  is subject to deprecation in future releases as we move towards PEP 728.
33
33
 
34
34
  !!! note
35
- Following widespread adoption of `PEP 728 <https://peps.python.org/pep-0728/>`__, we
36
- will add ``extra_items=Any`` as a param to Content Blocks. This will signify to type
35
+ Following widespread adoption of [PEP 728](https://peps.python.org/pep-0728/), we
36
+ will add `extra_items=Any` as a param to Content Blocks. This will signify to type
37
37
  checkers that additional provider-specific fields are allowed outside of the
38
- ``extras`` field, and that will become the new standard approach to adding
38
+ `extras` field, and that will become the new standard approach to adding
39
39
  provider-specific metadata.
40
40
 
41
41
  ??? note
42
42
 
43
43
  **Example with PEP 728 provider-specific fields:**
44
44
 
45
- .. code-block:: python
46
-
47
- # Content block definition
48
- # NOTE: `extra_items=Any`
49
- class TextContentBlock(TypedDict, extra_items=Any):
50
- type: Literal["text"]
51
- id: NotRequired[str]
52
- text: str
53
- annotations: NotRequired[list[Annotation]]
54
- index: NotRequired[int]
55
-
56
- .. code-block:: python
57
-
58
- from langchain_core.messages.content import TextContentBlock
59
-
60
- # Create a text content block with provider-specific fields
61
- my_block: TextContentBlock = {
62
- # Add required fields
63
- "type": "text",
64
- "text": "Hello, world!",
65
- # Additional fields not specified in the TypedDict
66
- # These are valid with PEP 728 and are typed as Any
67
- "openai_metadata": {"model": "gpt-4", "temperature": 0.7},
68
- "anthropic_usage": {"input_tokens": 10, "output_tokens": 20},
69
- "custom_field": "any value",
70
- }
71
-
72
- # Mutating an existing block to add provider-specific fields
73
- openai_data = my_block["openai_metadata"] # Type: Any
74
-
75
- PEP 728 is enabled with ``# type: ignore[call-arg]`` comments to suppress
45
+ ```python
46
+ # Content block definition
47
+ # NOTE: `extra_items=Any`
48
+ class TextContentBlock(TypedDict, extra_items=Any):
49
+ type: Literal["text"]
50
+ id: NotRequired[str]
51
+ text: str
52
+ annotations: NotRequired[list[Annotation]]
53
+ index: NotRequired[int]
54
+ ```
55
+
56
+ ```python
57
+ from langchain_core.messages.content import TextContentBlock
58
+
59
+ # Create a text content block with provider-specific fields
60
+ my_block: TextContentBlock = {
61
+ # Add required fields
62
+ "type": "text",
63
+ "text": "Hello, world!",
64
+ # Additional fields not specified in the TypedDict
65
+ # These are valid with PEP 728 and are typed as Any
66
+ "openai_metadata": {"model": "gpt-4", "temperature": 0.7},
67
+ "anthropic_usage": {"input_tokens": 10, "output_tokens": 20},
68
+ "custom_field": "any value",
69
+ }
70
+
71
+ # Mutating an existing block to add provider-specific fields
72
+ openai_data = my_block["openai_metadata"] # Type: Any
73
+ ```
74
+
75
+ PEP 728 is enabled with `# type: ignore[call-arg]` comments to suppress
76
76
  warnings from type checkers that don't yet support it. The functionality works
77
77
  correctly in Python 3.13+ and will be fully supported as the ecosystem catches
78
78
  up.
@@ -81,52 +81,51 @@ to be included without breaking the standard structure.
81
81
 
82
82
  The module defines several types of content blocks, including:
83
83
 
84
- - ``TextContentBlock``: Standard text output.
85
- - ``Citation``: For annotations that link text output to a source document.
86
- - ``ToolCall``: For function calling.
87
- - ``ReasoningContentBlock``: To capture a model's thought process.
84
+ - `TextContentBlock`: Standard text output.
85
+ - `Citation`: For annotations that link text output to a source document.
86
+ - `ToolCall`: For function calling.
87
+ - `ReasoningContentBlock`: To capture a model's thought process.
88
88
  - Multimodal data:
89
- - ``ImageContentBlock``
90
- - ``AudioContentBlock``
91
- - ``VideoContentBlock``
92
- - ``PlainTextContentBlock`` (e.g. .txt or .md files)
93
- - ``FileContentBlock`` (e.g. PDFs, etc.)
89
+ - `ImageContentBlock`
90
+ - `AudioContentBlock`
91
+ - `VideoContentBlock`
92
+ - `PlainTextContentBlock` (e.g. .txt or .md files)
93
+ - `FileContentBlock` (e.g. PDFs, etc.)
94
94
 
95
95
  **Example Usage**
96
96
 
97
- .. code-block:: python
98
-
99
- # Direct construction:
100
- from langchain_core.messages.content import TextContentBlock, ImageContentBlock
101
-
102
- multimodal_message: AIMessage(
103
- content_blocks=[
104
- TextContentBlock(type="text", text="What is shown in this image?"),
105
- ImageContentBlock(
106
- type="image",
107
- url="https://www.langchain.com/images/brand/langchain_logo_text_w_white.png",
108
- mime_type="image/png",
109
- ),
110
- ]
111
- )
97
+ ```python
98
+ # Direct construction:
99
+ from langchain_core.messages.content import TextContentBlock, ImageContentBlock
100
+
101
+ multimodal_message: AIMessage(
102
+ content_blocks=[
103
+ TextContentBlock(type="text", text="What is shown in this image?"),
104
+ ImageContentBlock(
105
+ type="image",
106
+ url="https://www.langchain.com/images/brand/langchain_logo_text_w_white.png",
107
+ mime_type="image/png",
108
+ ),
109
+ ]
110
+ )
112
111
 
113
- # Using factories:
114
- from langchain_core.messages.content import create_text_block, create_image_block
115
-
116
- multimodal_message: AIMessage(
117
- content=[
118
- create_text_block("What is shown in this image?"),
119
- create_image_block(
120
- url="https://www.langchain.com/images/brand/langchain_logo_text_w_white.png",
121
- mime_type="image/png",
122
- ),
123
- ]
124
- )
112
+ # Using factories:
113
+ from langchain_core.messages.content import create_text_block, create_image_block
114
+
115
+ multimodal_message: AIMessage(
116
+ content=[
117
+ create_text_block("What is shown in this image?"),
118
+ create_image_block(
119
+ url="https://www.langchain.com/images/brand/langchain_logo_text_w_white.png",
120
+ mime_type="image/png",
121
+ ),
122
+ ]
123
+ )
124
+ ```
125
125
 
126
126
  Factory functions offer benefits such as:
127
127
  - Automatic ID generation (when not provided)
128
- - No need to manually specify the ``type`` field
129
-
128
+ - No need to manually specify the `type` field
130
129
  """
131
130
 
132
131
  from typing import Any, Literal, get_args, get_type_hints
@@ -140,12 +139,12 @@ class Citation(TypedDict):
140
139
  """Annotation for citing data from a document.
141
140
 
142
141
  !!! note
143
- ``start``/``end`` indices refer to the **response text**,
142
+ `start`/`end` indices refer to the **response text**,
144
143
  not the source text. This means that the indices are relative to the model's
145
- response, not the original document (as specified in the ``url``).
144
+ response, not the original document (as specified in the `url`).
146
145
 
147
- !!! note
148
- ``create_citation`` may also be used as a factory to create a ``Citation``.
146
+ !!! note "Factory function"
147
+ `create_citation` may also be used as a factory to create a `Citation`.
149
148
  Benefits include:
150
149
 
151
150
  * Automatic ID generation (when not provided)
@@ -157,10 +156,12 @@ class Citation(TypedDict):
157
156
  """Type of the content block. Used for discrimination."""
158
157
 
159
158
  id: NotRequired[str]
160
- """Content block identifier. Either:
159
+ """Content block identifier.
160
+
161
+ Either:
161
162
 
162
163
  - Generated by the provider (e.g., OpenAI's file ID)
163
- - Generated by LangChain upon creation (``UUID4`` prefixed with ``'lc_'``))
164
+ - Generated by LangChain upon creation (`UUID4` prefixed with `'lc_'`))
164
165
 
165
166
  """
166
167
 
@@ -174,10 +175,10 @@ class Citation(TypedDict):
174
175
  """
175
176
 
176
177
  start_index: NotRequired[int]
177
- """Start index of the **response text** (``TextContentBlock.text``)."""
178
+ """Start index of the **response text** (`TextContentBlock.text`)."""
178
179
 
179
180
  end_index: NotRequired[int]
180
- """End index of the **response text** (``TextContentBlock.text``)"""
181
+ """End index of the **response text** (`TextContentBlock.text`)"""
181
182
 
182
183
  cited_text: NotRequired[str]
183
184
  """Excerpt of source text being cited."""
@@ -202,8 +203,9 @@ class NonStandardAnnotation(TypedDict):
202
203
  """Content block identifier.
203
204
 
204
205
  Either:
206
+
205
207
  - Generated by the provider (e.g., OpenAI's file ID)
206
- - Generated by LangChain upon creation (``UUID4`` prefixed with ``'lc_'``))
208
+ - Generated by LangChain upon creation (`UUID4` prefixed with `'lc_'`))
207
209
 
208
210
  """
209
211
 
@@ -212,6 +214,7 @@ class NonStandardAnnotation(TypedDict):
212
214
 
213
215
 
214
216
  Annotation = Citation | NonStandardAnnotation
217
+ """A union of all defined `Annotation` types."""
215
218
 
216
219
 
217
220
  class TextContentBlock(TypedDict):
@@ -220,9 +223,9 @@ class TextContentBlock(TypedDict):
220
223
  This typically represents the main text content of a message, such as the response
221
224
  from a language model or the text of a user message.
222
225
 
223
- !!! note
224
- ``create_text_block`` may also be used as a factory to create a
225
- ``TextContentBlock``. Benefits include:
226
+ !!! note "Factory function"
227
+ `create_text_block` may also be used as a factory to create a
228
+ `TextContentBlock`. Benefits include:
226
229
 
227
230
  * Automatic ID generation (when not provided)
228
231
  * Required arguments strictly validated at creation time
@@ -236,8 +239,9 @@ class TextContentBlock(TypedDict):
236
239
  """Content block identifier.
237
240
 
238
241
  Either:
242
+
239
243
  - Generated by the provider (e.g., OpenAI's file ID)
240
- - Generated by LangChain upon creation (``UUID4`` prefixed with ``'lc_'``))
244
+ - Generated by LangChain upon creation (`UUID4` prefixed with `'lc_'`))
241
245
 
242
246
  """
243
247
 
@@ -245,7 +249,7 @@ class TextContentBlock(TypedDict):
245
249
  """Block text."""
246
250
 
247
251
  annotations: NotRequired[list[Annotation]]
248
- """``Citation``s and other annotations."""
252
+ """`Citation`s and other annotations."""
249
253
 
250
254
  index: NotRequired[int | str]
251
255
  """Index of block in aggregate response. Used during streaming."""
@@ -255,20 +259,19 @@ class TextContentBlock(TypedDict):
255
259
 
256
260
 
257
261
  class ToolCall(TypedDict):
258
- """Represents a request to call a tool.
262
+ """Represents an AI's request to call a tool.
259
263
 
260
264
  Example:
261
-
262
- .. code-block:: python
263
-
264
- {"name": "foo", "args": {"a": 1}, "id": "123"}
265
+ ```python
266
+ {"name": "foo", "args": {"a": 1}, "id": "123"}
267
+ ```
265
268
 
266
269
  This represents a request to call the tool named "foo" with arguments {"a": 1}
267
270
  and an identifier of "123".
268
271
 
269
- !!! note
270
- ``create_tool_call`` may also be used as a factory to create a
271
- ``ToolCall``. Benefits include:
272
+ !!! note "Factory function"
273
+ `create_tool_call` may also be used as a factory to create a
274
+ `ToolCall`. Benefits include:
272
275
 
273
276
  * Automatic ID generation (when not provided)
274
277
  * Required arguments strictly validated at creation time
@@ -301,24 +304,22 @@ class ToolCall(TypedDict):
301
304
 
302
305
 
303
306
  class ToolCallChunk(TypedDict):
304
- """A chunk of a tool call (e.g., as part of a stream).
307
+ """A chunk of a tool call (yielded when streaming).
305
308
 
306
- When merging ``ToolCallChunks`` (e.g., via ``AIMessageChunk.__add__``),
309
+ When merging `ToolCallChunks` (e.g., via `AIMessageChunk.__add__`),
307
310
  all string attributes are concatenated. Chunks are only merged if their
308
- values of ``index`` are equal and not ``None``.
311
+ values of `index` are equal and not `None`.
309
312
 
310
313
  Example:
311
-
312
- .. code-block:: python
313
-
314
- left_chunks = [ToolCallChunk(name="foo", args='{"a":', index=0)]
315
- right_chunks = [ToolCallChunk(name=None, args="1}", index=0)]
316
-
317
- (
318
- AIMessageChunk(content="", tool_call_chunks=left_chunks)
319
- + AIMessageChunk(content="", tool_call_chunks=right_chunks)
320
- ).tool_call_chunks == [ToolCallChunk(name="foo", args='{"a":1}', index=0)]
321
-
314
+ ```python
315
+ left_chunks = [ToolCallChunk(name="foo", args='{"a":', index=0)]
316
+ right_chunks = [ToolCallChunk(name=None, args="1}", index=0)]
317
+
318
+ (
319
+ AIMessageChunk(content="", tool_call_chunks=left_chunks)
320
+ + AIMessageChunk(content="", tool_call_chunks=right_chunks)
321
+ ).tool_call_chunks == [ToolCallChunk(name="foo", args='{"a":1}', index=0)]
322
+ ```
322
323
  """
323
324
 
324
325
  # TODO: Consider making fields NotRequired[str] in the future.
@@ -350,7 +351,7 @@ class ToolCallChunk(TypedDict):
350
351
  class InvalidToolCall(TypedDict):
351
352
  """Allowance for errors made by LLM.
352
353
 
353
- Here we add an ``error`` key to surface errors made during generation
354
+ Here we add an `error` key to surface errors made during generation
354
355
  (e.g., invalid JSON arguments.)
355
356
 
356
357
  """
@@ -385,7 +386,10 @@ class InvalidToolCall(TypedDict):
385
386
 
386
387
 
387
388
  class ServerToolCall(TypedDict):
388
- """Tool call that is executed server-side."""
389
+ """Tool call that is executed server-side.
390
+
391
+ For example: code execution, web search, etc.
392
+ """
389
393
 
390
394
  type: Literal["server_tool_call"]
391
395
  """Used for discrimination."""
@@ -407,7 +411,7 @@ class ServerToolCall(TypedDict):
407
411
 
408
412
 
409
413
  class ServerToolCallChunk(TypedDict):
410
- """A chunk of a tool call (as part of a stream)."""
414
+ """A chunk of a server-side tool call (yielded when streaming)."""
411
415
 
412
416
  type: Literal["server_tool_call_chunk"]
413
417
  """Used for discrimination."""
@@ -456,9 +460,9 @@ class ServerToolResult(TypedDict):
456
460
  class ReasoningContentBlock(TypedDict):
457
461
  """Reasoning output from a LLM.
458
462
 
459
- !!! note
460
- ``create_reasoning_block`` may also be used as a factory to create a
461
- ``ReasoningContentBlock``. Benefits include:
463
+ !!! note "Factory function"
464
+ `create_reasoning_block` may also be used as a factory to create a
465
+ `ReasoningContentBlock`. Benefits include:
462
466
 
463
467
  * Automatic ID generation (when not provided)
464
468
  * Required arguments strictly validated at creation time
@@ -472,8 +476,9 @@ class ReasoningContentBlock(TypedDict):
472
476
  """Content block identifier.
473
477
 
474
478
  Either:
479
+
475
480
  - Generated by the provider (e.g., OpenAI's file ID)
476
- - Generated by LangChain upon creation (``UUID4`` prefixed with ``'lc_'``))
481
+ - Generated by LangChain upon creation (`UUID4` prefixed with `'lc_'`))
477
482
 
478
483
  """
479
484
 
@@ -481,7 +486,7 @@ class ReasoningContentBlock(TypedDict):
481
486
  """Reasoning text.
482
487
 
483
488
  Either the thought summary or the raw reasoning text itself. This is often parsed
484
- from ``<think>`` tags in the model's response.
489
+ from `<think>` tags in the model's response.
485
490
 
486
491
  """
487
492
 
@@ -498,9 +503,9 @@ class ReasoningContentBlock(TypedDict):
498
503
  class ImageContentBlock(TypedDict):
499
504
  """Image data.
500
505
 
501
- !!! note
502
- ``create_image_block`` may also be used as a factory to create a
503
- ``ImageContentBlock``. Benefits include:
506
+ !!! note "Factory function"
507
+ `create_image_block` may also be used as a factory to create a
508
+ `ImageContentBlock`. Benefits include:
504
509
 
505
510
  * Automatic ID generation (when not provided)
506
511
  * Required arguments strictly validated at creation time
@@ -514,8 +519,9 @@ class ImageContentBlock(TypedDict):
514
519
  """Content block identifier.
515
520
 
516
521
  Either:
522
+
517
523
  - Generated by the provider (e.g., OpenAI's file ID)
518
- - Generated by LangChain upon creation (``UUID4`` prefixed with ``'lc_'``))
524
+ - Generated by LangChain upon creation (`UUID4` prefixed with `'lc_'`))
519
525
 
520
526
  """
521
527
 
@@ -525,7 +531,7 @@ class ImageContentBlock(TypedDict):
525
531
  mime_type: NotRequired[str]
526
532
  """MIME type of the image. Required for base64.
527
533
 
528
- `Examples from IANA <https://www.iana.org/assignments/media-types/media-types.xhtml#image>`__
534
+ [Examples from IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#image)
529
535
 
530
536
  """
531
537
 
@@ -545,9 +551,9 @@ class ImageContentBlock(TypedDict):
545
551
  class VideoContentBlock(TypedDict):
546
552
  """Video data.
547
553
 
548
- !!! note
549
- ``create_video_block`` may also be used as a factory to create a
550
- ``VideoContentBlock``. Benefits include:
554
+ !!! note "Factory function"
555
+ `create_video_block` may also be used as a factory to create a
556
+ `VideoContentBlock`. Benefits include:
551
557
 
552
558
  * Automatic ID generation (when not provided)
553
559
  * Required arguments strictly validated at creation time
@@ -561,8 +567,9 @@ class VideoContentBlock(TypedDict):
561
567
  """Content block identifier.
562
568
 
563
569
  Either:
570
+
564
571
  - Generated by the provider (e.g., OpenAI's file ID)
565
- - Generated by LangChain upon creation (``UUID4`` prefixed with ``'lc_'``))
572
+ - Generated by LangChain upon creation (`UUID4` prefixed with `'lc_'`))
566
573
 
567
574
  """
568
575
 
@@ -572,7 +579,7 @@ class VideoContentBlock(TypedDict):
572
579
  mime_type: NotRequired[str]
573
580
  """MIME type of the video. Required for base64.
574
581
 
575
- `Examples from IANA <https://www.iana.org/assignments/media-types/media-types.xhtml#video>`__
582
+ [Examples from IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#video)
576
583
 
577
584
  """
578
585
 
@@ -592,9 +599,9 @@ class VideoContentBlock(TypedDict):
592
599
  class AudioContentBlock(TypedDict):
593
600
  """Audio data.
594
601
 
595
- !!! note
596
- ``create_audio_block`` may also be used as a factory to create an
597
- ``AudioContentBlock``. Benefits include:
602
+ !!! note "Factory function"
603
+ `create_audio_block` may also be used as a factory to create an
604
+ `AudioContentBlock`. Benefits include:
598
605
  * Automatic ID generation (when not provided)
599
606
  * Required arguments strictly validated at creation time
600
607
 
@@ -607,8 +614,9 @@ class AudioContentBlock(TypedDict):
607
614
  """Content block identifier.
608
615
 
609
616
  Either:
617
+
610
618
  - Generated by the provider (e.g., OpenAI's file ID)
611
- - Generated by LangChain upon creation (``UUID4`` prefixed with ``'lc_'``))
619
+ - Generated by LangChain upon creation (`UUID4` prefixed with `'lc_'`))
612
620
 
613
621
  """
614
622
 
@@ -618,7 +626,7 @@ class AudioContentBlock(TypedDict):
618
626
  mime_type: NotRequired[str]
619
627
  """MIME type of the audio. Required for base64.
620
628
 
621
- `Examples from IANA <https://www.iana.org/assignments/media-types/media-types.xhtml#audio>`__
629
+ [Examples from IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#audio)
622
630
 
623
631
  """
624
632
 
@@ -639,18 +647,18 @@ class PlainTextContentBlock(TypedDict):
639
647
  """Plaintext data (e.g., from a document).
640
648
 
641
649
  !!! note
642
- A ``PlainTextContentBlock`` existed in ``langchain-core<1.0.0``. Although the
650
+ A `PlainTextContentBlock` existed in `langchain-core<1.0.0`. Although the
643
651
  name has carried over, the structure has changed significantly. The only shared
644
- keys between the old and new versions are ``type`` and ``text``, though the
645
- ``type`` value has changed from ``'text'`` to ``'text-plain'``.
652
+ keys between the old and new versions are `type` and `text`, though the
653
+ `type` value has changed from `'text'` to `'text-plain'`.
646
654
 
647
655
  !!! note
648
656
  Title and context are optional fields that may be passed to the model. See
649
- Anthropic `example <https://docs.anthropic.com/en/docs/build-with-claude/citations#citable-vs-non-citable-content>`__.
657
+ Anthropic [example](https://docs.claude.com/en/docs/build-with-claude/citations#citable-vs-non-citable-content).
650
658
 
651
- !!! note
652
- ``create_plaintext_block`` may also be used as a factory to create a
653
- ``PlainTextContentBlock``. Benefits include:
659
+ !!! note "Factory function"
660
+ `create_plaintext_block` may also be used as a factory to create a
661
+ `PlainTextContentBlock`. Benefits include:
654
662
 
655
663
  * Automatic ID generation (when not provided)
656
664
  * Required arguments strictly validated at creation time
@@ -664,8 +672,9 @@ class PlainTextContentBlock(TypedDict):
664
672
  """Content block identifier.
665
673
 
666
674
  Either:
675
+
667
676
  - Generated by the provider (e.g., OpenAI's file ID)
668
- - Generated by LangChain upon creation (``UUID4`` prefixed with ``'lc_'``))
677
+ - Generated by LangChain upon creation (`UUID4` prefixed with `'lc_'`))
669
678
 
670
679
  """
671
680
 
@@ -698,18 +707,18 @@ class PlainTextContentBlock(TypedDict):
698
707
 
699
708
 
700
709
  class FileContentBlock(TypedDict):
701
- """File data that doesn't fit into other multimodal blocks.
710
+ """File data that doesn't fit into other multimodal block types.
702
711
 
703
712
  This block is intended for files that are not images, audio, or plaintext. For
704
713
  example, it can be used for PDFs, Word documents, etc.
705
714
 
706
715
  If the file is an image, audio, or plaintext, you should use the corresponding
707
- content block type (e.g., ``ImageContentBlock``, ``AudioContentBlock``,
708
- ``PlainTextContentBlock``).
716
+ content block type (e.g., `ImageContentBlock`, `AudioContentBlock`,
717
+ `PlainTextContentBlock`).
709
718
 
710
- !!! note
711
- ``create_file_block`` may also be used as a factory to create a
712
- ``FileContentBlock``. Benefits include:
719
+ !!! note "Factory function"
720
+ `create_file_block` may also be used as a factory to create a
721
+ `FileContentBlock`. Benefits include:
713
722
 
714
723
  * Automatic ID generation (when not provided)
715
724
  * Required arguments strictly validated at creation time
@@ -723,8 +732,9 @@ class FileContentBlock(TypedDict):
723
732
  """Content block identifier.
724
733
 
725
734
  Either:
735
+
726
736
  - Generated by the provider (e.g., OpenAI's file ID)
727
- - Generated by LangChain upon creation (``UUID4`` prefixed with ``'lc_'``))
737
+ - Generated by LangChain upon creation (`UUID4` prefixed with `'lc_'`))
728
738
 
729
739
  """
730
740
 
@@ -734,7 +744,7 @@ class FileContentBlock(TypedDict):
734
744
  mime_type: NotRequired[str]
735
745
  """MIME type of the file. Required for base64.
736
746
 
737
- `Examples from IANA <https://www.iana.org/assignments/media-types/media-types.xhtml>`__
747
+ [Examples from IANA](https://www.iana.org/assignments/media-types/media-types.xhtml)
738
748
 
739
749
  """
740
750
 
@@ -764,14 +774,14 @@ class NonStandardContentBlock(TypedDict):
764
774
  The purpose of this block should be to simply hold a provider-specific payload.
765
775
  If a provider's non-standard output includes reasoning and tool calls, it should be
766
776
  the adapter's job to parse that payload and emit the corresponding standard
767
- ``ReasoningContentBlock`` and ``ToolCalls``.
777
+ `ReasoningContentBlock` and `ToolCalls`.
768
778
 
769
- Has no ``extras`` field, as provider-specific data should be included in the
770
- ``value`` field.
779
+ Has no `extras` field, as provider-specific data should be included in the
780
+ `value` field.
771
781
 
772
- !!! note
773
- ``create_non_standard_block`` may also be used as a factory to create a
774
- ``NonStandardContentBlock``. Benefits include:
782
+ !!! note "Factory function"
783
+ `create_non_standard_block` may also be used as a factory to create a
784
+ `NonStandardContentBlock`. Benefits include:
775
785
 
776
786
  * Automatic ID generation (when not provided)
777
787
  * Required arguments strictly validated at creation time
@@ -785,8 +795,9 @@ class NonStandardContentBlock(TypedDict):
785
795
  """Content block identifier.
786
796
 
787
797
  Either:
798
+
788
799
  - Generated by the provider (e.g., OpenAI's file ID)
789
- - Generated by LangChain upon creation (``UUID4`` prefixed with ``'lc_'``))
800
+ - Generated by LangChain upon creation (`UUID4` prefixed with `'lc_'`))
790
801
 
791
802
  """
792
803
 
@@ -805,6 +816,7 @@ DataContentBlock = (
805
816
  | PlainTextContentBlock
806
817
  | FileContentBlock
807
818
  )
819
+ """A union of all defined multimodal data `ContentBlock` types."""
808
820
 
809
821
  ToolContentBlock = (
810
822
  ToolCall | ToolCallChunk | ServerToolCall | ServerToolCallChunk | ServerToolResult
@@ -818,6 +830,7 @@ ContentBlock = (
818
830
  | DataContentBlock
819
831
  | ToolContentBlock
820
832
  )
833
+ """A union of all defined `ContentBlock` types and aliases."""
821
834
 
822
835
 
823
836
  KNOWN_BLOCK_TYPES = {
@@ -842,7 +855,7 @@ KNOWN_BLOCK_TYPES = {
842
855
  "non_standard",
843
856
  # citation and non_standard_annotation intentionally omitted
844
857
  }
845
- """These are block types known to ``langchain-core>=1.0.0``.
858
+ """These are block types known to `langchain-core>=1.0.0`.
846
859
 
847
860
  If a block has a type not in this set, it is considered to be provider-specific.
848
861
  """
@@ -881,7 +894,7 @@ def is_data_content_block(block: dict) -> bool:
881
894
  block: The content block to check.
882
895
 
883
896
  Returns:
884
- True if the content block is a data content block, False otherwise.
897
+ `True` if the content block is a data content block, `False` otherwise.
885
898
 
886
899
  """
887
900
  if block.get("type") not in _get_data_content_block_types():
@@ -923,20 +936,20 @@ def create_text_block(
923
936
  index: int | str | None = None,
924
937
  **kwargs: Any,
925
938
  ) -> TextContentBlock:
926
- """Create a ``TextContentBlock``.
939
+ """Create a `TextContentBlock`.
927
940
 
928
941
  Args:
929
942
  text: The text content of the block.
930
943
  id: Content block identifier. Generated automatically if not provided.
931
- annotations: ``Citation``s and other annotations for the text.
944
+ annotations: `Citation`s and other annotations for the text.
932
945
  index: Index of block in aggregate response. Used during streaming.
933
946
 
934
947
  Returns:
935
- A properly formatted ``TextContentBlock``.
948
+ A properly formatted `TextContentBlock`.
936
949
 
937
950
  !!! note
938
- The ``id`` is generated automatically if not provided, using a UUID4 format
939
- prefixed with ``'lc_'`` to indicate it is a LangChain-generated ID.
951
+ The `id` is generated automatically if not provided, using a UUID4 format
952
+ prefixed with `'lc_'` to indicate it is a LangChain-generated ID.
940
953
 
941
954
  """
942
955
  block = TextContentBlock(
@@ -966,7 +979,7 @@ def create_image_block(
966
979
  index: int | str | None = None,
967
980
  **kwargs: Any,
968
981
  ) -> ImageContentBlock:
969
- """Create an ``ImageContentBlock``.
982
+ """Create an `ImageContentBlock`.
970
983
 
971
984
  Args:
972
985
  url: URL of the image.
@@ -977,15 +990,15 @@ def create_image_block(
977
990
  index: Index of block in aggregate response. Used during streaming.
978
991
 
979
992
  Returns:
980
- A properly formatted ``ImageContentBlock``.
993
+ A properly formatted `ImageContentBlock`.
981
994
 
982
995
  Raises:
983
- ValueError: If no image source is provided or if ``base64`` is used without
984
- ``mime_type``.
996
+ ValueError: If no image source is provided or if `base64` is used without
997
+ `mime_type`.
985
998
 
986
999
  !!! note
987
- The ``id`` is generated automatically if not provided, using a UUID4 format
988
- prefixed with ``'lc_'`` to indicate it is a LangChain-generated ID.
1000
+ The `id` is generated automatically if not provided, using a UUID4 format
1001
+ prefixed with `'lc_'` to indicate it is a LangChain-generated ID.
989
1002
 
990
1003
  """
991
1004
  if not any([url, base64, file_id]):
@@ -1022,7 +1035,7 @@ def create_video_block(
1022
1035
  index: int | str | None = None,
1023
1036
  **kwargs: Any,
1024
1037
  ) -> VideoContentBlock:
1025
- """Create a ``VideoContentBlock``.
1038
+ """Create a `VideoContentBlock`.
1026
1039
 
1027
1040
  Args:
1028
1041
  url: URL of the video.
@@ -1033,15 +1046,15 @@ def create_video_block(
1033
1046
  index: Index of block in aggregate response. Used during streaming.
1034
1047
 
1035
1048
  Returns:
1036
- A properly formatted ``VideoContentBlock``.
1049
+ A properly formatted `VideoContentBlock`.
1037
1050
 
1038
1051
  Raises:
1039
- ValueError: If no video source is provided or if ``base64`` is used without
1040
- ``mime_type``.
1052
+ ValueError: If no video source is provided or if `base64` is used without
1053
+ `mime_type`.
1041
1054
 
1042
1055
  !!! note
1043
- The ``id`` is generated automatically if not provided, using a UUID4 format
1044
- prefixed with ``'lc_'`` to indicate it is a LangChain-generated ID.
1056
+ The `id` is generated automatically if not provided, using a UUID4 format
1057
+ prefixed with `'lc_'` to indicate it is a LangChain-generated ID.
1045
1058
 
1046
1059
  """
1047
1060
  if not any([url, base64, file_id]):
@@ -1082,7 +1095,7 @@ def create_audio_block(
1082
1095
  index: int | str | None = None,
1083
1096
  **kwargs: Any,
1084
1097
  ) -> AudioContentBlock:
1085
- """Create an ``AudioContentBlock``.
1098
+ """Create an `AudioContentBlock`.
1086
1099
 
1087
1100
  Args:
1088
1101
  url: URL of the audio.
@@ -1093,15 +1106,15 @@ def create_audio_block(
1093
1106
  index: Index of block in aggregate response. Used during streaming.
1094
1107
 
1095
1108
  Returns:
1096
- A properly formatted ``AudioContentBlock``.
1109
+ A properly formatted `AudioContentBlock`.
1097
1110
 
1098
1111
  Raises:
1099
- ValueError: If no audio source is provided or if ``base64`` is used without
1100
- ``mime_type``.
1112
+ ValueError: If no audio source is provided or if `base64` is used without
1113
+ `mime_type`.
1101
1114
 
1102
1115
  !!! note
1103
- The ``id`` is generated automatically if not provided, using a UUID4 format
1104
- prefixed with ``'lc_'`` to indicate it is a LangChain-generated ID.
1116
+ The `id` is generated automatically if not provided, using a UUID4 format
1117
+ prefixed with `'lc_'` to indicate it is a LangChain-generated ID.
1105
1118
 
1106
1119
  """
1107
1120
  if not any([url, base64, file_id]):
@@ -1142,7 +1155,7 @@ def create_file_block(
1142
1155
  index: int | str | None = None,
1143
1156
  **kwargs: Any,
1144
1157
  ) -> FileContentBlock:
1145
- """Create a ``FileContentBlock``.
1158
+ """Create a `FileContentBlock`.
1146
1159
 
1147
1160
  Args:
1148
1161
  url: URL of the file.
@@ -1153,15 +1166,15 @@ def create_file_block(
1153
1166
  index: Index of block in aggregate response. Used during streaming.
1154
1167
 
1155
1168
  Returns:
1156
- A properly formatted ``FileContentBlock``.
1169
+ A properly formatted `FileContentBlock`.
1157
1170
 
1158
1171
  Raises:
1159
- ValueError: If no file source is provided or if ``base64`` is used without
1160
- ``mime_type``.
1172
+ ValueError: If no file source is provided or if `base64` is used without
1173
+ `mime_type`.
1161
1174
 
1162
1175
  !!! note
1163
- The ``id`` is generated automatically if not provided, using a UUID4 format
1164
- prefixed with ``'lc_'`` to indicate it is a LangChain-generated ID.
1176
+ The `id` is generated automatically if not provided, using a UUID4 format
1177
+ prefixed with `'lc_'` to indicate it is a LangChain-generated ID.
1165
1178
 
1166
1179
  """
1167
1180
  if not any([url, base64, file_id]):
@@ -1203,7 +1216,7 @@ def create_plaintext_block(
1203
1216
  index: int | str | None = None,
1204
1217
  **kwargs: Any,
1205
1218
  ) -> PlainTextContentBlock:
1206
- """Create a ``PlainTextContentBlock``.
1219
+ """Create a `PlainTextContentBlock`.
1207
1220
 
1208
1221
  Args:
1209
1222
  text: The plaintext content.
@@ -1216,11 +1229,11 @@ def create_plaintext_block(
1216
1229
  index: Index of block in aggregate response. Used during streaming.
1217
1230
 
1218
1231
  Returns:
1219
- A properly formatted ``PlainTextContentBlock``.
1232
+ A properly formatted `PlainTextContentBlock`.
1220
1233
 
1221
1234
  !!! note
1222
- The ``id`` is generated automatically if not provided, using a UUID4 format
1223
- prefixed with ``'lc_'`` to indicate it is a LangChain-generated ID.
1235
+ The `id` is generated automatically if not provided, using a UUID4 format
1236
+ prefixed with `'lc_'` to indicate it is a LangChain-generated ID.
1224
1237
 
1225
1238
  """
1226
1239
  block = PlainTextContentBlock(
@@ -1259,7 +1272,7 @@ def create_tool_call(
1259
1272
  index: int | str | None = None,
1260
1273
  **kwargs: Any,
1261
1274
  ) -> ToolCall:
1262
- """Create a ``ToolCall``.
1275
+ """Create a `ToolCall`.
1263
1276
 
1264
1277
  Args:
1265
1278
  name: The name of the tool to be called.
@@ -1268,11 +1281,11 @@ def create_tool_call(
1268
1281
  index: Index of block in aggregate response. Used during streaming.
1269
1282
 
1270
1283
  Returns:
1271
- A properly formatted ``ToolCall``.
1284
+ A properly formatted `ToolCall`.
1272
1285
 
1273
1286
  !!! note
1274
- The ``id`` is generated automatically if not provided, using a UUID4 format
1275
- prefixed with ``'lc_'`` to indicate it is a LangChain-generated ID.
1287
+ The `id` is generated automatically if not provided, using a UUID4 format
1288
+ prefixed with `'lc_'` to indicate it is a LangChain-generated ID.
1276
1289
 
1277
1290
  """
1278
1291
  block = ToolCall(
@@ -1298,7 +1311,7 @@ def create_reasoning_block(
1298
1311
  index: int | str | None = None,
1299
1312
  **kwargs: Any,
1300
1313
  ) -> ReasoningContentBlock:
1301
- """Create a ``ReasoningContentBlock``.
1314
+ """Create a `ReasoningContentBlock`.
1302
1315
 
1303
1316
  Args:
1304
1317
  reasoning: The reasoning text or thought summary.
@@ -1306,11 +1319,11 @@ def create_reasoning_block(
1306
1319
  index: Index of block in aggregate response. Used during streaming.
1307
1320
 
1308
1321
  Returns:
1309
- A properly formatted ``ReasoningContentBlock``.
1322
+ A properly formatted `ReasoningContentBlock`.
1310
1323
 
1311
1324
  !!! note
1312
- The ``id`` is generated automatically if not provided, using a UUID4 format
1313
- prefixed with ``'lc_'`` to indicate it is a LangChain-generated ID.
1325
+ The `id` is generated automatically if not provided, using a UUID4 format
1326
+ prefixed with `'lc_'` to indicate it is a LangChain-generated ID.
1314
1327
 
1315
1328
  """
1316
1329
  block = ReasoningContentBlock(
@@ -1339,7 +1352,7 @@ def create_citation(
1339
1352
  id: str | None = None,
1340
1353
  **kwargs: Any,
1341
1354
  ) -> Citation:
1342
- """Create a ``Citation``.
1355
+ """Create a `Citation`.
1343
1356
 
1344
1357
  Args:
1345
1358
  url: URL of the document source.
@@ -1350,11 +1363,11 @@ def create_citation(
1350
1363
  id: Content block identifier. Generated automatically if not provided.
1351
1364
 
1352
1365
  Returns:
1353
- A properly formatted ``Citation``.
1366
+ A properly formatted `Citation`.
1354
1367
 
1355
1368
  !!! note
1356
- The ``id`` is generated automatically if not provided, using a UUID4 format
1357
- prefixed with ``'lc_'`` to indicate it is a LangChain-generated ID.
1369
+ The `id` is generated automatically if not provided, using a UUID4 format
1370
+ prefixed with `'lc_'` to indicate it is a LangChain-generated ID.
1358
1371
 
1359
1372
  """
1360
1373
  block = Citation(type="citation", id=ensure_id(id))
@@ -1383,7 +1396,7 @@ def create_non_standard_block(
1383
1396
  id: str | None = None,
1384
1397
  index: int | str | None = None,
1385
1398
  ) -> NonStandardContentBlock:
1386
- """Create a ``NonStandardContentBlock``.
1399
+ """Create a `NonStandardContentBlock`.
1387
1400
 
1388
1401
  Args:
1389
1402
  value: Provider-specific data.
@@ -1391,11 +1404,11 @@ def create_non_standard_block(
1391
1404
  index: Index of block in aggregate response. Used during streaming.
1392
1405
 
1393
1406
  Returns:
1394
- A properly formatted ``NonStandardContentBlock``.
1407
+ A properly formatted `NonStandardContentBlock`.
1395
1408
 
1396
1409
  !!! note
1397
- The ``id`` is generated automatically if not provided, using a UUID4 format
1398
- prefixed with ``'lc_'`` to indicate it is a LangChain-generated ID.
1410
+ The `id` is generated automatically if not provided, using a UUID4 format
1411
+ prefixed with `'lc_'` to indicate it is a LangChain-generated ID.
1399
1412
 
1400
1413
  """
1401
1414
  block = NonStandardContentBlock(