In Weaviate, what does setting a text2vec vectorizer on a collection do?
answer
- server-side embedding, not client-side
- two moments: import and query
- credential rides in a header
- external round-trip per text query
basics
~20 sA configured vectorizer makes Weaviate call the embedding model itself: you insert plain properties and the server produces the vector, and a text query is embedded server-side too. Without one you must supply every vector yourself.
solid answer
~40 sIn the v4 Python client you attach a module at collection creation, for example `vectorizer_config=Configure.Vectorizer.text2vec_openai()`. From then on Weaviate owns embedding for that collection at two moments. **On import**, each object's vectorizable text properties are concatenated and sent to the model, and the returned vector is stored and indexed — your `data.insert()` call carries only properties, no vector. **On query**, a text search embeds the query string through the same module before the ANN lookup, so the query and the corpus share one embedding space by construction. The credential is not stored in the schema: it travels as a request header such as `X-OpenAI-Api-Key` on the client connection, and the module must be enabled on the server via `ENABLE_MODULES`. The tradeoff is an external round-trip on every import and every text query.
code
python · 16 linesimport weaviate
from weaviate.classes.config import Configure, Property, DataType
client = weaviate.connect_to_local(headers={"X-OpenAI-Api-Key": "sk-..."})
client.collections.create(
name="Article",
properties=[
Property(name="title", data_type=DataType.TEXT),
Property(name="body", data_type=DataType.TEXT),
],
vectorizer_config=Configure.Vectorizer.text2vec_openai(),
)
articles = client.collections.get("Article")
articles.data.insert({"title": "Vector search", "body": "An overview."})go deeper
Be able to say plainly that with a vectorizer configured you insert text and Weaviate produces the vector, and that a text query gets embedded the same way. Know the config lives on the collection.
Explain both moments — import and query — and where the credential comes from. Mention that the module must be enabled on the server and that the vectorizer is fixed at collection creation.
Talk about the operational consequences: import throughput bounded by the provider, an external dependency in the query path, failed objects surfacing in the batch result, and what a model swap actually costs.
Own the coupling argument. Server-side vectorization makes the database depend on a third-party inference endpoint for both writes and reads; be ready to say when that dependency is acceptable and when embedding belongs in your own pipeline.
## The idea Most vector stores are strictly a place to put vectors: you run an embedding model yourself, and you hand the store a list of floats. Weaviate can do that too, but it also offers *modules* — server-side plugins that call an embedding model on your behalf. A `text2vec-*` module turns text into a vector; `multi2vec-clip` turns images and text into one shared space. Attaching one to a collection means Weaviate, not your application, is responsible for producing embeddings for that collection. ## Configuring it In the v4 Python client the module is part of the collection definition: Collection creation takes `vectorizer_config=Configure.Vectorizer.text2vec_openai()` (older spelling) or, on recent clients, `vector_config=Configure.Vectors.text2vec_openai()`. Either way the choice is baked into the collection at creation time. It is schema, not a per-request option — you cannot flip a collection from one vectorizer to another and have existing objects re-embed themselves. ## What happens on import When you call `data.insert({"title": "...", "body": "..."})`, the server: 1. Assembles a single text string from the object's vectorizable properties. 2. Sends that string to the configured model (an HTTP call to the provider for `text2vec-openai`, or to a local inference container for `text2vec-transformers`). 3. Stores the returned vector alongside the object and inserts it into the collection's ANN index. So import throughput is bounded by the embedding backend, not by Weaviate. A large batch import is effectively a large batch of model calls. If the provider rate-limits or errors, those objects fail to import; in the v4 batch API the offending objects show up in the batch's `failed_objects`, which is the first place to look when a load run "succeeded" but the collection is short of rows. ## What happens on query A vector search needs a query vector. With a vectorizer configured, a text query is embedded by the *same* module before the nearest-neighbour lookup runs, so query and corpus land in the same space automatically. That convenience has a cost: every text query pays one extra network round-trip to the embedding provider before Weaviate does any of its own work. Under load this is often the dominant term in p99 latency, and it is a dependency your database now has on a third party. Searching with a vector you already have avoids the round-trip entirely. ## Credentials and enablement Two things must be true for a hosted module to work. First, the module has to be enabled on the server process — the `ENABLE_MODULES` environment variable lists the modules the instance loads, and `DEFAULT_VECTORIZER_MODULE` can set the fallback for collections that do not name one. A schema referencing a module the server did not load is rejected. Second, the module needs a credential. Weaviate deliberately does not persist API keys in the schema; you pass them per connection as headers, for example `headers={"X-OpenAI-Api-Key": ...}` on `connect_to_local`. A common first failure is a working schema plus a client that forgot the header, which surfaces as an error on the first insert rather than at create time. ## What it does not change The vectorizer decides how vectors are *produced*. It does not decide how they are *indexed* — HNSW versus flat, and the index's own parameters, are separate configuration. It also does not change the shape of your data model: properties, types and filters are unaffected. ## When it is the wrong choice Server-side vectorization is a good fit when the collection's text is the thing you search and you would otherwise write a small embedding service of your own. It fits badly when you need one model version pinned across several systems, when you want to embed on your own GPU fleet with your own batching, when the same text is already embedded elsewhere in your pipeline and re-embedding it is wasted spend, or when you cannot accept a synchronous external dependency in the query path. In those cases you configure no vectorizer and supply vectors yourself.
- Where does the API key for a hosted vectorizer module live, and why not in the schema?It travels as a per-connection request header, for example `X-OpenAI-Api-Key` passed in `headers` when you connect. Keeping it out of the schema means the credential is never persisted in collection metadata, never returned by a schema read, and can be rotated or scoped per client without touching the collection definition.
- What happens to import throughput when a collection has a vectorizer configured?It becomes bounded by the embedding backend rather than by Weaviate. Every object triggers a model call, so provider rate limits and inference latency set your ceiling. Batch imports amortise the HTTP overhead but not the inference cost, and rejected objects surface in the batch's failed_objects rather than raising per insert.
- Can you change a collection's vectorizer after it holds data?Not meaningfully. The vectorizer is fixed at collection creation, and existing objects are not re-embedded if you could change it — old vectors would sit in a different space from new ones and ranking would quietly degrade. The real procedure is to create a new collection (or a new named vector) with the new module and re-import.
It is the difference between bringing your own translated document and asking the librarian to translate it for you as you file it — convenient, but now the library needs the translator to be reachable.
saying these in an interview costs you the question
- Thinking you still pass a vector when a vectorizer is configured
- Believing the API key is stored in the collection schema
- Assuming the vectorizer also chooses the ANN index type
- Thinking changing the vectorizer re-embeds existing objects
- Ignoring that every text query adds an external model round-trip