mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-06 17:57:49 +02:00
Format docs (#752)
This commit is contained in:
@@ -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)"
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user