Skip to content

Commit 9e82f1d

Browse files
authored
docs: minor clean up in ChatOpenAI docs (#30884)
1 parent fa36218 commit 9e82f1d

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

Diff for: docs/docs/integrations/chat/openai.ipynb

+23-23
Original file line numberDiff line numberDiff line change
@@ -1070,18 +1070,19 @@
10701070
},
10711071
{
10721072
"cell_type": "code",
1073-
"execution_count": 3,
1073+
"execution_count": 2,
10741074
"id": "8d322f3a-0732-45ab-ac95-dfd4596e0d85",
10751075
"metadata": {},
10761076
"outputs": [
10771077
{
1078-
"name": "stdout",
1079-
"output_type": "stream",
1080-
"text": [
1081-
"Output: 3^3 = 27.\n",
1082-
"\n",
1083-
"Reasoning: {'id': 'rs_67fffc44b1c08191b6ca9bead6d832590433145b1786f809', 'summary': [{'text': '**Calculating 3 cubed**\\n\\nThe user wants to know the value of 3 to the power of 3. That\\'s straightforward—it equals 27. I can respond simply: \"3^3 equals 27.\" To provide a little clarity, I might add that it comes from multiplying 3 by itself twice: 3 * 3 * 3 = 27. So ultimately, my answer to the user is: 27. I think keeping it plain and simple is the best approach here!', 'type': 'summary_text'}], 'type': 'reasoning'}\n"
1084-
]
1078+
"data": {
1079+
"text/plain": [
1080+
"'3^3 = 3 × 3 × 3 = 27.'"
1081+
]
1082+
},
1083+
"execution_count": 2,
1084+
"metadata": {},
1085+
"output_type": "execute_result"
10851086
}
10861087
],
10871088
"source": [
@@ -1099,32 +1100,31 @@
10991100
")\n",
11001101
"response = llm.invoke(\"What is 3^3?\")\n",
11011102
"\n",
1102-
"print(f\"Output: {response.text()}\\n\")\n",
1103-
"print(f\"Reasoning: {response.additional_kwargs['reasoning']}\")"
1103+
"# Output\n",
1104+
"response.text()"
11041105
]
11051106
},
11061107
{
11071108
"cell_type": "code",
1108-
"execution_count": 4,
1109+
"execution_count": 3,
11091110
"id": "d7dcc082-b7c8-41b7-a5e2-441b9679e41b",
11101111
"metadata": {},
11111112
"outputs": [
11121113
{
1113-
"data": {
1114-
"text/plain": [
1115-
"{'id': 'rs_67fffc44b1c08191b6ca9bead6d832590433145b1786f809',\n",
1116-
" 'summary': [{'text': '**Calculating 3 cubed**\\n\\nThe user wants to know the value of 3 to the power of 3. That\\'s straightforward—it equals 27. I can respond simply: \"3^3 equals 27.\" To provide a little clarity, I might add that it comes from multiplying 3 by itself twice: 3 * 3 * 3 = 27. So ultimately, my answer to the user is: 27. I think keeping it plain and simple is the best approach here!',\n",
1117-
" 'type': 'summary_text'}],\n",
1118-
" 'type': 'reasoning'}"
1119-
]
1120-
},
1121-
"execution_count": 4,
1122-
"metadata": {},
1123-
"output_type": "execute_result"
1114+
"name": "stdout",
1115+
"output_type": "stream",
1116+
"text": [
1117+
"**Calculating power of three**\n",
1118+
"\n",
1119+
"The user is asking for the result of 3 to the power of 3, which I know is 27. It's a straightforward question, so I’ll keep my answer concise: 27. I could explain that this is the same as multiplying 3 by itself twice: 3 × 3 × 3 equals 27. However, since the user likely just needs the answer, I’ll simply respond with 27.\n"
1120+
]
11241121
}
11251122
],
11261123
"source": [
1127-
"response.additional_kwargs[\"reasoning\"]"
1124+
"# Reasoning\n",
1125+
"reasoning = response.additional_kwargs[\"reasoning\"]\n",
1126+
"for block in reasoning[\"summary\"]:\n",
1127+
" print(block[\"text\"])"
11281128
]
11291129
},
11301130
{

0 commit comments

Comments
 (0)