-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2400 from jupyter-naas/2399-qdrant-connect-to-client
feat: Qdrant - Connect to client
- Loading branch information
Showing
7 changed files
with
1,362 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,262 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "f27ab203-2993-4ff2-8934-800db3ce9ed5", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"<img width=\"10%\" alt=\"Naas\" src=\"https://landen.imgix.net/jtci2pxwjczr/assets/5ice39g4.png?w=160\"/>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "6917dad4-d28c-4375-b28f-b1c44f0a9d8f", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"# Qdrant - Connect to cloud" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "e45809ab-2124-4175-a9e6-3bb96e70d45b", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"**Tags:** #qdrant #connect #cloud #api #credentials #authentication #snippet" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "635b9f7f-56aa-41be-a200-9cc250459b1f", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"**Author:** [Florent Ravenel](https://www.linkedin.com/in/florent-ravenel/)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "18558e1b-f098-49ec-9de3-4ee9602df6f9", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"**Last update:** 2023-11-22 (Created: 2023-11-22)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "1a195260-4370-4e3c-8cf8-f9d01a42ab62", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"**Description:** This notebook will show how to connect to Qdrant cloud." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "88a3b288-ea82-4c30-9971-c336164cf1f2", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"**References:**\n", | ||
"- [Qdrant Documentation](https://qdrant.tech/documentation/)\n", | ||
"- [Qdrant API](https://qdrant.github.io/qdrant/redoc/index.html)\n", | ||
"- [Get your Qdrant Cluster URL and API Key](https://cloud.qdrant.io/accounts)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "1a3ad3d5-a113-44db-b4e0-bfc885a6f2c9", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"## Input" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "709b99a2-bcca-49b4-b4da-8dac55e926d5", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"### Import libraries" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "550d3dad-a09a-46f7-89cf-18998cc74208", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import naas\n", | ||
"try:\n", | ||
" from qdrant_client import QdrantClient\n", | ||
"except:\n", | ||
" !pip install qdrant-client --user\n", | ||
" from qdrant_client import QdrantClient" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "315fb5b5-f33a-46a7-9d8e-0836c2fbe678", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"### Setup variables\n", | ||
"[Get your Qdrant Cluster URL and API Key](https://cloud.qdrant.io/accounts)\n", | ||
"- `url`: Qdrant cluster URL\n", | ||
"- `api_key`: Qdrant API key" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "305be68f-6026-43fb-8335-3b2df51a2001", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"url = naas.secret.get(\"QDRANT_CLUSER_URL\")\n", | ||
"api_key = naas.secret.get(\"QDRANT_API_KEY\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "28b9cf85-0c1f-428a-9008-cadc65ce21c1", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"## Model" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "37ffd794-a50f-4e6e-b5a7-45e8e2ac63ab", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"### Connect to Qdrant cloud" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "01f2e58f-08ba-49ff-96aa-a25e30ca1c05", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"qdrant_client = QdrantClient(\n", | ||
" url=url, \n", | ||
" api_key=api_key,\n", | ||
")\n", | ||
"qdrant_client" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "3f4d742f-88e7-45b5-a291-c649014030cc", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"## Output" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "5065f5a5-9112-416d-a56d-5eab22db1e91", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"### Display result" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e87aaf74-7f7f-4793-93f4-fe18666c5392", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"qdrant_client" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "56aad6a8-deec-4be3-882c-73e3e7b89ed2", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.6" | ||
}, | ||
"widgets": { | ||
"application/vnd.jupyter.widget-state+json": { | ||
"state": {}, | ||
"version_major": 2, | ||
"version_minor": 0 | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.