Skip to content

Commit 2428815

Browse files
authored
feat: standard content, IDs, translators, & normalization (#32569)
1 parent a2322f6 commit 2428815

File tree

88 files changed

+8776
-1126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+8776
-1126
lines changed

docs/docs/how_to/multimodal_inputs.ipynb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
},
5959
{
6060
"cell_type": "code",
61-
"execution_count": 10,
61+
"execution_count": null,
6262
"id": "1fcf7b27-1cc3-420a-b920-0420b5892e20",
6363
"metadata": {},
6464
"outputs": [
@@ -102,7 +102,7 @@
102102
" ],\n",
103103
"}\n",
104104
"response = llm.invoke([message])\n",
105-
"print(response.text())"
105+
"print(response.text)"
106106
]
107107
},
108108
{
@@ -133,7 +133,7 @@
133133
},
134134
{
135135
"cell_type": "code",
136-
"execution_count": 2,
136+
"execution_count": null,
137137
"id": "99d27f8f-ae78-48bc-9bf2-3cef35213ec7",
138138
"metadata": {},
139139
"outputs": [
@@ -163,7 +163,7 @@
163163
" ],\n",
164164
"}\n",
165165
"response = llm.invoke([message])\n",
166-
"print(response.text())"
166+
"print(response.text)"
167167
]
168168
},
169169
{
@@ -176,7 +176,7 @@
176176
},
177177
{
178178
"cell_type": "code",
179-
"execution_count": 4,
179+
"execution_count": null,
180180
"id": "325fb4ca",
181181
"metadata": {},
182182
"outputs": [
@@ -198,7 +198,7 @@
198198
" ],\n",
199199
"}\n",
200200
"response = llm.invoke([message])\n",
201-
"print(response.text())"
201+
"print(response.text)"
202202
]
203203
},
204204
{
@@ -234,7 +234,7 @@
234234
},
235235
{
236236
"cell_type": "code",
237-
"execution_count": 3,
237+
"execution_count": null,
238238
"id": "6c1455a9-699a-4702-a7e0-7f6eaec76a21",
239239
"metadata": {},
240240
"outputs": [
@@ -284,7 +284,7 @@
284284
" ],\n",
285285
"}\n",
286286
"response = llm.invoke([message])\n",
287-
"print(response.text())"
287+
"print(response.text)"
288288
]
289289
},
290290
{
@@ -312,7 +312,7 @@
312312
},
313313
{
314314
"cell_type": "code",
315-
"execution_count": 4,
315+
"execution_count": null,
316316
"id": "55e1d937-3b22-4deb-b9f0-9e688f0609dc",
317317
"metadata": {},
318318
"outputs": [
@@ -342,7 +342,7 @@
342342
" ],\n",
343343
"}\n",
344344
"response = llm.invoke([message])\n",
345-
"print(response.text())"
345+
"print(response.text)"
346346
]
347347
},
348348
{
@@ -417,7 +417,7 @@
417417
" ],\n",
418418
"}\n",
419419
"response = llm.invoke([message])\n",
420-
"print(response.text())"
420+
"print(response.text)"
421421
]
422422
},
423423
{
@@ -443,7 +443,7 @@
443443
},
444444
{
445445
"cell_type": "code",
446-
"execution_count": 2,
446+
"execution_count": null,
447447
"id": "83593b9d-a8d3-4c99-9dac-64e0a9d397cb",
448448
"metadata": {},
449449
"outputs": [
@@ -488,13 +488,13 @@
488488
" ],\n",
489489
"}\n",
490490
"response = llm.invoke([message])\n",
491-
"print(response.text())\n",
491+
"print(response.text)\n",
492492
"response.usage_metadata"
493493
]
494494
},
495495
{
496496
"cell_type": "code",
497-
"execution_count": 3,
497+
"execution_count": null,
498498
"id": "9bbf578e-794a-4dc0-a469-78c876ccd4a3",
499499
"metadata": {},
500500
"outputs": [
@@ -530,7 +530,7 @@
530530
" ],\n",
531531
"}\n",
532532
"response = llm.invoke([message, response, next_message])\n",
533-
"print(response.text())\n",
533+
"print(response.text)\n",
534534
"response.usage_metadata"
535535
]
536536
},
@@ -600,7 +600,7 @@
600600
},
601601
{
602602
"cell_type": "code",
603-
"execution_count": 5,
603+
"execution_count": null,
604604
"id": "ae076c9b-ff8f-461d-9349-250f396c9a25",
605605
"metadata": {},
606606
"outputs": [
@@ -641,7 +641,7 @@
641641
" ],\n",
642642
"}\n",
643643
"response = llm.invoke([message])\n",
644-
"print(response.text())"
644+
"print(response.text)"
645645
]
646646
},
647647
{

docs/docs/how_to/multimodal_prompts.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
},
5555
{
5656
"cell_type": "code",
57-
"execution_count": 2,
57+
"execution_count": null,
5858
"id": "5df2e558-321d-4cf7-994e-2815ac37e704",
5959
"metadata": {},
6060
"outputs": [
@@ -75,7 +75,7 @@
7575
"\n",
7676
"chain = prompt | llm\n",
7777
"response = chain.invoke({\"image_url\": url})\n",
78-
"print(response.text())"
78+
"print(response.text)"
7979
]
8080
},
8181
{
@@ -117,7 +117,7 @@
117117
},
118118
{
119119
"cell_type": "code",
120-
"execution_count": 4,
120+
"execution_count": null,
121121
"id": "25e4829e-0073-49a8-9669-9f43e5778383",
122122
"metadata": {},
123123
"outputs": [
@@ -144,7 +144,7 @@
144144
" \"cache_type\": \"ephemeral\",\n",
145145
" }\n",
146146
")\n",
147-
"print(response.text())"
147+
"print(response.text)"
148148
]
149149
},
150150
{

docs/docs/integrations/chat/anthropic.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@
14571457
},
14581458
{
14591459
"cell_type": "code",
1460-
"execution_count": 1,
1460+
"execution_count": null,
14611461
"id": "30a0af36-2327-4b1d-9ba5-e47cb72db0be",
14621462
"metadata": {},
14631463
"outputs": [
@@ -1493,7 +1493,7 @@
14931493
"response = llm_with_tools.invoke(\n",
14941494
" \"There's a syntax error in my primes.py file. Can you help me fix it?\"\n",
14951495
")\n",
1496-
"print(response.text())\n",
1496+
"print(response.text)\n",
14971497
"response.tool_calls"
14981498
]
14991499
},

