📈 Vector Search with Qdrant
Now let's add vector storage and search capabilities to the Potato.Examples solution using Qdrant.
1. 📦 Install Packages
From the Infrastructure project:
cd Potato.Examples.Infrastructure
dotnet add package Potato.Vectors
dotnet add package Potato.Vectors.Qdrant
2. ⚙️ Configure appsettings.json
"PotatoQdrant": {
"Host": "localhost",
"Port": 6334
}
3. 🛠 Register Services
In Program.cs of your API project:
builder.Services.AddPotatoQdrantVectors(builder.Configuration);
Ensure the collection exists at startup:
app.Lifetime.ApplicationStarted.Register(async () =>
{
await app.EnsureQdrantCollectionExists();
});
4. 🚀 Example Endpoints
app.MapPost("/vectors/add", async (float[] vector, string id, PotatoVectors vec) =>
{
await vec.Upsert(id, vector).GetOrThrow();
return Results.Ok();
});
app.MapGet("/vectors/search", async (float[] vector, PotatoVectors vec) =>
{
var results = await vec.Search(vector).GetOrThrow();
return Results.Ok(results);
});
5. 🐳 Add Qdrant to docker-compose.yml
qdrant:
image: qdrant/qdrant
ports:
- "6333:6333"
- "6334:6334"
Start it with:
docker compose up -d
✅ Summary
Qdrant is now integrated for vector storage and similarity search.
➡️ Next: Potato RAG Pipeline Quickstart Guide