Format docs (#752)

This commit is contained in:
William FH
2024-06-22 14:35:41 -07:00
committed by GitHub
parent b4d815e32a
commit a514ad41d4
16 changed files with 227 additions and 115 deletions
+16 -4
View File
@@ -23,11 +23,13 @@
"\n",
"client = get_client()\n",
"\n",
"openai_assistant = await client.assistants.create(graph_id=\"agent\", config={\"configurable\": {\"model_name\": \"openai\"}})\n",
"openai_assistant = await client.assistants.create(\n",
" graph_id=\"agent\", config={\"configurable\": {\"model_name\": \"openai\"}}\n",
")\n",
"\n",
"# There should always be a default assistant with no configuration\n",
"assistants = await client.assistants.search()\n",
"default_assistant = [a for a in assistants if not a['config']][0]"
"default_assistant = [a for a in assistants if not a[\"config\"]][0]"
]
},
{
@@ -117,7 +119,12 @@
"source": [
"thread = await client.threads.create()\n",
"input = {\"messages\": [{\"role\": \"user\", \"content\": \"who made you?\"}]}\n",
"async for event in client.runs.stream(thread['thread_id'], openai_assistant['assistant_id'], input=input, stream_mode='updates'):\n",
"async for event in client.runs.stream(\n",
" thread[\"thread_id\"],\n",
" openai_assistant[\"assistant_id\"],\n",
" input=input,\n",
" stream_mode=\"updates\",\n",
"):\n",
" print(event)"
]
},
@@ -147,7 +154,12 @@
],
"source": [
"input = {\"messages\": [{\"role\": \"user\", \"content\": \"and you?\"}]}\n",
"async for event in client.runs.stream(thread['thread_id'], default_assistant['assistant_id'], input=input, stream_mode='updates'):\n",
"async for event in client.runs.stream(\n",
" thread[\"thread_id\"],\n",
" default_assistant[\"assistant_id\"],\n",
" input=input,\n",
" stream_mode=\"updates\",\n",
"):\n",
" print(event)"
]
},