## Snippet 1

*qdrant-client* (vlatest) — https://qdrant.tech/course/beginners/module-2/ingestion-pipeline/

Ingests two documents into a Qdrant collection by computing 384-dim sentence embeddings with FastEmbed's TextEmbedding (model: sentence-transformers/all-MiniLM-L6-v2), building PointStruct entries with id, vector, and payload (title and category), and uploading them to the articles collection via client.upload_points (handles batching and retries). Uses the Qdrant client, PointStruct, and payload-based storage; the category is indexed as a KEYWORD field to enable fast, exact payload filtering. This enables semantic vector search combined with payload filtering (e.g., filtering results by automotive category during queries).

```python
!pip install fastembed

from qdrant_client.models import PointStruct
from fastembed import TextEmbedding

model = TextEmbedding(model_name="sentence-transformers/all-MiniLM-L6-v2")  # 384-dim

documents = [
    {"id": 1, "text": "Car repair guide",  "category": "automotive"},
    {"id": 2, "text": "How to cook pasta",  "category": "food"},
]

points = [
    PointStruct(
        id=doc["id"],
        vector=vector.tolist(),
        payload={"title": doc["text"], "category": doc["category"]},
    )
    for doc, vector in zip(documents, model.embed([d["text"] for d in documents]))
]
# upload_points handles batching and retries automatically; preferred for lists of points.
# upsert is the raw operation, better for single points or small real-time updates.
client.upload_points(collection_name="articles", points=points)

```

## Snippet 2

*qdrant-client* (vlatest) — https://qdrant.tech/documentation/tutorials-basics/search-beginners/

Uploads each book to the Qdrant my_books collection as a vector point: a unique id, a vector derived from the book description using the sentence-transformers/all-minilm-l6-v2 model, and a payload containing the book’s metadata. It builds PointStruct entries with models.Document (text and model) and uses client.upload_points to store both the embedding and the payload. This enables semantic search and retrieval of semantically similar books via client.query_points, returning hits with IDs, vectors, and metadata for downstream use.

```python
EMBEDDING_MODEL="sentence-transformers/all-minilm-l6-v2"

client.upload_points(
    collection_name=COLLECTION_NAME,
    points=[
        models.PointStruct(
            id=idx,
            vector=models.Document(
                text=doc["description"],
                model=EMBEDDING_MODEL
            ),
            payload=doc
        )
        for idx, doc in enumerate(documents)
    ],
)

```

## Snippet 3

*qdrant-client* (vlatest) — https://qdrant.tech/documentation/fastembed/fastembed-rerankers/

Uploads a batch of points to the vector store’s “movies” collection, pairing each movie description with its precomputed embedding for semantic search. Each PointStruct stores an id, a payload with the textual description, and a vector under the embedding key, created by zipping descriptions with their corresponding embeddings and enumerating to assign IDs. This enables cosine-distance nearest-neighbor retrieval over movie descriptions via the upload_points API, with embedding size and distance metric configured (e.g., using a model like sentence-transformers/all-MiniLM-L6-v2 and cosine distance).

```python
client.upload_points(
    collection_name="movies",
    points=[
        models.PointStruct(
            id=idx, 
            payload={"description": description}, 
            vector={"embedding": vector}
        )
        for idx, (description, vector) in enumerate(
            zip(descriptions, descriptions_embeddings)
        )
    ],
)


```