docs/docs/integrations/chat/bedrock.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,12 @@
243243
"id": "0ef05abb-9c04-4dc3-995e-f857779644d5",
244244
"metadata": {},
245245
"source": [
246-
"You can filter to text using the [.text()](https://python.langchain.com/api_reference/core/messages/langchain_core.messages.ai.AIMessage.html#langchain_core.messages.ai.AIMessage.text) method on the output:"
246+
"You can filter to text using the [.text](https://python.langchain.com/api_reference/core/messages/langchain_core.messages.ai.AIMessage.html#langchain_core.messages.ai.AIMessage.text) property on the output:"
247247
]
248248
},
249249
{
250250
"cell_type": "code",
251-
"execution_count": 5,
251+
"execution_count": null,
252252
"id": "2a4e743f-ea7d-4e5a-9b12-f9992362de8b",
253253
"metadata": {},
254254
"outputs": [
@@ -262,7 +262,7 @@
262262
],
263263
"source": [
264264
"for chunk in llm.stream(messages):\n",
265-
" print(chunk.text(), end=\"|\")"
265+
" print(chunk.text, end=\"|\")"
266266
]
267267
},
268268
{

docs/docs/integrations/chat/litellm.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
},
262262
{
263263
"cell_type": "code",
264-
"execution_count": 5,
264+
"execution_count": null,
265265
"id": "c5fac0e9-05a4-4fc1-a3b3-e5bbb24b971b",
266266
"metadata": {
267267
"colab": {
@@ -286,7 +286,7 @@
286286
],
287287
"source": [
288288
"async for token in llm.astream(\"Hello, please explain how antibiotics work\"):\n",
289-
" print(token.text(), end=\"\")"
289+
" print(token.text, end=\"\")"
290290
]
291291
},
292292
{

docs/docs/integrations/chat/openai.ipynb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@
814814
},
815815
{
816816
"cell_type": "code",
817-
"execution_count": 2,
817+
"execution_count": null,
818818
"id": "1f758726-33ef-4c04-8a54-49adb783bbb3",
819819
"metadata": {},
820820
"outputs": [
@@ -860,7 +860,7 @@
860860
"llm_with_tools = llm.bind_tools([tool])\n",
861861
"\n",
862862
"response = llm_with_tools.invoke(\"What is deep research by OpenAI?\")\n",
863-
"print(response.text())"
863+
"print(response.text)"
864864
]
865865
},
866866
{
@@ -1151,7 +1151,7 @@
11511151
},
11521152
{
11531153
"cell_type": "code",
1154-
"execution_count": 8,
1154+
"execution_count": null,
11551155
"id": "073f6010-6b0e-4db6-b2d3-7427c8dec95b",
11561156
"metadata": {},
11571157
"outputs": [
@@ -1167,7 +1167,7 @@
11671167
}
11681168
],
11691169
"source": [
1170-
"response_2.text()"
1170+
"response_2.text"
11711171
]
11721172
},
11731173
{
@@ -1198,7 +1198,7 @@
11981198
},
11991199
{
12001200
"cell_type": "code",
1201-
"execution_count": 10,
1201+
"execution_count": null,
12021202
"id": "b6da5bd6-a44a-4c64-970b-30da26b003d6",
12031203
"metadata": {},
12041204
"outputs": [
@@ -1214,7 +1214,7 @@
12141214
}
12151215
],
12161216
"source": [
1217-
"response_2.text()"
1217+
"response_2.text"
12181218
]
12191219
},
12201220
{
@@ -1404,7 +1404,7 @@
14041404
},
14051405
{
14061406
"cell_type": "code",
1407-
"execution_count": 1,
1407+
"execution_count": null,
14081408
"id": "51d3e4d3-ea78-426c-9205-aecb0937fca7",
14091409
"metadata": {},
14101410
"outputs": [
@@ -1428,13 +1428,13 @@
14281428
"messages = [{\"role\": \"user\", \"content\": first_query}]\n",
14291429
"\n",
14301430
"response = llm_with_tools.invoke(messages)\n",
1431-
"response_text = response.text()\n",
1431+
"response_text = response.text\n",
14321432
"print(f\"{response_text[:100]}... {response_text[-100:]}\")"
14331433
]
14341434
},
14351435
{
14361436
"cell_type": "code",
1437-
"execution_count": 2,
1437+
"execution_count": null,
14381438
"id": "b248bedf-2050-4c17-a90e-3a26eeb1b055",
14391439
"metadata": {},
14401440
"outputs": [
@@ -1460,7 +1460,7 @@
14601460
" ]\n",
14611461
")\n",
14621462
"second_response = llm_with_tools.invoke(messages)\n",
1463-
"print(second_response.text())"
1463+
"print(second_response.text)"
14641464
]
14651465
},
14661466
{
@@ -1482,7 +1482,7 @@
14821482
},
14831483
{
14841484
"cell_type": "code",
1485-
"execution_count": 3,
1485+
"execution_count": null,
14861486
"id": "009e541a-b372-410e-b9dd-608a8052ce09",
14871487
"metadata": {},
14881488
"outputs": [
@@ -1502,12 +1502,12 @@
15021502
" output_version=\"responses/v1\",\n",
15031503
")\n",
15041504
"response = llm.invoke(\"Hi, I'm Bob.\")\n",
1505-
"print(response.text())"
1505+
"print(response.text)"
15061506
]
15071507
},
15081508
{
15091509
"cell_type": "code",
1510-
"execution_count": 4,
1510+
"execution_count": null,
15111511
"id": "393a443a-4c5f-4a07-bc0e-c76e529b35e3",
15121512
"metadata": {},
15131513
"outputs": [
@@ -1524,7 +1524,7 @@
15241524
" \"What is my name?\",\n",
15251525
" previous_response_id=response.response_metadata[\"id\"],\n",
15261526
")\n",
1527-
"print(second_response.text())"
1527+
"print(second_response.text)"
15281528
]
15291529
},
15301530
{
@@ -1589,7 +1589,7 @@
15891589
},
15901590
{
15911591
"cell_type": "code",
1592-
"execution_count": 2,
1592+
"execution_count": null,
15931593
"id": "8d322f3a-0732-45ab-ac95-dfd4596e0d85",
15941594
"metadata": {},
15951595
"outputs": [
@@ -1616,7 +1616,7 @@
16161616
"response = llm.invoke(\"What is 3^3?\")\n",
16171617
"\n",
16181618
"# Output\n",
1619-
"response.text()"
1619+
"response.text"
16201620
]
16211621
},
16221622
{

0 commit comments

Comments
 (0)