Vectorization converts text into dense numerical vectors, or embeddings, that capture semantic relationships. In semantic search, it lets a query match relevant content even when the wording differs. section 5.1
Matching by meaning
A query about returning an opened laptop can be close in vector space to a passage about electronics returns and restocking fees, despite sharing few words. section 5.1
In an ingestion pipeline, documents are parsed and split into coherent chunks. An embedding model converts each chunk to a vector, which is stored with its text and metadata. At search time, the query is also embedded and compared with stored vectors; matching chunks return with source attribution, scores, and metadata. section 5.1
Embedding configuration belongs to the index. All its chunks must use the same model because vectors from different models occupy different spaces and cannot be meaningfully compared. Model and dimension settings are fixed when the index is created. Higher-dimensional vectors can capture more nuance, but increase storage and similarity-computation costs. section 5.2.2 section 5.3.6
Listing 5.1 Index configuration dataclass
@dataclass
class IndexConfig:
name: str #A
embedding_model: str =
➥"text-embedding-3-small" #B
embedding_dimensions: int = 1536 #B
chunking_strategy: str = "fixed" #C
chunk_size: int = 512 #C
chunk_overlap: int = 50 #C
metadata_schema: Optional[Dict] = None #DThe index configuration groups embedding model and dimensions with chunking and metadata settings. section 5.2.2
Generate embeddings through a model service rather than calling providers directly. The service can reuse provider abstraction, cost tracking, retries, and routing. Batch chunk texts before calling embed(), and embed queries using the index's model. section 5.3.6
Listing 5.12 Embedding generation through the Model Service
class EmbeddingGenerator:
def __init__(self, model_client): #A
self.model_client = model_client
def embed_chunks(
self,
chunks: List[Chunk],
model: str = "text-embedding-3-small",
batch_size: int = 100 #B
) -> List[List[float]]:
all_embeddings = []
for i in range(0, len(chunks), batch_size):
batch = chunks[i:i + batch_size]
texts = [chunk.text for chunk in batch]
response = self.model_client.embed( #C
texts=texts,
model=model
)
all_embeddings.extend(response.embeddings)
return all_embeddings
def embed_query(
self, query: str, model: str
) -> List[float]: #D
response = self.model_client.embed(
texts=[query],
model=model
)
return response.embeddings[0]The generator batches chunks and delegates embedding requests to a model client. section 5.3.6
Operate embedding configurations as index-level choices:
- Select models suited to each collection, and restrict choices with an allowlist when cost or external data handling is a concern. section 5.2.1
- To change models, create a new index, re-ingest documents, validate retrieval, and switch traffic. Keep the old index available for rollback. section 5.2.2
- Use metadata filtering alongside similarity search when semantically similar documents serve different audiences. section 5.1





















