docs: update cloud how-tos (#747)

This commit is contained in:
Vadym Barda
2024-06-21 14:04:25 -04:00
committed by GitHub
parent f8e7221cae
commit c99b63b9d8
9 changed files with 387 additions and 1759 deletions
@@ -35,35 +35,6 @@
"client = get_client()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "4947e9bc-111f-4991-8c41-1041da9bf0ba",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca',\n",
" 'graph_id': 'agent',\n",
" 'config': {},\n",
" 'created_at': '2024-05-18T00:19:39.688822+00:00',\n",
" 'updated_at': '2024-05-18T00:19:39.688822+00:00',\n",
" 'metadata': {'created_by': 'system'}}]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# There should always be a default assistant with no configuration\n",
"assistants = await client.assistants.search()\n",
"assistants = [a for a in assistants if not a['config']]\n",
"assistants"
]
},
{
"cell_type": "code",
"execution_count": 4,
@@ -87,8 +58,7 @@
}
],
"source": [
"assistant = assistants[0]\n",
"assistant"
"assistant_id = \"agent\""
]
},
{
@@ -188,7 +158,7 @@
"source": [
"input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in sf\"}]}\n",
"async for chunk in client.runs.stream(\n",
" thread['thread_id'], assistant['assistant_id'], input=input, stream_mode=\"updates\", interrupt_before=['action']\n",
" thread['thread_id'], assistant_id, input=input, stream_mode=\"updates\", interrupt_before=['action']\n",
"):\n",
" print(f\"Receiving new event of type: {chunk.event}...\")\n",
" print(chunk.data)\n",
@@ -239,7 +209,7 @@
"source": [
"input = None\n",
"async for chunk in client.runs.stream(\n",
" thread['thread_id'], assistant['assistant_id'], input=input, stream_mode=\"updates\", interrupt_before=['action']\n",
" thread['thread_id'], assistant_id, input=input, stream_mode=\"updates\", interrupt_before=['action']\n",
"):\n",
" print(f\"Receiving new event of type: {chunk.event}...\")\n",
" print(chunk.data)\n",
@@ -289,7 +259,7 @@
"source": [
"input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in la?\"}]}\n",
"async for chunk in client.runs.stream(\n",
" thread['thread_id'], assistant['assistant_id'], input=input, stream_mode=\"updates\", interrupt_before=['action']\n",
" thread['thread_id'], assistant_id, input=input, stream_mode=\"updates\", interrupt_before=['action']\n",
"):\n",
" print(f\"Receiving new event of type: {chunk.event}...\")\n",
" print(chunk.data)\n",
@@ -492,7 +462,7 @@
"source": [
"input = None\n",
"async for chunk in client.runs.stream(\n",
" thread['thread_id'], assistant['assistant_id'], input=input, stream_mode=\"updates\", interrupt_before=['action']\n",
" thread['thread_id'], assistant_id, input=input, stream_mode=\"updates\", interrupt_before=['action']\n",
"):\n",
" print(f\"Receiving new event of type: {chunk.event}...\")\n",
" print(chunk.data)\n",
@@ -641,7 +611,7 @@
"input = None\n",
"async for chunk in client.runs.stream(\n",
" thread['thread_id'], \n",
" assistant['assistant_id'], \n",
" assistant_id, \n",
" input=input, \n",
" stream_mode=\"updates\", \n",
" interrupt_before=['action'],\n",
@@ -677,7 +647,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.1"
"version": "3.11.9"
}
},
"nbformat": 4,