mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-03 09:58:30 +02:00
Merge pull request #2005 from qdrant/essentials-course-fix-remove-dotenv
removed all python-dotenv snippets
This commit is contained in:
@@ -42,9 +42,7 @@ To connect to Qdrant Cloud, you need your cluster URL and API key from your Qdra
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ A working search system with:
|
|||||||
### Prerequisites
|
### Prerequisites
|
||||||
- Qdrant Cloud cluster (URL + API key)
|
- Qdrant Cloud cluster (URL + API key)
|
||||||
- Python 3.9+ (or Colab)
|
- Python 3.9+ (or Colab)
|
||||||
- Required packages: `qdrant-client`, `python-dotenv`.
|
- Required packages: `qdrant-client`.
|
||||||
|
|
||||||
### Models
|
### Models
|
||||||
- None. We will create vectors by hand.
|
- None. We will create vectors by hand.
|
||||||
@@ -52,9 +52,7 @@ For this tutorial, we'll use the **Product Categories** concept.
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -99,14 +99,12 @@ QDRANT_URL=https://YOUR-CLUSTER.cloud.qdrant.io:6333
|
|||||||
QDRANT_API_KEY=YOUR_API_KEY
|
QDRANT_API_KEY=YOUR_API_KEY
|
||||||
```
|
```
|
||||||
|
|
||||||
Load the credentials with `dotenv` and create a Qdrant client:
|
Load the credentials from the environment and create a Qdrant client:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -122,9 +122,7 @@ To create a collection with Named Vectors, you need to specify a configuration f
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ A working semantic search engine that demonstrates:
|
|||||||
### Prerequisites
|
### Prerequisites
|
||||||
- Qdrant Cloud cluster (URL + API key)
|
- Qdrant Cloud cluster (URL + API key)
|
||||||
- Python 3.9+ (or Colab)
|
- Python 3.9+ (or Colab)
|
||||||
- Packages: `qdrant-client`, `sentence-transformers`, `python-dotenv` (optional), `google.colab` (if using Colab)
|
- Packages: `qdrant-client`, `sentence-transformers`, `google.colab` (if using Colab)
|
||||||
|
|
||||||
### Models
|
### Models
|
||||||
- SentenceTransformer: `all-MiniLM-L6-v2` (384-dim)
|
- SentenceTransformer: `all-MiniLM-L6-v2` (384-dim)
|
||||||
@@ -62,9 +62,7 @@ Pick something with rich, descriptive text where semantic search adds value:
|
|||||||
from sentence_transformers import SentenceTransformer
|
from sentence_transformers import SentenceTransformer
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ Working with 100K high-dimensional vectors (1536 dimensions from OpenAI's text-e
|
|||||||
`qdrant-client`: Official Qdrant Python client for vector search operations
|
`qdrant-client`: Official Qdrant Python client for vector search operations
|
||||||
`tqdm`: Progress bars for bulk operations (essential for 100K upload tracking)
|
`tqdm`: Progress bars for bulk operations (essential for 100K upload tracking)
|
||||||
`openai`: Generate query embeddings compatible with the dataset
|
`openai`: Generate query embeddings compatible with the dataset
|
||||||
`python-dotenv`: Secure environment variable management
|
|
||||||
|
|
||||||
### Set Up API Keys
|
### Set Up API Keys
|
||||||
|
|
||||||
@@ -78,9 +77,7 @@ from tqdm import tqdm
|
|||||||
import openai
|
import openai
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -64,9 +64,7 @@ At query time, Qdrant uses a query planner to determine the appropriate strategy
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ A performance-optimized version of your Day 1 search engine that demonstrates:
|
|||||||
|
|
||||||
* Qdrant Cloud cluster (URL + API key)
|
* Qdrant Cloud cluster (URL + API key)
|
||||||
* Python 3.9+ (or Google Colab)
|
* Python 3.9+ (or Google Colab)
|
||||||
* Packages: `qdrant-client`, `sentence-transformers`, `python-dotenv`, `numpy`
|
* Packages: `qdrant-client`, `sentence-transformers`, `numpy`
|
||||||
|
|
||||||
### Models
|
### Models
|
||||||
|
|
||||||
@@ -54,9 +54,7 @@ from sentence_transformers import SentenceTransformer
|
|||||||
import time
|
import time
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -140,9 +140,7 @@ Small collections or low-dimensional vectors may not trigger HNSW indexing at al
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
@@ -186,9 +184,7 @@ Let's test the performance. First we upload some toy data to a new collection:
|
|||||||
import time
|
import time
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -57,9 +57,7 @@ The foundation of scalable ingestion is a well-designed collection configuration
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
client.recreate_collection(
|
client.recreate_collection(
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ A quantization-optimized search system that demonstrates:
|
|||||||
|
|
||||||
* Qdrant Cloud cluster (URL + API key)
|
* Qdrant Cloud cluster (URL + API key)
|
||||||
* Python 3.9+ (or Google Colab)
|
* Python 3.9+ (or Google Colab)
|
||||||
* Packages: `qdrant-client`, `numpy`, `python-dotenv`
|
* Packages: `qdrant-client`, `numpy`
|
||||||
|
|
||||||
### Models
|
### Models
|
||||||
|
|
||||||
@@ -55,9 +55,7 @@ import numpy as np
|
|||||||
|
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -46,9 +46,7 @@ For example, in our case with a limit of 4, a candidate that ranked 6th in the i
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -39,9 +39,7 @@ Scalar quantization excels as the production default because it [maintains 99%+
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -57,9 +57,7 @@ To use ColBERT for retrieval, create a collection with a multivector field confi
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ A hybrid recommendation system using:
|
|||||||
|
|
||||||
* Qdrant Cloud cluster (URL + API key)
|
* Qdrant Cloud cluster (URL + API key)
|
||||||
* Python 3.9+ (or Google Colab)
|
* Python 3.9+ (or Google Colab)
|
||||||
* Packages: `qdrant-client`, `fastembed`, `python-dotenv`
|
* Packages: `qdrant-client`, `fastembed`
|
||||||
|
|
||||||
### Models
|
### Models
|
||||||
- **Dense**: `sentence-transformers/all-MiniLM-L6-v2` (384-dim)
|
- **Dense**: `sentence-transformers/all-MiniLM-L6-v2` (384-dim)
|
||||||
@@ -56,9 +56,7 @@ First, connect to Qdrant and create a clean collection for our recommendation sy
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ First, you retrieve candidates from multiple sources in parallel and fuse their
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -36,9 +36,7 @@ from datetime import datetime, timedelta
|
|||||||
|
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ This mirrors real-world retrieval challenges where users need precise answers fr
|
|||||||
### Prerequisites
|
### Prerequisites
|
||||||
* Qdrant Cloud cluster (URL + API key)
|
* Qdrant Cloud cluster (URL + API key)
|
||||||
* Python 3.9+ (or Google Colab)
|
* Python 3.9+ (or Google Colab)
|
||||||
* Packages: `qdrant-client`, `numpy`, `python-dotenv`
|
* Packages: `qdrant-client`, `numpy`
|
||||||
|
|
||||||
### Models
|
### Models
|
||||||
- **Dense**: `BAAI/bge-small-en-v1.5` (384-dim) or `BAAI/bge-base-en-v1.5` (768-dim)
|
- **Dense**: `BAAI/bge-small-en-v1.5` (384-dim) or `BAAI/bge-base-en-v1.5` (768-dim)
|
||||||
@@ -76,9 +76,7 @@ payload = {
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
client = QdrantClient(url=os.getenv("QDRANT_URL"), api_key=os.getenv("QDRANT_API_KEY"))
|
||||||
|
|
||||||
# For Colab:
|
# For Colab:
|
||||||
|
|||||||
Reference in New Issue
Block a user