Skip to main content
Qdrant is an open-source vector database. You can use it with SambaNova by generating embeddings with a SambaStack embedding model, storing the vectors in a Qdrant collection, and answering questions with a SambaNova chat model.
Embeddings are available on SambaStack only. E5-Mistral-7B-Instruct is not available on SambaCloud. See Implement embeddings features.On SambaCloud, you can still use Qdrant. Set SAMBANOVA_BASE_URL to https://api.sambanova.ai/v1, install FastEmbed with pip install "qdrant-client[fastembed]", and replace the embed function in step 1 with one that embeds locally:
The rest of the guide works unchanged.

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.
macOS ships with Python 3.9 and exposes it as python3 rather than python. Check your version with python3 --version. If it is below 3.10, install a supported version with pyenv, uv, or brew install python@3.12 before continuing.

Installation and setup

1

Create a virtual environment

2

Install dependencies

This guide was tested with qdrant-client 1.20.0, openai 3.40.0, and Qdrant server 1.20.0.
3

Set your SambaStack base URL, API key, and Qdrant URL

The SambaStack base URL must end in /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.
1

Embed your documents

The OpenAI client works against the SambaStack embeddings endpoint. E5-Mistral-7B-Instruct returns 4096-dimension vectors, which sets the size of the Qdrant collection in the next step.
2

Create a collection and upsert the vectors

Set the collection’s 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.
3

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.
The closest match is the passage about the SN40L chip, with a cosine score of about 0.71. The next closest scores about 0.47. Higher is closer.
4

Answer with a SambaNova chat model

Pass the retrieved passages to a chat model as context.
question is the same question you searched with in step 3.The model answers that SambaNova makes the SN40L chip.
5

Delete the collection when you are done

Additional resources

Qdrant documentation

Official guides covering collections, points, search, and deployment.

Qdrant inference options

Server-side and client-side ways to generate embeddings for Qdrant.

FastEmbed

Qdrant’s local embedding library, used in the SambaCloud tip above.

Implement embeddings features

How to use SambaNova embedding models on SambaStack.

Troubleshooting

An environment variable from the setup step is not set in the shell you run Python from. The error names the missing variable, such as 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.
The collection was created with a different 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.
The collection already exists. The code above skips create_collection when it does; if you removed that check, delete the collection with client.delete_collection("sambanova-demo").
Point IDs must be an unsigned integer or a UUID. Use a number or str(uuid.uuid4()) as the ID and keep your own label in the payload.
No Qdrant server is listening at 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:").
The SambaNova key is wrong for the base URL. Use the key issued for your SambaStack instance, and make sure SAMBANOVA_BASE_URL points at that instance and ends in /v1. Without /v1, the embeddings request returns 404 page not found.
The instance you are calling does not serve the model, or your key cannot access it. List the models the instance serves:
SambaCloud does not serve embeddings. See the SambaCloud tip at the top of this page.
This is expected. Qdrant generates embeddings only with its Cloud Inference models and the OpenAI, Cohere, Jina AI, and OpenRouter providers. Create the collection with a size and upsert vectors you generate yourself, as shown above.