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
+11 -57
View File
@@ -40,75 +40,29 @@
{
"cell_type": "code",
"execution_count": 3,
"id": "4947e9bc-111f-4991-8c41-1041da9bf0ba",
"id": "230c0464-a6e5-420f-9e38-ca514e5634ce",
"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"
}
],
"outputs": [],
"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"
"assistant_id = \"agent\""
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "230c0464-a6e5-420f-9e38-ca514e5634ce",
"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": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"assistant = assistants[0]\n",
"assistant"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "56aa5159-5583-4134-9210-709b969bda6f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'thread_id': '1eee9bd4-ec61-4300-a38a-2e13b8925d39',\n",
" 'created_at': '2024-05-18T19:57:36.509105+00:00',\n",
" 'updated_at': '2024-05-18T19:57:36.509105+00:00',\n",
"{'thread_id': '979e3c89-a702-4882-87c2-7a59a250ce16',\n",
" 'created_at': '2024-06-21T15:22:07.453100+00:00',\n",
" 'updated_at': '2024-06-21T15:22:07.453100+00:00',\n",
" 'metadata': {}}"
]
},
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
@@ -120,7 +74,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"id": "147c3f98-f889-4f05-a090-6b31f2a0b291",
"metadata": {},
"outputs": [
@@ -130,7 +84,7 @@
"[]"
]
},
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
@@ -180,7 +134,7 @@
],
"source": [
"input = {\"messages\": [{\"role\": \"human\", \"content\": \"what's the weather in la\"}]}\n",
"async for chunk in client.runs.stream(thread['thread_id'], assistant['assistant_id'], input=input, stream_mode=\"updates\", ):\n",
"async for chunk in client.runs.stream(thread['thread_id'], assistant_id, input=input, stream_mode=\"updates\", ):\n",
" print(f\"Receiving new event of type: {chunk.event}...\")\n",
" print(chunk.data)\n",
" print(\"\\n\\n\")"
@@ -211,7 +165,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.1"
"version": "3.11.9"
}
},
"nbformat": 4,