How Qdrant uses SambaNova
Qdrant can generate embeddings for you, but only from models it knows about. Qdrant Cloud Inference hosts its own models, and external providers are limited to OpenAI, Cohere, Jina AI, and OpenRouter. Both are reached through Qdrant Cloud, and there is no setting for a custom base URL, so Qdrant cannot call a SambaNova endpoint for you. Qdrant’s inference options describe the alternative for teams that run their own inference service: client-side inference. You embed the text yourself, then store and query the vectors. This guide uses that approach, so your code makes both calls: it embeds text with SambaStack, then sends the vectors to Qdrant.Prerequisites
- A SambaStack instance that serves
E5-Mistral-7B-Instruct, plus the instance’s base URL and API key. See API keys and URLs. - A chat model on that instance. This guide uses
gpt-oss-120b. - A running Qdrant server, or a Qdrant Cloud cluster. To run one locally, follow the Qdrant quickstart. To try the guide without a server, create the client with
QdrantClient(":memory:")instead. - Python 3.10 or higher.
Installation and setup
Create a virtual environment
Install dependencies
qdrant-client 1.20.0, openai 3.40.0, and Qdrant server 1.20.0.Set your SambaStack base URL, API key, and Qdrant URL
/v1. The Qdrant URL below is the default for a local server. For Qdrant Cloud, set QDRANT_URL to your cluster URL and also set QDRANT_API_KEY to your cluster’s API key. A local server needs no key.Embed, store, and query
Run the steps in this section in one Python file or session. Each step uses variables from the steps before it.Embed your documents
E5-Mistral-7B-Instruct returns 4096-dimension vectors, which sets the size of the Qdrant collection in the next step.Create a collection and upsert the vectors
size to the length of the vectors you just created. Qdrant rejects an upsert whose vectors do not match that size. Point IDs must be unsigned integers or UUIDs, so the text goes in the payload.upsert waits for the write to finish by default, so you can query as soon as it returns.Query the collection
E5-Mistral-7B-Instruct is an instruction-tuned model, so write each query as an instruction followed by the question. Documents are embedded as plain text.Answer with a SambaNova chat model
question is the same question you searched with in step 3.The model answers that SambaNova makes the SN40L chip.Delete the collection when you are done
Additional resources
Qdrant documentation
Qdrant inference options
FastEmbed
Implement embeddings features
Troubleshooting
KeyError: 'QDRANT_URL'
KeyError: 'QDRANT_URL'
QDRANT_URL, SAMBANOVA_BASE_URL, or SAMBANOVA_API_KEY. Set it as shown in Installation and setup, then run the code again from the same shell.Wrong input: Vector dimension error: expected dim: 4096, got 1536
Wrong input: Vector dimension error: expected dim: 4096, got 1536
size than the vectors you are upserting. E5-Mistral-7B-Instruct returns 4096 values per input. Delete the collection and create it again with size=4096, or read the length from a returned vector as shown above.409 Conflict: Collection already exists
409 Conflict: Collection already exists
create_collection when it does; if you removed that check, delete the collection with client.delete_collection("sambanova-demo").400 Bad Request: value doc1 is not a valid point ID
400 Bad Request: value doc1 is not a valid point ID
str(uuid.uuid4()) as the ID and keep your own label in the payload.Connection refused from QdrantClient
Connection refused from QdrantClient
QDRANT_URL. Start one by following the Qdrant quickstart, then check that the URL and port match. To try the guide without a server, use QdrantClient(":memory:").401 invalid_api_key from the embeddings endpoint
401 invalid_api_key from the embeddings endpoint
SAMBANOVA_BASE_URL points at that instance and ends in /v1. Without /v1, the embeddings request returns 404 page not found.404 model_not_found for E5-Mistral-7B-Instruct
404 model_not_found for E5-Mistral-7B-Instruct
Qdrant does not offer a SambaNova model for server-side inference
Qdrant does not offer a SambaNova model for server-side inference
size and upsert vectors you generate yourself, as shown above.
