mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
Closes #1911 ## Why The Managing Embeddings guide described multiple embedding columns at a high level. Python readers needed a complete Pydantic example showing how to pair the fields, populate both vectors, and choose which vector column to search. ## What changed - Explain the one-to-one pairing in `LanceModel`. Use the same embedding-function instance for one `SourceField()` and one `VectorField()`, and create a separate instance for each pair even when the provider and settings match. If several fields should contribute to one vector, combine their values into a single source field before ingestion. - Add a runnable LanceDB Embedded example that pairs `title` with `title_vector` and `description` with `description_vector`. Both pairs use separate instances of `all-MiniLM-L6-v2`. Inserting rows with titles and descriptions populates both vector columns, and reopening the table preserves both mappings. - Show how `vector_column_name` selects the vector column and embedding function for a text query. Searching titles for “Alpine hiking” returns “Hiking in the Alps”, while searching descriptions for “feeding sourdough starter” returns “Baking sourdough”. - Generate the published snippet from the example test. This is a documentation and example-test change. ## Validation - The new docs test and existing multiple-embedding regression test passed. The docs test mocks only model inference and checks both persisted field mappings, the stored vectors and their dimensions, both search results, and the ambiguity error when `vector_column_name` is omitted. - The generated example also passed with the cached real model. Both columns contained 384-dimensional embeddings and both searches returned the expected articles. - Ruff lint and `git diff --check` passed. The formatter reports two existing differences in unrelated examples in the same test file.