|
1070 | 1070 | },
|
1071 | 1071 | {
|
1072 | 1072 | "cell_type": "code",
|
1073 |
| - "execution_count": 3, |
| 1073 | + "execution_count": 2, |
1074 | 1074 | "id": "8d322f3a-0732-45ab-ac95-dfd4596e0d85",
|
1075 | 1075 | "metadata": {},
|
1076 | 1076 | "outputs": [
|
1077 | 1077 | {
|
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" |
1085 | 1086 | }
|
1086 | 1087 | ],
|
1087 | 1088 | "source": [
|
|
1099 | 1100 | ")\n",
|
1100 | 1101 | "response = llm.invoke(\"What is 3^3?\")\n",
|
1101 | 1102 | "\n",
|
1102 |
| - "print(f\"Output: {response.text()}\\n\")\n", |
1103 |
| - "print(f\"Reasoning: {response.additional_kwargs['reasoning']}\")" |
| 1103 | + "# Output\n", |
| 1104 | + "response.text()" |
1104 | 1105 | ]
|
1105 | 1106 | },
|
1106 | 1107 | {
|
1107 | 1108 | "cell_type": "code",
|
1108 |
| - "execution_count": 4, |
| 1109 | + "execution_count": 3, |
1109 | 1110 | "id": "d7dcc082-b7c8-41b7-a5e2-441b9679e41b",
|
1110 | 1111 | "metadata": {},
|
1111 | 1112 | "outputs": [
|
1112 | 1113 | {
|
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 | + ] |
1124 | 1121 | }
|
1125 | 1122 | ],
|
1126 | 1123 | "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\"])" |
1128 | 1128 | ]
|
1129 | 1129 | },
|
1130 | 1130 | {
|
|
0 commit comments