This commit is contained in:
Swapna Lekkala 2025-10-02 11:39:05 -07:00
parent 26f8c86dd8
commit 0123079a91

View file

@ -34,7 +34,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 25,
"id": "a42d6950-65c2-445e-96f9-6301d36d3a0f",
"metadata": {},
"outputs": [],
@ -59,10 +59,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 26,
"id": "e45da4ef-03d9-48f7-a48f-8b5c09f2a46f",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:httpx:HTTP Request: POST http://localhost:8321/v1/vector-dbs \"HTTP/1.1 200 OK\"\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'identifier': 'acme_docs_v2', 'provider_resource_id': 'acme_docs_v2', 'provider_id': 'faiss', 'type': 'vector_db', 'owner': None, 'source': 'via_register_api', 'embedding_model': 'sentence-transformers/all-MiniLM-L6-v2', 'embedding_dimension': 384, 'vector_db_name': 'acme_docs'}\n"
]
}
],
"source": [
"# Using a low-level request for llama-stack specific API\n",
"resp = client._client.request(\n",
@ -92,10 +107,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 27,
"id": "94e3ca3c-3a8a-4e95-91a6-e87aa4221629",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:httpx:HTTP Request: GET http://localhost:8321/v1/vector-dbs \"HTTP/1.1 200 OK\"\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'data': [{'identifier': 'acme_docs_v2', 'provider_resource_id': 'acme_docs_v2', 'provider_id': 'faiss', 'type': 'vector_db', 'embedding_model': 'sentence-transformers/all-MiniLM-L6-v2', 'embedding_dimension': 384, 'vector_db_name': 'acme_docs'}]}\n"
]
}
],
"source": [
"resp = client._client.request(\n",
" \"GET\",\n",
@ -117,10 +147,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 28,
"id": "e67a8ba3-7785-4087-b0c8-442596fbdf92",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:httpx:HTTP Request: GET http://localhost:8321/v1/vector-dbs/acme_docs_v2 \"HTTP/1.1 200 OK\"\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'identifier': 'acme_docs_v2', 'provider_resource_id': 'acme_docs_v2', 'provider_id': 'faiss', 'type': 'vector_db', 'owner': None, 'source': 'via_register_api', 'embedding_model': 'sentence-transformers/all-MiniLM-L6-v2', 'embedding_dimension': 384, 'vector_db_name': 'acme_docs'}\n"
]
}
],
"source": [
"resp = client._client.request(\n",
" \"GET\",\n",
@ -144,7 +189,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 29,
"id": "3f08461a-7f9b-439e-bd38-72b68ee9a430",
"metadata": {},
"outputs": [],
@ -184,10 +229,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 30,
"id": "0fb7f7a7-6b8e-4af4-af93-ecc4fb3e1696",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:httpx:HTTP Request: POST http://localhost:8321/v1/vector-io/insert \"HTTP/1.1 200 OK\"\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"200\n",
"None\n"
]
}
],
"source": [
"resp = client._client.request(\n",
" \"POST\",\n",
@ -217,10 +278,36 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 31,
"id": "faa7e0ab-aef9-496f-a2bc-90b4eb8bc860",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:httpx:HTTP Request: POST http://localhost:8321/v1/vector-io/query \"HTTP/1.1 200 OK\"\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Chunk 1:\n",
" Metadata: {'document_id': 'Shipping Policy'}\n",
" Content : Acme ships globally in 3-5 business days.\n",
"--------------------------------------------------\n",
"Chunk 2:\n",
" Metadata: {'document_id': 'Shipping Policy'}\n",
" Content : Acme ships globally in 3-5 business days.\n",
"--------------------------------------------------\n",
"Chunk 3:\n",
" Metadata: {'document_id': 'Returns Policy'}\n",
" Content : Returns are accepted within 30 days of purchase.\n",
"--------------------------------------------------\n"
]
}
],
"source": [
"query = \"How long does Acme take to ship orders?\"\n",
"\n",
@ -244,6 +331,14 @@
" print(\" Content :\", chunk.get(\"content\"))\n",
" print(\"-\" * 50)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "aa803d10-8f3f-40e0-b621-51c847778e05",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {