Minor refinements and more comments
This commit is contained in:
@@ -300,6 +300,7 @@
|
||||
"source": [
|
||||
"# Claude 3.5 Sonnet again\n",
|
||||
"# Now let's add in streaming back results\n",
|
||||
"# If the streaming looks strange, then please see the note below this cell!\n",
|
||||
"\n",
|
||||
"result = claude.messages.stream(\n",
|
||||
" model=\"claude-3-5-sonnet-latest\",\n",
|
||||
@@ -316,6 +317,27 @@
|
||||
" print(text, end=\"\", flush=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "dd1e17bc-cd46-4c23-b639-0c7b748e6c5a",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## A rare problem with Claude streaming on some Windows boxes\n",
|
||||
"\n",
|
||||
"2 students have noticed a strange thing happening with Claude's streaming into Jupyter Lab's output -- it sometimes seems to swallow up parts of the response.\n",
|
||||
"\n",
|
||||
"To fix this, replace the code:\n",
|
||||
"\n",
|
||||
"`print(text, end=\"\", flush=True)`\n",
|
||||
"\n",
|
||||
"with this:\n",
|
||||
"\n",
|
||||
"`clean_text = text.replace(\"\\n\", \" \").replace(\"\\r\", \" \")` \n",
|
||||
"`print(clean_text, end=\"\", flush=True)`\n",
|
||||
"\n",
|
||||
"And it should work fine!"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
|
||||
@@ -130,6 +130,8 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# This can reveal the \"training cut off\", or the most recent date in the training data\n",
|
||||
"\n",
|
||||
"message_gpt(\"What is today's date?\")"
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user