diff --git a/docs/docs/integrations/chat/openai.ipynb b/docs/docs/integrations/chat/openai.ipynb index 76a6f9b191f..457293aac9e 100644 --- a/docs/docs/integrations/chat/openai.ipynb +++ b/docs/docs/integrations/chat/openai.ipynb @@ -1070,18 +1070,19 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "8d322f3a-0732-45ab-ac95-dfd4596e0d85", "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "Output: 3^3 = 27.\n", - "\n", - "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" - ] + "data": { + "text/plain": [ + "'3^3 = 3 × 3 × 3 = 27.'" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -1099,32 +1100,31 @@ ")\n", "response = llm.invoke(\"What is 3^3?\")\n", "\n", - "print(f\"Output: {response.text()}\\n\")\n", - "print(f\"Reasoning: {response.additional_kwargs['reasoning']}\")" + "# Output\n", + "response.text()" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "d7dcc082-b7c8-41b7-a5e2-441b9679e41b", "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "{'id': 'rs_67fffc44b1c08191b6ca9bead6d832590433145b1786f809',\n", - " '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", - " 'type': 'summary_text'}],\n", - " 'type': 'reasoning'}" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "**Calculating power of three**\n", + "\n", + "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" + ] } ], "source": [ - "response.additional_kwargs[\"reasoning\"]" + "# Reasoning\n", + "reasoning = response.additional_kwargs[\"reasoning\"]\n", + "for block in reasoning[\"summary\"]:\n", + " print(block[\"text\"])" ] }, {