mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-02 13:55:42 +00:00
docs: minor clean up in ChatOpenAI docs (#30884)
This commit is contained in:
parent
fa362189a1
commit
9e82f1df4e
@ -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\"])"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user