Commit Graph
215 Commits
Author SHA1 Message Date
KeeProMiseandXuanwo a85cb92ffd feat: support vector-only and FTS-only reranking (#3024)
Add rerank_vector() and rerank_fts() methods to Reranker trait, allowing
rerankers to work with single search modes instead of only hybrid
search.

Implemented for:
- RRFReranker (Rust and Python)
- LinearCombinationReranker (Python)

Resolves TODO at rust/lancedb/src/rerankers.rs:55

Changes:
- Extended Reranker trait with default implementations
- Added unit tests for new methods
- Updated documentation with examples

---------

Co-authored-by: Xuanwo <github@xuanwo.io>
2026-12-01 17:07:02 +08:00
Alex Shen 08911d6378 docs: import LanceDB in the NVIDIA example (#5320)
## Summary

The first Python example in the NVIDIA Nemotron guide calls
`lancedb.connect` without importing `lancedb`. Import the module so
readers can run the example in a fresh Python session.

## Test plan

- Ran the first fenced Python example from the guide in a fresh
namespace. The original raised `NameError` at the connection call.
- Reran the changed example with SDK stubs. It reached table creation,
insert, and search without calling a live NVIDIA endpoint.
- Checked that the diff changes only the import.

AI assistance disclosure. OpenAI Codex helped prepare and verify this
documentation change.
2026-12-01 12:06:08 +08:00
071c220713 docs: clarify embedding comparisons in time-travel RAG (#5318)
## Summary

Clarify what the Time-Travel RAG example demonstrates. It retrieves
different top documents with two embedding models. Distances are
measured within each model's embedding space. The text now gives readers
a way to evaluate relevance with the same queries and labeled judgments,
and links to the current embedding guide outside the terminal excerpt.

## Validation

Checked that the revised excerpt preserves the two recorded results and
that `/embedding` resolves to the embedding guide. A small Euclidean
example confirmed that rescaling embeddings can change distances while
preserving the ranking. The diff check passed. Validation covered the
tutorial text, link, and numeric example.

AI disclosure — OpenAI Codex checked the upstream recipe and
documentation, edited the tutorial, and validated the example and link.

Co-authored-by: AlexShen-Oguri <176059206+AlexShen-Oguri@users.noreply.github.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
2026-12-01 11:06:05 +08:00
Xuanwo ca4c2ae5de docs: document streaming Blob outputs for Functions (#5307)
The Function guides still hide their `BlobWriter` guidance. LanceDB
Enterprise 1.16.0 ships the server and worker support for computed
column refresh, and the paired Python SDK `0.42.0b38` includes #5171.
Show how to register a writer-based Function with that release pair and
when to keep returning `bytes`.

Both pages were rendered locally before and after the change. The
updated HTML includes the release pair, writer annotations, and plain
SQL `SELECT` fallback.

For the release pairing, we checked that the Enterprise 1.16.0 release
commit contains the server and worker implementation and that the image
digests promoted for release match the qualified bundle. We also
compared `functions.py` and `_blob_writer.py` in the released Linux
wheel with their tagged sources. Both files matched byte for byte. [SDK
release
source](https://github.com/lancedb/lancedb/tree/v0.42.0-beta.38/python/python/lancedb)
2026-12-01 01:46:08 +08:00
Yang Cen af23585259 docs(sql): clarify JSON scalar index eligibility (#5306)
The JSON function reference promises index acceleration for every
accessor. Document the key and type requirements for typed lookups,
explain serialized ordering for `json_extract`, and link to `EXPLAIN` so
readers can check their plan.

Checked the examples against LanceDB's pinned Lance implementation and
verified the documentation link and `git diff --check`.

Related to lance-format/lance#8806.
2026-12-01 00:35:43 +08:00
80c889cd9e docs: explain merge insert execution costs (#4501)
resolves #4258

## Summary

- document how indexed partial-column merges patch columns across
touched fragments
- explain how full-scan merges rewrite rows and can materialize the
target table
- describe the index-coverage, batching, and memory tradeoffs
- align the Python, Rust, and TypeScript `use_index` API documentation

## Verification

- `git diff --check`
- Ruff 0.15.20 formatting check for `python/python/lancedb/merge.py`
- Biome 1.9.4 check for `nodejs/lancedb/merge.ts`
- reviewed the rendered MDX structure and cross-SDK wording

The TypeDoc generation command was also attempted. It cannot complete in
this checkout because the Rust-generated `nodejs/lancedb/native.d.ts`
artifact is absent and Rust tooling is not installed; TypeDoc stops on
the resulting pre-existing module-resolution errors before generating
output.

---------

Signed-off-by: Himanshu S <me.mrhimanshu@gmail.com>
Co-authored-by: Himanshu <18554133+mrhimanshu@users.noreply.github.com>
Co-authored-by: Himanshu S <me.mrhimanshu@gmail.com>
2026-11-30 21:23:27 +08:00
Juampi 0ba8b6f0a8 docs: add Firecrawl integration page (#4706)
I work at Firecrawl. This adds a Firecrawl page to Integrations > Data
Platforms & Frameworks: a Python recipe that crawls a site with
Firecrawl, stores the pages as Markdown chunks with their source URL in
a LanceDB table that embeds them through the embedding registry,
searches the table, and then adds web search results to the same table.

It follows the docs workflow in CONTRIBUTING.md:

- The example is a test, `docs/web-tests/py/test_firecrawl.py`, split
into five `--8<--` snippets. Like the other integration snippets that
need a provider key, it skips unless `FIRECRAWL_API_KEY` is set.
- `docs/web/snippets/firecrawl.mdx` is generated from it with `uv run
docs/web-tests/mdx_snippets_gen.py -s docs/web-tests/py -s
docs/web-tests/ts -s docs/web-tests/rs -o docs/web/snippets`. The
generator also rewrites other snippet files on current `main` without
this change, so I left those out.
- `docs/web/integrations/data/firecrawl.mdx` imports the snippets with
`<CodeBlock>` like the dlt page, and every heading has an explicit
`{#anchor}`.
- `docs/web/docs.json` adds the page at the end of the Data Platforms &
Frameworks group.

The embedding function is `sentence-transformers` with
`all-MiniLM-L6-v2`, so the recipe needs no API key besides Firecrawl's.
Each Firecrawl call passes `integration="_lancedb"`, a label that tells
Firecrawl a request came from this guide; the page says it is optional.
It needs `firecrawl-py` 4.3.3 or later.

## Testing

```
$ FIRECRAWL_API_KEY=... pytest docs/web-tests/py/test_firecrawl.py -v
test_firecrawl.py::test_firecrawl_crawl_and_search PASSED     (lancedb 0.40.0, Python 3.12)
$ pytest docs/web-tests/py/test_firecrawl.py -rs              (no key)
SKIPPED [1] Set FIRECRAWL_API_KEY to run this integration snippet
$ ruff format --check docs/web-tests/py/test_firecrawl.py && ruff check docs/web-tests/py/test_firecrawl.py
1 file already formatted
All checks passed!
```

Regenerating the snippets from the test produces the same
`docs/web/snippets/firecrawl.mdx`. I have not run the Mintlify site
checks (`mint validate`, broken-links), so please run them in CI or on
your side.

I drafted this with an AI coding assistant and ran the test above
myself.
2026-11-30 21:13:16 +08:00
Haocheng LiuandHaocheng Liu 80582fb87d docs: fix training and dedupe examples (#4932)
## Summary

- Save per-rank dataset checkpoints to separate files and load the
matching file when resuming.
- Add the missing LanceDB import to the data loader example.
- Correct the count of distinct rows in the deduplication example.

## Validation

- `git diff --check`
- Parsed the Python snippets in the affected training pages with
`ast.parse`.

---------

Co-authored-by: Haocheng Liu <haocheng.liu@general-int.com>
2026-11-30 21:09:38 +08:00
lancedb-gatefixer[bot] d9db83de65 fix!: guard remote index routes against dot segments (#5013)
BREAKING CHANGE: Older Enterprise index listings that require per-index
statistics now omit historical entries with empty names, `.` or `..`.
Remote index operations reject these unaddressable names. Operators
needing to remove such entries can use server-side maintenance; direct
native access also supports cleanup. Ordinary index names and
`exist_ok=True` reuse require no migration.

Fixes #5007

Remote index URLs previously allowed `.` and `..` as path segments.
Reqwest normalizes them, so dropping an index named `..` could send the
table-level drop request and delete the table.

Guard the remote statistics, prewarm, and drop routes against empty
names, `.` and `..`, then percent-encode all other names. Index creation
retains its existing name policy on both backends, including names such
as `Customer lookup` and `café_idx` and reuse through `exist_ok=True`.
The same remote guard applies on checked-out branches.

Enriched Enterprise listings retain these entries without issuing stats
requests. Native cleanup is covered by a regression test. API
documentation explains these limits, and website release guidance
remains a non-rendering draft.

Validation:

- Before the review fix, 12 of 15 focused regressions failed,
reproducing valid-name rejection, generated-name reuse failure, and
mixed legacy-list failure.
- 60 focused Rust tests passed, covering unsafe routes, encoded names,
mixed legacy/enriched listings, generated names, native and Enterprise
lifecycles, checked-out branches, and `exist_ok` preservation of index
identity, definition, and table version.
- Rebuilt the Python extension in the uv-managed environment from
`python/uv.lock`; all 28 targeted Python tests passed, including both
names and synchronous/asynchronous `exist_ok` reuse.
- Node native build, TypeScript type checking, lint/format checks, four
targeted index tests, and generated API documentation passed.
- Rust formatting, Clippy (`remote`, tests and examples), Python
formatting/lint, repository-wide Typos 1.26.0, and `git diff --check`
passed. Native builds used the repository `ci` profile with
`remote,lancedb/metrics-otel` enabled for Python and Node.
- Repository-root Ruff lint reports 59 existing errors in unchanged
`docs/web-tests`; Python-package lint passes.

<!-- lance-gatekeeper-fix:v1 agent=1ef05de7bc00306ccd6f8a60b9a81003
generation=1 -->

<!-- gatefixer-walkthrough:v1
head=6b25e10810ea1d11a4ef56be63c4ef50225f65d6 -->
## Change walkthrough

```mermaid
flowchart TD
    entry["Listed index"] --> typed{"Type available?"}
    typed -->|Yes| include["Include index"]
    typed -->|No| safe{"Addressable name?"}
    safe -->|No| omit["Omit entry"]
    safe -->|Yes| stats["Encode and fetch stats"]
    stats --> include
```

Creation preserves existing name support; remote routes reject only
empty names, `.` and `..`.

**Read:** [Route
guard](https://github.com/lancedb/lancedb/blob/6b25e10810ea1d11a4ef56be63c4ef50225f65d6/rust/lancedb/src/remote/table.rs#L102-L112)
→ [Listing
fallback](https://github.com/lancedb/lancedb/blob/6b25e10810ea1d11a4ef56be63c4ef50225f65d6/rust/lancedb/src/remote/table.rs#L2534-L2596)
→ [Index-preservation
regression](https://github.com/lancedb/lancedb/blob/6b25e10810ea1d11a4ef56be63c4ef50225f65d6/rust/lancedb/src/table/create_index.rs#L1431-L1481).

<sub>Snapshot:
[6b25e10](https://github.com/lancedb/lancedb/commit/6b25e10810ea1d11a4ef56be63c4ef50225f65d6)</sub>
<!-- gatefixer-walkthrough:end -->

---------

Co-authored-by: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com>
2026-11-30 20:51:19 +08:00
Sudhir Vissa 97c88659f4 fix(python)!: fetch minimum rank-fusion window per side in hybrid search (#4772)
BREAKING CHANGE: Executing or analyzing an async Python hybrid query
with `limit(0)` now raises `ValueError` before either search runs. In
0.41.0, `offset(2).limit(0).to_arrow()` returned a typed empty table
after retrieval and reranking. Skip query execution and `analyze_plan()`
when the requested page size is zero.

Refs #4758

## Problem
Each side of a hybrid query fetched only `limit + offset` rows before
rank fusion, so asking for fewer results could return a different top
result instead of just a shorter list.

Repro (lancedb 0.41.0, 300 rows, RRF reranker):
- `limit=1` -> top id 294
- `limit=10` -> top id 269

## Fix
With the default RRF reranker, both hybrid paths
(`LanceHybridQueryBuilder._create_query_builders` and
`AsyncHybridQuery._create_child_queries`) now fetch `max(limit + offset,
DEFAULT_HYBRID_RANK_WINDOW)` rows per side, with
`DEFAULT_HYBRID_RANK_WINDOW = 50`. The requested limit/offset window is
still sliced out of the fused results as before. This implements option
1 from the issue: a fixed minimum window, no new API surface.

Custom and model rerankers keep the caller's `limit + offset` budget per
side, since every candidate is sent to them (for example
`OpenaiReranker` puts all merged texts in one prompt). Callers who want
a wider window for those rerankers can raise `limit()`. An explicit
`limit(0)` never gets the floor. In the async builder it raises
`ValueError` before schema discovery or either sub-query runs, with or
without an offset, so neither Embedded nor Enterprise retrieves or
scores anything. On main, async `limit(0)` was rejected by the native
`k` check only without an offset; `offset(2).limit(0)` fetched and
reranked two rows per side and returned nothing. The sync builder still
treats `limit(0)` as the default of 10, as before.

Trade-off: default RRF queries with small limits now fetch up to 50 rows
per side, and their result orderings can change, which is the bug being
fixed.

## Tests
- `test_hybrid_query_top_result_stable_across_limits` and its async
mirror (issue repro): fail on base, pass with the fix
- `test_hybrid_query_custom_reranker_keeps_candidate_budget` and its
async mirror: a recording reranker receives 1 vector and 1 FTS candidate
for `limit(1)` and 5 of each for `offset(2).limit(3)`
- `test_async_hybrid_query_default_rrf_candidate_window`: default RRF
receives 50 of each for `limit(1)`
- `test_async_hybrid_query_empty_page_does_not_fetch_candidates` (offset
0 and 2): `limit(0)` raises, and neither sub-query nor the reranker runs
- `test_remote_db.py::test_async_hybrid_zero_limit_sends_no_query`
(offset 0 and 2): `limit(0)` raises and no `/query/` request is sent;
fails on 281fdc7, passes on this head
- `test_remote_db.py::test_query_sync_hybrid` now expects `k=50` for the
default RRF request with `limit(42)`
- `test_hybrid_query.py`: 30 passed, 1 failed. The failure is
pre-existing and unrelated
(`test_hybrid_query_with_stale_fixed_size_binary_prefilter` needs the
`lance` package)
- `test_wal_hybrid.py`: 15 passed
- `ruff check` and `ruff format --check` clean on the touched files

Local runs used the lancedb 0.41.0 wheel with this PR's `query.py` diff
applied, since main needs a newer native extension than the published
wheel. `test_query_sync_hybrid` and the new remote zero-limit test were
run from an extracted copy because `test_remote_db.py` imports
`lancedb.graph`, which 0.41.0 does not have.

---------

Signed-off-by: shadowmodder <sudhirvissa@gmail.com>
Signed-off-by: Sudhir Vissa <sudhirvissa@gmail.com>
2026-11-30 20:42:12 +08:00
lipeh1andlipeih 058ed93618 feat(python): support table checkout by timestamp (#5221)
Python callers can pass a `datetime` to `Table.checkout()` and
`AsyncTable.checkout()` to read several tables as of a single cutoff.
Each table is pinned to the highest retained version on its current
branch whose reported commit timestamp is at or before the cutoff. A
cutoff before all retained versions raises `ValueError`.

The Rust `Table::checkout_as_of` method scans the branch's retained
history and compares the commit timestamps at the precision supplied by
the backend. On Embedded it resolves and checks out the version on the
same dataset. If a concurrent tag checkout moves the handle to another
branch, it retries there before pinning the handle. On Enterprise it
follows all version-history pages on the same branch before checking out
the selected version. Servers that report only whole milliseconds can
group commits on opposite sides of a cutoff. For an exact reread, record
both the branch and version of each input after checkout, then reopen
the table with both values. Python interprets naive datetimes in the
system's local time zone and honors explicit UTC offsets.

The website guide includes a draft paragraph for the SDK release.

Closes #2293.

## Validation

- Built the Windows x64 native extension from this checkout with the
repository's `ci` profile and CPython 3.12.
- `test_table.py` passed 558 tests with 20 skips. `test_remote_db.py`
passed 759 tests with 2 skips using its HTTP test server.
- The new tests cover two tables at one cutoff, pinning after later
writes, recovery with `checkout_latest()`, a cutoff before the first
version, non-UTC input, tied commits, and a commit one nanosecond past
the cutoff. All three also passed with `TZ=EST5EDT`.
- A real Embedded handle switching branches during timestamp lookup
selected the wrong branch version in 40/40 attempts before the
concurrency fix and the expected version in 40/40 attempts afterward.
The Rust regression test forces that interleaving with a
filesystem-backed table.
- A two-page Enterprise HTTP fixture reproduced checkout at v1 with the
previous SDK and confirmed checkout at v2 after the fix. The Rust
regression asserts the branch and continuation token on page two and
reads back the pinned version. A separate test covers empty intermediate
pages and repeated tokens.
- Both Rust branch checkout tests and the `Table::checkout_as_of`
doctest passed with the `remote` feature enabled.
- Python SDK Ruff checks and formatting, Pyright, Rust formatting, and
Vale passed. Repository-wide Ruff reports 59 existing diagnostics in the
unchanged `docs/web-tests` files.

---------

Co-authored-by: lipeih <lipeihan@eazytec.com>
2026-11-30 20:40:10 +08:00
wangshun 04bf27af9d feat: support IN subqueries in Embedded search filters (#5223)
Fixes #5222

## Summary

Embedded vector and full-text searches rejected `IN (SELECT ...)`
because Lance's scanner parsed the filter as a single-table expression.
A team-scoped search with `limit(1)` needs to rank eligible documents
using keys from the sharing table.

Resolve unqualified lookup tables through the originating database and
use DataFusion to evaluate the predicate on the search snapshot. Pass
the matching row IDs to Lance before ranking. The syntax applies to
base-table prefilters within one namespace. Literal filters use the
existing scanner path.

## Tests

Tests: `/bin/sh -c 'cd nodejs && corepack pnpm test --runInBand
__test__/query.test.ts -t '"'"'prefilters by keys from another
table'"'"''`.
Result: cd nodejs && corepack pnpm test --runInBand
__test__/query.test.ts on the exact-HEAD published native binary before
adding tests: 41 passed.
Result: cd nodejs && corepack pnpm test --runInBand
__test__/query.test.ts -t 'prefilters by keys from another table' on the
exact-HEAD published native binary: 2 failed with the reported
unsupported SQL expression, exit 1 (OSSCOUT_BASE.log).
Result: cd nodejs && corepack pnpm lint: passed after correcting new
fixture key style.
Result: cargo fmt --all && git diff --check: passed.
Result: cd nodejs && corepack pnpm test --runInBand --runTestsByPath
__test__/expr.test.ts __test__/remote.test.ts on the exact-HEAD
published native binary: 179 passed across 2 suites.
Result: cd nodejs && corepack pnpm tsc && corepack pnpm run docs with
the exact-HEAD native declarations: passed, with no generated
documentation changes.
Result: cd nodejs && corepack pnpm build:debug --profile ci && corepack
pnpm tsc: passed from the patched source.
Result: cd nodejs && corepack pnpm test --runInBand
__test__/query.test.ts -t 'prefilters by keys from another table' on the
source-built patch: 2 passed, exit 0 (OSSCOUT_PATCHED.log).
Result: cd nodejs && corepack pnpm test --runInBand --runTestsByPath
__test__/query.test.ts __test__/expr.test.ts __test__/remote.test.ts on
the source-built patch: 225 passed across 3 suites, exit 0
(OSSCOUT_PATCHED.log).
Result: cd nodejs && corepack pnpm run docs on the source-built patch:
passed, with no generated documentation changes.
Regression coverage: `nodejs/__test__/query.test.ts`.
<!-- oss-scout-job:job-2628acdb-66f3-4d91-8a6e-d5d15e92bde7 -->

---------

Signed-off-by: wangshun <96341168+xixi-box@users.noreply.github.com>
2026-11-30 20:38:51 +08:00
wangshun 5db0513dd0 fix: validate scalar index types with Lance trainers (#5147)
Fixes #5133

## What changed

Use Lance's scalar training requests to validate resolved Arrow fields
and share the same Auto index selection across Embedded and Enterprise.
Auto chooses IVF_PQ for vector fields and BTree for supported scalar
fields.

## Why

LanceDB's copied type lists rejected Binary, LargeBinary, and LargeUtf8
fields that Lance can index. Explicit and automatic BTree creation now
accept those fields. BTree and ZoneMap retain a targeted guard on the
Arrow Null type because the pinned Lance build drops IS NULL matches
after either index is created. FTS and Bitmap continue to check the
relevant Arrow extension metadata.

Refs #5133.

## How it was tested

Tests: `cargo test --profile ci --locked --features remote -p lancedb
--lib table::create_index::tests::test_create_btree_on_binary --
--exact`.
Result: cargo test --profile ci --locked --features remote -p lancedb
--lib table::create_index::tests::test_create_btree_on_binary -- --exact
(base): expected failure, 0 passed and 1 failed, exit 101.
Result: cargo test --profile ci --locked --features remote -p lancedb
--lib table::create_index::tests:: (base): 28 existing cases passed, and
only the new regression failed, exit 101.
Result: target/ci/deps/lancedb-bb9dc6b24005d6a0
remote::table::tests::test_create_index
remote::table::tests::test_create_list_element_fts_requires_server_support
remote::table::tests::test_branch_create_index
utils::tests::test_fts_field_logical_type_validation (base binary): 14
passed, exit 0.
Result: cargo test --profile ci --locked --features remote -p lancedb
--lib --no-run (patched): an initial build exposed missing Enterprise
imports, which were restored before a successful rebuild.
Result: cargo test --profile ci --locked --features remote -p lancedb
--lib table::create_index::tests::test_create_btree_on_binary -- --exact
(patched): 1 passed, 0 failed, exit 0 in both runs.
Result: cargo test --profile ci --locked --features remote -p lancedb
--lib -- table::create_index::tests::
remote::table::tests::test_create_index
remote::table::tests::test_create_list_element_fts_requires_server_support
remote::table::tests::test_branch_create_index
remote::table::tests::test_list_indices_fts_public_list_path
remote::table::tests::test_list_indices_nested_field_paths
index::tests:: utils::tests:: (patched): 61 passed, 0 failed, exit 0.
Result: LANCE_FTS_FORMAT_VERSION=bad cargo test --profile ci --locked
--features remote -p lancedb --lib
utils::tests::test_fts_field_logical_type_validation -- --exact
(patched): 1 passed, 0 failed, exit 0.
Result: /tmp/osscout-candidate/null-probe (direct probe using the pinned
Lance build): IS NULL matched 2 rows before indexing, 0 after building a
BTree or ZoneMap, and 2 after building a Bitmap.
Result: cargo fmt --all -- --check and git diff --check passed.
Regression coverage: `rust/lancedb/src/table/create_index.rs`.
<!-- oss-scout-job:job-aa1c056f-6c0a-4141-adae-fe30d5ef896a -->

---------

Signed-off-by: wangshun <96341168+xixi-box@users.noreply.github.com>
2026-11-30 20:38:43 +08:00
Alex Castillo GonzálezandClaude Sonnet 5.5 d31c1568e0 fix(python)!: compute JinaEmbeddings.ndims() per model (#4840)
BREAKING CHANGE: `JinaEmbeddings.ndims()` previously returned 768 for
unlisted model names. It now raises `ValueError`. When creating a schema
with an unlisted model, pass its documented output width to
`Vector(width)`.

Fixes the `# TODO: fix hardcoding` in `JinaEmbeddings.ndims()` (same
kind of fix as #4737, which made the OpenAI-compatible models use their
real dimension).

**Root cause:** `ndims()` returned 768 for every model. Any model whose
default output is not 768 (jina-clip-v2 and jina-embeddings-v3: 1024,
jina-embeddings-v4: 2048, jina-embeddings-v2-small-en: 512) produced a
vector column of the wrong size.

**Fix:** per-model lookup table of default output dimensions, only for
models whose dimension is documented (model configs on Hugging Face
`hidden_size`/`projection_dim`, and https://jina.ai/models/ pages).
Unknown models raise a `ValueError` listing the supported names instead
of silently guessing 768. The default `jina-clip-v1` still returns 768.
When appending to a table, generated vectors are validated against the
width of the stored fixed-size column, so existing tables that use an
unlisted model keep working.

**Test:** `python/tests/test_jina_embeddings.py` (no network, no API
key), including reopening a table with an unlisted model, appending a
matching vector and rejecting a mismatched width.

This change was prepared with an AI coding assistant (Claude).

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-30 20:23:42 +08:00
Nikolai Vysotskyi 8a27234be2 feat(python): add AssetFeed reranker (#5258)
Adds `AssetFeedReranker`, which calls the AssetFeed Cohere-style
`/rerank` endpoint (`assetfeed/assetfeed-rerank-v1`). It follows
`JinaReranker` (plain `requests`, no new dependency) and supports
vector, FTS and hybrid search with the same `return_score` options as
the Cohere reranker.

- Key from `api_key` or `ASSETFEED_API_KEY`.
- The API accepts up to 100 documents per request. More raises a clear
error before any request.
- `top_n` is only sent when set.

Python and docs only (`integrations/reranking/assetfeed`).

### Testing

- `test_assetfeed_reranker.py`: 12 tests with a mocked session, no
network.
- `test_rerankers.py`, `test_reranker_credentials.py`: pass. `ruff
check` passes.
- Not tested live: no API key was used.
2026-11-30 20:22:28 +08:00
Nikolai Vysotskyi 41637c646e feat(python): add AssetFeed embedding provider (#5257)
Adds an `assetfeed` text embedding provider for the AssetFeed embeddings
API (`assetfeed/assetfeed-embed-v1`). It uses the existing optional
`openai` client with AssetFeed's OpenAI-compatible endpoint, as the
`nvidia` provider does.

- Documents are embedded with `input_type="document"`, searches with
`input_type="query"`.
- `dim` is 1024 (default), 512 or 256. Batches are at most 64 inputs.
- The key comes from `ASSETFEED_API_KEY` or an `api_key` registry
variable reference.
- Response count, indices, dimensions and values are checked. Null and
empty text get a null vector without a request.
- Each request is retried on its own with LanceDB's retry policy.

Python and docs only (`integrations/embedding/assetfeed`). No dependency
changes.

### Testing

- `test_assetfeed_embeddings.py`: 18 mocked-HTTP tests through the real
OpenAI client, no network. They cover request shape, batching, response
order, null inputs, a local table, retries and invalid responses.
- Registry and trust suites: pass. `ruff check` passes.
- Not tested live: no API key was used.

---
2026-11-30 20:18:29 +08:00
lancedb-gatefixer[bot] 2d4e0fb3f2 fix: preserve branch scope during Embedded tag time travel (#4852)
Embedded tag checkout replaced the handle's only branch identity. After
reading a tag on another branch, `checkout_latest()` followed that
branch and subsequent writes or restores could commit there.

Keep the handle's original branch and Lance `BranchIdentifier`
separately from its visible snapshot. A branch name alone cannot
distinguish the original branch from a replacement after deletion and
reuse. Cross-branch tags remain readable, and Python pickle and snapshot
copies preserve both identities. `checkout_latest()` reattaches to the
original branch, so later appends stay there. `current_branch()`
continues to report the visible snapshot's branch.

Validate the retained identity before `checkout_latest()` changes the
handle or `restore(tag)` commits; a reused branch name is rejected
without changing either branch tip. Independent and query snapshot
copies retain this identity too. Reject an ambiguous cross-branch
restore before committing. To restore on the tag's branch, first open a
handle there with `branches.checkout(...)` or Rust's
`checkout_branch(...)`. Update Rust, Python sync/async, TypeScript,
generated API documentation, and the tag-based versioning guide for this
behavior.

Python pickle state also carries the original `BranchIdentifier` through
reopening. A foreign snapshot stays readable if the originating branch
is replaced while serialized, but latest checkout and restore reject the
replacement. Latest and same-branch pinned handles validate the saved
identity before reopening returns. Older pickle states without the
identifier keep their existing reopen behavior; they cannot validate an
identity that was never saved.

Validation:

- All 12 new branch-name reuse regression cases failed before the
identity fix and pass afterward. They cover latest checkout and restore,
direct handles and snapshot copies, all three consistency modes, and
unchanged versions and contents on both branch tips. Query snapshot
identity retention is also covered.
- All 8 new Python pickle regression cases failed before the
serialization fix and pass afterward. They replace the branch while the
handle is serialized, cover latest checkout and restore across three
consistency modes, verify unchanged tips, and reject replacement data
when reopening latest or same-branch pinned handles.
- 494 Rust table tests and 23 dataset consistency tests passed with
`--features remote --profile ci`; Clippy for the core and Python
bindings, Rust formatting, and `git diff --check` passed.
- 62 targeted Python tag, branch, pickle, and restore tests passed in
the uv-managed environment after rebuilding the extension. An additional
compatibility check verified that older pickle states without the
identifier still reopen and return to the original branch.
- Earlier SDK validation: 9 targeted Node tests passed, including the
cross-branch regression. Node native build, TypeScript compilation,
lint/format checks, and API documentation generation passed. TypeScript
sources are unchanged in this Python pickle follow-up.
- Python package Ruff lint/format checks passed; repository-wide Ruff
reported 59 pre-existing findings in untouched `docs/web-tests/` files.
Vale 3.24.0 found no prose issues on the changed guide lines.

Fixes #4842

<!-- lance-gatekeeper-fix:v1 agent=c1c6448a3f02ec6db445df5e3d8dd77f
generation=1 -->


<!-- gatefixer-walkthrough:v1
head=078eceadbedc15cf179d9d4dcce249c83e7010f9 -->
## Change walkthrough

```mermaid
flowchart LR
    A["Save original identity"] --> B["Reopen visible snapshot"]
    B --> C{"Foreign snapshot?"}
    C -->|No| D["Validate before return"]
    C -->|Yes| E["Retain saved identity"]
    E --> F["Validate latest or restore"]
```

**Read:** [Serialize and
reopen](https://github.com/lancedb/lancedb/blob/078eceadbedc15cf179d9d4dcce249c83e7010f9/python/python/lancedb/table.py#L4541-L4594)
→ [Reinstate identity
safely](https://github.com/lancedb/lancedb/blob/078eceadbedc15cf179d9d4dcce249c83e7010f9/rust/lancedb/src/table/dataset.rs#L278-L307)
→ [Serialized-handle
regressions](https://github.com/lancedb/lancedb/blob/078eceadbedc15cf179d9d4dcce249c83e7010f9/python/python/tests/test_table.py#L1300-L1360).

<sub>Snapshot:
[078ecea](https://github.com/lancedb/lancedb/commit/078eceadbedc15cf179d9d4dcce249c83e7010f9)</sub>
<!-- gatefixer-walkthrough:end -->

---------

Co-authored-by: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com>
2026-11-30 20:05:58 +08:00
Christopher Krah c0d46c31ba fix(python): map a Literal with None to a nullable field (#4927)
`pydantic_to_schema` raises on `Literal["a", "b", None]`, a field
pydantic accepts with `None`. [PEP
586](https://peps.python.org/pep-0586/#legal-parameters-for-literal-at-type-check-time)
reads it as `Union[Literal["a", "b"], None]`, the same type as
`Optional[Literal["a", "b"]]`, which #4678 maps to a nullable `utf8`.
The `None` is the optional part, not a second value type, so #4678's
rule that `Literal["a", 1]` raises does not cover it. The Literal branch
counted `NoneType` anyway and raised "All values of a Literal must have
the same type".

Before, on `1157a07`:

```
$ python probe.py
Optional[Literal]: pyarrow.Field<kind: string>
pydantic accepts None: kind=None
Literal[..., None]: TypeError: Converting Pydantic type to Arrow Type: unsupported type typing.Literal['a', 'b', None]. All values of a Literal must have the same type.
```

After, the last line prints `pyarrow.Field<kind: string>`, nullable. No
issue exists for this.

<details><summary>probe.py</summary>

```python
from typing import Literal, Optional
from lancedb.pydantic import LanceModel, pydantic_to_schema

class Opt(LanceModel):
    kind: Optional[Literal["a", "b"]] = None

class Lit(LanceModel):
    kind: Literal["a", "b", None] = None

print("Optional[Literal]:", pydantic_to_schema(Opt).field("kind"))
print("pydantic accepts None:", Lit(kind=None))
try:
    print("Literal[..., None]:", pydantic_to_schema(Lit).field("kind"))
except TypeError as e:
    print("Literal[..., None]: TypeError:", e)
```

</details>

The fix has two halves, and each test fails without one of them.
`_unwrap_optional_annotation` turns `Literal["a", None]` into
`Literal["a"]`, so the field and a list item become nullable. The
Literal branch skips `None` when it collects value types, so
`Optional[Literal["a", None]]` maps too. A mixed `Literal["a", 1, None]`
still raises, and so does a bare `Literal[None]`.

### Verification

```
# Python 3.12, lancedb 0.42.0b9 wheel from pypi.fury.io (the version at 1157a07), its _lancedb.abi3.so in the tree
$ PYTHONPATH=. python -m pytest -q -p no:cacheprovider tests/test_pydantic.py
this branch:                         87 passed
pydantic.py reverted, tests kept:    2 failed, 85 passed   (TypeError: ... must have the same type)
None kept in the value types only:   1 failed, 86 passed
unwrap change reverted only:         2 failed, 85 passed   (status not nullable; the write fails)
$ PYTHONPATH=. python -m pytest -q -p no:cacheprovider tests/test_pydantic.py tests/test_table.py tests/test_db.py
1157a07:      8 failed, 650 passed, 17 skipped
this branch:  8 failed, 652 passed, 17 skipped   # the same 8 in test_table.py (blob, merge, compact, namespace) on both
$ ruff format --check <both files> && ruff check <both files>      # ruff 0.9.9, as CI pins it
2 files already formatted
All checks passed!
# not run: the Rust build, the full suite; pyright's include list leaves out pydantic.py
```

@Xuanwo, you merged #4678. I left a bare `Literal[None]` raising, since
a column that can only hold null has no value type to store. Does that
match how you want it?

---------

Signed-off-by: Christopher Krah <48338417+chrikrah@users.noreply.github.com>
2026-11-30 19:16:26 +08:00
Deniz Erdogan 53ae53877d docs: fix dead links to the Lance catalog specs (#5208)
Six `See https://lance.org/format/namespace/{dir,rest}/catalog-spec/`
comments in `docs/web/management/namespace.mdx` point to pages that
return 404. The Lance docs moved the directory and REST catalog specs to
`/format/catalog/dir/` and `/format/catalog/rest/`, so the comments now
use those URLs.

Only comment text changed. I opened both new URLs and they return 200.
2026-11-30 19:10:10 +08:00
Alex Castillo González 9564431b57 fix(python): support Cohere embed-v4.0 in CohereEmbeddingFunction (#4805)
`CohereEmbeddingFunction(name="embed-v4.0")` raised `ValueError: Model
embed-v4.0 not supported`.

**Cause.** `ndims()` uses a closed list of v2/v3 model names and raises
for everything else, so Cohere's current embedding model was rejected.

**Fix.** Add `embed-v4.0` to `ndims()`, returning its default output
dimension (1536).

**Test.** `test_cohere_embed_v4_is_supported` creates the function with
`name="embed-v4.0"` and checks `ndims() == 1536`. It fails before the
change with the `ValueError` and passes after; the existing Cohere
default-model test still passes.

This change was prepared with the help of an AI assistant (Claude Code),
and the author is responsible for the change.


---------
2026-11-30 19:06:26 +08:00
Jack Ye 9e3af3625d docs(sql): document text and JSON descriptions
Apply the reviewed DESCRIBE TEXT and JSON contract.
2026-11-27 19:02:17 -08:00
Xuanwo e185dc8646 perf: raise the default Blob V2 direct-read threshold to 32 MiB (#5248)
Enterprise SDKs use an inclusive 32 MiB default for eligible Blob V2
direct reads. The paired field comparison with the 10 MiB SDK default
measured higher direct-read latency at 10 and 16 MiB. At 32 MiB, the
interval for the latency difference spanned zero. [SDK version used in
the field comparison](https://github.com/lancedb/lancedb/pull/5247)

The earlier mixed-load test measured lower Plan Executor cache pressure
with direct reads enabled at the 10 MiB cutoff. That result covers the
tested size mix. With the 32 MiB cutoff, reads from 10 MiB up to (but
excluding) 32 MiB go through the proxy, so the impact on executor
traffic and cache pressure depends on the workload's size distribution.

The existing internal override still takes precedence. Direct reads keep
the 16 MiB part size. The Node binding test verifies proxy routing one
byte below the default and two contiguous object-store ranges with a
matching SHA-256 at exactly 32 MiB.
2026-11-28 03:21:37 +08:00
lancedb-gatefixer[bot] a663417fa9 fix: validate remote tag checkout branch and version (#4853)
Remote tag checkout discarded the tag's branch and pinned its version on
the handle's own branch without checking that the version existed. This
could read a different snapshot or leave the handle pinned to a
nonexistent version.

Resolve the complete tag reference and reject cross-branch tags with an
error naming both branches. For a tag on the handle's branch, reuse
numeric checkout to validate the version before committing the selector
and freshness state. This also protects Python's
`open_table(version=tag)`, which delegates to tag checkout. To read a
tag on another branch, obtain that branch's handle first with
`checkout_branch` in Rust or `table.branches.checkout(...)` in Python.
The Python checkout docstrings and tag-based versioning guide document
this requirement.

Add 17 regression cases covering cross-branch tags in both directions,
main-branch aliases, same-branch reads, and failed validation on
writable and pinned handles. Twelve cases failed against the original
implementation. Update the existing freshness and schema-cache tests for
the validation request.

Validation:

- `cargo test --locked --profile ci --features remote -p lancedb --lib
remote:: -- --quiet` — 921 tests passed using mocked remote endpoints.
- `cargo fmt --all` — passed.
- `cargo clippy --locked --profile ci --features remote -p lancedb
--tests --examples` — passed.
- Python documentation: Ruff lint and formatting checks passed for the
Python tree, using Ruff 0.15.20 from `python/uv.lock`. Python syntax
checks passed; executable ASTs are unchanged. Repository-wide `ruff
check .` reports 59 pre-existing errors in six unchanged
`docs/web-tests` files; unrelated formatter changes were excluded.

Fixes #4843

<!-- lance-gatekeeper-fix:v1 agent=2253a7bdebba53465089b95bce66cb12
generation=1 -->


<!-- gatefixer-walkthrough:v1
head=35f8db881e36b83b9aab478cb5db72e485c9eca7 -->
## Change walkthrough

```mermaid
flowchart TD
    resolve["Resolve tag reference"] --> branch{"Same branch?"}
    branch -->|No| reject["Return branch error"]
    branch -->|Yes| validate["Describe tag version"]
    validate -->|Error| error["Return version error"]
    validate -->|Success| pin["Pin validated snapshot"]
```

The selector and freshness state commit together under the version lock.

**Read:** [branch
guard](https://github.com/lancedb/lancedb/blob/35f8db881e36b83b9aab478cb5db72e485c9eca7/rust/lancedb/src/remote/table.rs#L4075-L4092)
→ [validation and
commit](https://github.com/lancedb/lancedb/blob/35f8db881e36b83b9aab478cb5db72e485c9eca7/rust/lancedb/src/remote/table.rs#L2865-L2893)
→ [tag and branch
guidance](https://github.com/lancedb/lancedb/blob/35f8db881e36b83b9aab478cb5db72e485c9eca7/docs/web/management/table.mdx#L1745-L1755).

<sub>Snapshot:
[35f8db8](https://github.com/lancedb/lancedb/commit/35f8db881e36b83b9aab478cb5db72e485c9eca7)</sub>
<!-- gatefixer-walkthrough:end -->

---------

Co-authored-by: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com>
2026-11-27 15:50:20 +08:00
Xuanwo 1c0118015c feat(nodejs): open source-bearing blob descriptors (#5238)
Add `Table.openBlobFile` and `Table.openBlobFiles` for source-bearing
SQL `blob_descriptor` results, matching the existing Rust and Python
APIs.

The TypeScript methods forward the descriptor to the shared Rust opener
instead of reimplementing routing. That keeps the 10 MiB direct-read
threshold, pinned snapshot identity, resolver refresh, and 503
single-shot proxy fallback identical to `fetchBlobFiles` and the other
public Blob V2 entries. Descriptor fields remain the snake_case shape
returned by Arrow/SQL; the wrapper converts unsigned 64-bit values to
`bigint` at the NAPI boundary and returns `null` for null descriptors.
Existing custom `Table` subclasses keep working through a default "not
supported" implementation.

Validation:
- `pnpm tsc`
- `pnpm lint`
- `pnpm test --runInBand __test__/blob_open.test.ts
__test__/blob_ranges.test.ts __test__/remote_blob_snapshot.test.ts` — 65
passed
- focused Rust core tests for direct opens, threshold routing, snapshot
preservation, and 503 fallback — passed

The docs also update the TypeScript cross-row range table and example;
`fetchBlobRanges` was already implemented but was still documented as
unavailable.
2026-11-27 00:16:29 +08:00
147fdb25a0 feat(python): add two-phase shuffled reads (2PSR) to elastic dataloader (#5066)
Supersedes #4263, which I can no longer push to. This PR continues the
same branch, so the review history is there.

## Summary

Adds two-phase shuffled reads (2PSR) to `StreamingDataset`, enabled with
`block_size`:

1. **Block shuffle:** contiguous blocks of `block_size` live rows are
shuffled and assigned to splits. This replaces 1-phase's per-row take
with mostly contiguous range scans, which are much cheaper on object
storage.
2. **Bounded row shuffle:** each split shuffles rows over a rolling
window of `window_blocks` blocks. `max_shuffle_distance` bounds how far
a row can move.

The feature also supports `filter` (sparse takes of live rows),
`reshuffle_blocks_per_epoch`, resume and checkpointing, background block
prefetch, and multi-worker DataLoaders. 2PSR stays opt-in:
`block_size=None` keeps today's 1-phase behavior.

Since the last review round:

- **Fixed worker startup with small blocks.** The pickled dataset no
longer grows with the number of blocks; the block order is rebuilt in
`__setstate__`. Once that pickle passed the 64 KiB pipe buffer, spawned
DataLoader workers started one at a time (~280 s with 128 workers at
≤2,048-row blocks).
- **Fixed per-call block copies.** Each loaded block is combined into a
single chunk. Before, `take` on a multi-chunk block concatenated the
whole block on every call.
- **Fixed early eviction.** Blocks are evicted only behind the
contiguous prefix of rows already served. With `io_queue_depth > 1`,
calls can arrive out of order and previously evicted blocks that were
still needed, causing 5–40% extra reads.
- **New default:** `window_blocks` now defaults to 8, and the docstring
recommends `block_size=512` with DataLoader workers.

None of these fixes changes which rows are read or their order. A check
across 12 config, epoch and seed combinations on 8 ranks gave identical
per-rank order before and after.

## Benchmarks

Throughput was measured on EC2 i4i.32xlarge in us-west-2, reading a
FineWeb-Edu table of 4,096 B rows. Each number is the median of 3
trials, and each trial is a full pass. 2PSR used 512-row blocks, 256
splits, 128 workers and `io_queue_depth=4`. 1-phase used 32 splits, 8
workers and `io_queue_depth=32`.

| Storage | Rows | 2PSR | 1-phase | Speedup |
|---|---|---|---|---|
| S3 | 8.4M (34 GB) | 16.9 s | 230 s | 13.6× |
| S3 | 33.6M (137 GB) | 45.6 s | 781 s | 17.1× |
| S3 | 134M (550 GB) | 168 s | 3,098 s | 18.4× |
| Local NVMe | 8.4M | 16.4 s | 116 s | 7.1× |

On the 8.4M-row S3 table, 2PSR reads 1.5–2.0 GB/s at every block size
from 128 to 65,536 rows. A fit across the three S3 sizes gives 2PSR
about 7 s fixed cost plus 3.4 GB/s, and 1-phase about 39 s plus 0.18
GB/s. That puts the large-table limit near 19×.

Quality was measured by pretraining GPT-2 124M on 2^21 FineWeb-Edu docs
for 16 epochs on 8×H100. The table shows final validation loss, mean ±
SD over 3 seeds:

| Reader | Final val loss |
|---|---|
| 1-phase | 2.8464 ± 0.0006 |
| 2PSR, `block_size=128`, msd 4,096 | 2.8457 ± 0.0011 |
| 2PSR, `block_size=512`, msd 4,096 | 2.8457 ± 0.0007 |
| 2PSR, `block_size=2048`, msd 32,768 | 2.8466 ± 0.0009 |
| No shuffle (1 seed) | 2.8606 |

Every 2PSR config is within seed noise of 1-phase. The 95% confidence
intervals of the difference all include zero and are at most 13% of the
no-shuffle penalty. Training throughput was the same for every reader
(3.15–3.18M tok/s, GPU-bound).

## Testing

- `test_elastic_dataloader.py` and `test_permutation.py`: all 324 tests
pass after merging `main`. The new tests cover:
  - pickle size independent of block count;
  - single-chunk blocks;
  - no re-reads under out-of-order calls;
  - window defaults;
  - resume, filter, worker and checkpoint behavior.
- `ruff check` and `ruff format --check` are clean.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Xuanwo <github@xuanwo.io>
2026-11-25 09:08:39 -08:00
Xuanwo 4d9fd358f8 feat(nodejs): expose Function failure recovery APIs (#5209)
TypeScript callers can now inspect and recover Function row failures
through the native workflow. `functionErrors()` groups returned failures
and can show retained attempt history. `functionErrorRows()` looks up
current failed inputs using row IDs and physical row addresses
represented as `bigint`. Older deployments can continue to use the
existing error listing.

`retryFailed()` selects the exact failed rows on the server, with
optional error type and job filters. `upgradeColumn()` binds an existing
immutable Function version and can recompute failed rows, all eligible
rows, or no rows. Callers can quarantine and release failures,
explicitly include quarantined rows in a retry, and use
`functionProvenance()` to see which Function version produced a recorded
value.

The native operations reuse the existing Rust workflow v1 capability
checks. The Function failures guide includes TypeScript examples for
inspecting, retrying, upgrading, and quarantining failures.
2026-11-25 23:14:04 +08:00
Yang Cen 757dcc0a6b feat(functions): declare multiple bindings in one add_columns call (#5202)
Allow Python callers to pass several registered Function applications to
`add_columns`. Rust callers can use `function_bindings` to submit the
same atomic declaration. An application can consume another output in
the mapping, including one declared later.

The SDK checks the Enterprise server's batch-declaration capability
before sending the mutation. Single-binding callers continue to use the
existing request shape. This change covers declaration only.

Coverage includes Python mapping validation, the Rust HTTP request with
dependent bindings, and older servers with missing or unknown capability
values. Correctness tests run in CI.
2026-11-25 13:39:57 +08:00
Tanay fc6dfca11a feat(python): add map() method to Permutation for dict-based transforms (#3264)
### Summary

Adds `Permutation.map(fn, *, batched=False)`, a dict-based alternative
to `with_transform` so users can write `fn(dict) -> dict` without
touching `pyarrow.RecordBatch`.

- `batched=False` (default): `fn` receives one row as a dict and returns
a dict.
- `batched=True`: `fn` receives the batch as `dict[str, list]` and
returns the same shape, with one value per input row.
- `map` calls can be chained. Callbacks run in order and the returned
dict replaces the row, so the next callback only sees what the previous
one returned. Unlike HuggingFace's `Dataset.map`, the output is not
merged into the row.
- A mapped permutation always yields `list[dict]`, whatever `batched`
is, so it works with the default `DataLoader` collate. Rows keep their
position, including duplicate offsets, and `take_offsets([])` returns
`[]`.
- `map` cannot be combined with an explicit `with_format` or
`with_transform`, in either order. Doing so raises `ValueError` when the
chain is built, whether or not the format's optional dependency is
installed.
- `select_columns`, `remove_columns` and `schema` describe the columns
read from the base table, which are the input of the first callback.
- The chain is stored in a module-level callable, so a mapped
permutation can be pickled into `spawn` `DataLoader` workers as long as
the callbacks themselves are picklable.
- `with_transform` remains available for direct Arrow access.

### Documentation

- Docstrings for `map`, `with_format` and `with_transform` cover the
mixing rule, with a `DataLoader` + `collate_fn` example on `map`.
- Adds a "Transforming rows with map" section to the Permutation guide.

### Testing

- `test_permutation.py`: chaining, mixing errors in both orders, output
validation, duplicate and empty offsets, projection and schema, and a
pickle round-trip for both `batched` modes.
- `test_permutation.py`: the mixing check with `polars` unimportable,
with pickles written before the `explicit_transform` flag, and with a
transform passed to the constructor.
- `test_torch.py`: a map chain read through `DataLoader(...,
multiprocessing_context="spawn", num_workers=1)`.

Closes [#3246](https://github.com/lancedb/lancedb/issues/3246)
2026-11-25 06:35:28 +08:00
aevum b3dd2b0392 docs(search): clarify Hamming distance without a vector index (#5198)
## Why
The "Configure Distance Metric" section of
`docs/web/search/vector-search.mdx` says `hamming` is supported for
`IVF_FLAT` indexes only. That contradicts the runnable binary-vector
example on the same page, which searches packed binary vectors with
`distance_type("hamming")` and no index. A reader could think they must
build an index before using Hamming distance.

## What changed
- Say that `hamming` works for binary vectors without an index.
- Keep the note that `IVF_FLAT` is the index type for indexed Hamming
search.

## Scope
Docs only: one sentence in the evergreen user guide. The same wording
also appears in the saved Embedded v0.41.0 and Enterprise v1.12.0,
v1.13.0 and v1.14.0 doc editions. I left those alone in case maintainers
handle saved-edition corrections differently.

## Verification
- Ran the website's binary-vector example test and both SDK
binary-vector tests against the published `lancedb==0.41.0` wheel: `3
passed`. They confirm that unindexed Hamming search works.
- `git diff --check` is clean. I did not render the page locally.

This PR was prepared with AI assistance and reviewed before submission.
2026-11-25 05:11:40 +08:00
Bruno Ramirez f5d1cd67c7 docs: add Homebrew installation to the CLI guide (#5197)
The public CLI guide covers the hosted installer, but users looking for
a Homebrew install have to find the tap themselves. This adds the tap's
install and upgrade commands alongside the shell installer. The shell
example shows how to pin a release to `v0.42.0`.

This was accomplished with the following changes:

- Add Homebrew installation, version verification, and upgrade commands
to `docs/web/tools/cli.mdx`.
- Give the shell installer its own subsection under the existing Install
heading.

### Testing

The shell installer tests passed. Verified that the install instructions
match the composed page in
[docs#475](https://github.com/lancedb/docs/pull/475).
2026-11-24 10:44:34 -08:00
Brendan Clement 27b7a248e4 docs: use refresh_column_async with wait on Enterprise pages (#5183)
## The problem

Several Python examples on Enterprise pages start a computed column
refresh with `table.refresh_column(...)`. On a LanceDB Enterprise
connection that call always fails:

```
NotImplementedError: not supported: a remote refresh runs as a server job; use refresh_column_async and wait on the returned handle
```

On Enterprise a refresh runs as a job on the server. Only
`refresh_column_async(...)` works there: it returns a job, and
`job.wait()` blocks until the job finishes. A reader following the
quickstart's Enterprise step, or the secrets or GPU examples, hits the
error. The same fix landed for the Sophon-owned page in
lancedb/sophon#10478.

## What this changes

- **The examples use the job form:** `job =
table.refresh_column_async(...)` then `job.wait()`. This covers
`curation/vend-secret.mdx`, `curation/create-function.mdx` and the
quickstart, plus the sentences that named the blocking call in
`enterprise/auto-refresh.mdx` and
`feature-engineering/add-computed-column.mdx`.
- **The quickstart example now comes from a test.** The
`PyQuickstartAddFeature` snippet is generated from the deployment test
in `docs/web-tests/py/test_quickstart.py`, and the separate
Enterprise-only snippet is folded into it. That test also asserts that
the blocking call raises an error naming `refresh_column_async`.
- **The GPU example only shows arguments the Enterprise table accepts
today.** `gpu_class` and `gpu_count` are dropped from `add_columns`, and
`gpu_count` from the refresh call, with a one-sentence note. See "Python
wrapper gap" below.

## How it was checked

Every Enterprise call the changed pages show was run through the Python
SDK (0.42.0b26, built from this branch) against a local stand-in for an
Enterprise server that returns canned responses:

- `table.refresh_column("embedding")` raises the error above and sends
no request.
- `job = table.refresh_column_async("embedding"); job.wait()` submits a
refresh job and returns its result.
- `table.refresh_column_async("embedding", gpu_class="h100",
total_gpu_count=8).wait()` is accepted, and the server receives both GPU
options.
- The removed forms fail as expected: `gpu_count` on
`refresh_column_async`, and `gpu_class` or `gpu_count` on `add_columns`,
raise `TypeError: unexpected keyword argument`.

Also: the committed quickstart snippet matches what the generator
produces from the test, and the five changed pages render with no
blocking call in a local preview.

**Not run:** the quickstart deployment test itself. It needs a real
Enterprise deployment and is skipped without credentials, which CI does
not have. Registering a Function also needs a real deployment, so that
line of the GPU example was not exercised.

## Python wrapper gap (to be fixed separately)

The Python `RemoteTable.refresh_column_async` and
`RemoteTable.add_columns` do not accept `gpu_count`, and `add_columns`
also does not accept `gpu_class`. The Rust remote table supports these
GPU placement options, so this looks like an oversight in the Python
layer. This PR makes no SDK change. Once the wrapper passes them
through, the GPU example can show them again.

## Risk

Low. Docs and docs tests only.

## Pipeline

Updates from [git push
no-mistakes](https://github.com/kunchenguid/no-mistakes)

<!-- no-mistakes-pipeline-attestation:v1
{"head_sha":"11ac1a260e8825dd406dea4e839f2498309e843b","steps":[{"step":"intent","status":"completed"},{"step":"rebase","status":"completed"},{"step":"review","status":"completed"},{"step":"test","status":"completed"},{"step":"document","status":"completed"},{"step":"lint","status":"completed"},{"step":"push","status":"completed"},{"step":"pr","status":"running"},{"step":"ci","status":"pending"}],"live_validation":{"verdict":"go","live":7,"total":9}}
-->

<details>
<summary>✅ **Intent** - passed</summary>

✅ No issues found.
</details>

<details>
<summary>✅ **Rebase** - passed</summary>

✅ No issues found.
</details>

<details>
<summary>✅ **Review** - passed</summary>

✅ No issues found.
</details>

<details>
<summary>⚠️ **Test** - 2 infos</summary>

- ⚠️ `docs/web/curation/create-function.mdx:546` - Not confirmed live.
The new example calls `table.refresh_column_async(&#34;embedding&#34;,
gpu_class=&#34;h100&#34;, gpu_count=4, total_gpu_count=8)`, but
`RemoteTable.refresh_column_async` in
python/python/lancedb/remote/table.py (line 1280) has no `gpu_count`
parameter (only `gpu_class` and `total_gpu_count`), while the abstract
`Table` and `LanceTable` do. If that reading holds, the documented call
raises `TypeError: unexpected keyword argument &#39;gpu_count&#39;` on
Enterprise. The blocking `RemoteTable.refresh_column` has the same gap,
so this predates the change, but the page still shows a call that may
not run. Decision needed: drop `gpu_count=4` from the example, or add
the parameter to the Enterprise table (an SDK change beyond this docs
change).
- ⚠️ The intent asked whether the docs change can be validated by
running code. In this run it could not: the SDK build did not finish in
the time budget and no Enterprise deployment credentials are available,
so the only test covering the changed quickstart snippet
(`test_quickstart_derived_feature_on_a_deployment`) skips. The prepared
driver script in the evidence directory exercises the three documented
calls against a localhost emulator once the SDK is built.
- ⚠️ live validation verdict: inconclusive (4 of 7 scenarios were driven
live against the product); untested: On an Enterprise connection
(localhost emulator, synthetic responses) the documented `job =
table.refresh_column_async(&#34;embedding&#34;); job.wait()` completes,
and the old blocking `table.refresh_column(...)` raises
NotImplementedError naming refresh_column_async, On an Enterprise
connection the create-function.mdx example
`table.refresh_column_async(&#34;embedding&#34;,
gpu_class=&#34;h100&#34;, gpu_count=4, total_gpu_count=8)` is accepted
and submits a job, `test_quickstart_derived_feature_on_a_deployment`
passes against a real LanceDB Enterprise deployment
- Live validation: ⚠️ inconclusive - 4 of 7 scenarios driven live
against the product

| Scenario | Result | Live | Evidence |
| --- | --- | --- | --- |
| Reader opens the six changed docs pages in the local Mintlify preview
and sees the job form (`refresh_column_async` + `job.wait()`) with no
blocking `table.refresh_column(` call left | ✅ pass | live |
Rendered-page check output (artifact &#39;Rendered docs check&#39;) and
saved HTML under
~/.no-mistakes/evidence/01M85TWQ599ZJ5NQ0DBASSFT91/rendered |
| Reader follows the new `refresh_column_async` link on the
computed-column page and lands on the &#39;Run a refresh on
Enterprise&#39; section | ✅ pass | live | Rendered add-computed-column
page links to /feature-engineering/refresh-column#async; the rendered
refresh-column page (HTTP 200) contains an element with
id=&#34;async&#34; |
| Quickstart page still renders after the Enterprise-only snippet import
was removed, and its feature step shows the job form | ✅ pass | live |
quickstart returns HTTP 200; page payload contains `job =
table.refresh_column_async(&#34;quality_score&#34;)\njob.wait()`; no
`PyQuickstartAddFeatureEnterprise` reference remains |
| Regenerating snippets from docs/web-tests/py/test_quickstart.py
reproduces the committed `PyQuickstartAddFeature` snippet | ✅ pass |
live | `mdx_snippets_gen.py` output in
~/.no-mistakes/evidence/01M85TWQ599ZJ5NQ0DBASSFT91/snippets-regen/quickstart.mdx
is identical to docs/web/snippets/quickstart.mdx for that export |
| On an Enterprise connection (localhost emulator, synthetic responses)
the documented `job = table.refresh_column_async(&#34;embedding&#34;);
job.wait()` completes, and the old blocking `table.refresh_column(.… |
⏸️ untested | no | Needs the Python SDK built from this worktree. `uv
run ... maturin develop` started from a cold cargo cache and was still
compiling after about 18 minutes, so I stopped it to stay inside the
30-minute… |
| On an Enterprise connection the create-function.mdx example
`table.refresh_column_async(&#34;embedding&#34;,
gpu_class=&#34;h100&#34;, gpu_count=4, total_gpu_count=8)` is accepted
and submits a job | ⏸️ untested | no | Blocked by the same unfinished
SDK build. The source suggests this call would raise TypeError (see
finding), but that was not executed. |
| `test_quickstart_derived_feature_on_a_deployment` passes against a
real LanceDB Enterprise deployment | ⏸️ untested | no | The test skips
unless LANCEDB_DOCS_TEST_DEPLOYMENT=1 and LANCEDB_URI,
LANCEDB_HOST_OVERRIDE and LANCEDB_API_KEY point at a deployment with a
Function catalog; a localhost emulator cannot stand in for… |

- <code>`cd docs/web &amp;&amp; mint dev --port 3391 --no-open`, then
`curl http://localhost:3391/&lt;page&gt;` for quickstart,
curation/vend-secret, curation/create-function, enterprise/auto-refresh,
feature-engineering/add-computed-column,
feature-engineering/refresh-column (all HTTP 200), with a text check of
each rendered page</code>
- <code>`python3 docs/web-tests/mdx_snippets_gen.py -s docs/web-tests/py
-s docs/web-tests/ts -s docs/web-tests/rs -o
&lt;evidence&gt;/snippets-regen`, then diff of `PyQuickstartAddFeature`
against `docs/web/snippets/quickstart.mdx`</code>
- <code>`cd python &amp;&amp; uv run --extra tests --extra dev maturin
develop --extras tests,dev` (started, not finished within budget,
stopped; no result)</code>
- <code>`chrome-devtools-axi` screenshots of the rendered pages (failed:
BRIDGE_NOT_READY)</code>
- <code>Source read of `python/python/lancedb/remote/table.py`
`refresh_column_async` signature against the create-function.mdx example
(not live)</code>

🔧 Fix applied.
2 infos still open:

- ℹ️ No screenshots of the rendered docs pages were captured.
`chrome-devtools-axi` failed with &#34;Bridge failed to start within
30s&#34; and headless Google Chrome hung until killed at 60s per page.
The pages were instead fetched as served HTML from a local `mint dev`
preview and saved under rendered-round2/. For the quickstart page the
job-form snippet is present only in the page&#39;s hydration payload,
not as rendered text, so its on-screen appearance was not seen.
- ℹ️ `docs/web-tests/py/test_quickstart.py:347` -
`test_quickstart_derived_feature_on_a_deployment`, the only test that
runs the changed quickstart snippet end to end, skips because no
Enterprise deployment credentials exist (LANCEDB_DOCS_TEST_DEPLOYMENT,
LANCEDB_URI, LANCEDB_HOST_OVERRIDE, LANCEDB_API_KEY). The same calls
were driven against a localhost emulator instead, which does not prove
real-deployment behaviour.
- Live validation: ✅ go - 7 of 9 scenarios driven live against the
product

| Scenario | Result | Live | Evidence |
| --- | --- | --- | --- |
| On an Enterprise connection (Python SDK, localhost emulator, synthetic
responses) the documented `job =
table.refresh_column_async(&#34;embedding&#34;); job.wait()` submits a
refresh job and returns its resul… | ✅ pass | live |
driver-output-round2.txt: OK -&gt; rows_assigned=3 ...; server received
POST /v1/table/test/backfill_column {&#39;column&#39;:
&#39;embedding&#39;} |
| Adversarial: on the same Enterprise connection the old blocking
`table.refresh_column(&#34;embedding&#34;)` fails with
NotImplementedError naming refresh_column_async and sends no request | ✅
pass | live | driver-output-round2.txt: RAISED NotImplementedError: ...
use refresh_column_async and wait on the returned handle; requests sent:
[] |
| The create-function.mdx refresh example as now written,
`refresh_column_async(&#34;embedding&#34;, gpu_class=&#34;h100&#34;,
total_gpu_count=8)` then `job.wait()`, is accepted on Enterprise and
sends both GPU options | ✅ pass | live | driver-output-round2.txt:
server received {&#39;gpu_class&#39;: &#39;h100&#39;,
&#39;total_gpu_count&#39;: 8, &#39;column&#39;: &#39;embedding&#39;} |
| The create-function.mdx `table.add_columns({&#34;embedding&#34;:
&lt;Function binding&gt;}, total_gpu_count=8)` is accepted on Enterprise
and sends the fleet GPU ceiling | ✅ pass | live |
driver-output-round2.txt: OK -&gt; AddColumnsResult(version=2); POST
/v1/table/test/add_columns/ body carries the Function binding and
&#39;total_gpu_count&#39;: 8 |
| Adversarial: the GPU arguments removed from the create-function.mdx
example (`gpu_count` on refresh_column_async; `gpu_class`/`gpu_count` on
add_columns) are rejected by the Enterprise table, matching… | ✅ pass |
live | driver-output-round2.txt: TypeError unexpected keyword argument
&#39;gpu_count&#39; (refresh_column_async) and &#39;gpu_class&#39;
(add_columns) |
| The committed `PyQuickstartAddFeature` snippet equals what the snippet
generator produces from docs/web-tests/py/test_quickstart.py | ✅ pass |
live | `mdx_snippets_gen.py` output in snippets-regen-round2; `diff -r`
against docs/web/snippets reports no difference for quickstart.mdx |
| A reader opening the five changed pages in a local Mintlify preview
sees the job form and no blocking `table.refresh_column(` call | ✅ pass
| live | rendered-round2-counts.txt and rendered-round2/*.html: all five
pages return 200 with zero blocking calls; job form present on each |
| `test_quickstart_derived_feature_on_a_deployment` passes against a
real LanceDB Enterprise deployment | ⏸️ untested | no | Ran the test; it
skips because no Enterprise deployment credentials exist here. A
localhost emulator cannot stand in: the test registers a Function over
Flight SQL and computes real values. To run it,… |
| `version = db.create_function(embed)` from the create-function.mdx
example registers a Function on Enterprise | ⏸️ untested | no | Tried it
against the emulator; the call goes over Flight SQL to a Function
catalog, which only a real Enterprise deployment provides. This line is
unchanged by the diff. Needs the same deployment cred… |

- <code>`~/.treehouse/lancedb-9ea8c9/1/lancedb/python/.venv/bin/python
drive_enterprise_refresh_v3.py` (lancedb 0.42.0b26 built at cb082c08,
whose SDK source is identical to this head; Enterprise connection to a
localhost emulator with synthetic responses)</code>
- <code>`python docs/web-tests/mdx_snippets_gen.py -s docs/web-tests/py
-s docs/web-tests/ts -s docs/web-tests/rs -o
&lt;evidence&gt;/snippets-regen-round2` then `diff -r` against
`docs/web/snippets` (quickstart.mdx identical)</code>
- <code>`cd docs/web-tests/py &amp;&amp; python -m pytest
test_quickstart.py -q -rs` (4 passed, 6 skipped; all skips are
deployment-only tests)</code>
- <code>`mint dev --port 3397` in docs/web, then `curl` of /quickstart,
/curation/vend-secret, /curation/create-function,
/enterprise/auto-refresh, /feature-engineering/add-computed-column (all
200) and a count of blocking vs job-form calls in the served HTML</code>
- <code>`git status --short` after teardown (clean; preview stopped,
port 3397 free)</code>
</details>

<details>
<summary>✅ **Document** - passed</summary>

✅ No issues found.
</details>

<details>
<summary>⚠️ **Lint** - 1 info</summary>

- ℹ️ `docs/web-tests/py/test_quickstart.py:29` - `ruff check` reports
C408 (`dict()` call, rewrite as a literal) in the `deployment` fixture.
It is on a line this change did not touch and is also present at the
base commit; ruff&#39;s only fix for it is marked unsafe, so I left it.
`ruff format --check` passes. ruff is not on PATH, so I ran it through
`uvx`, which may not be the repo-pinned version.
</details>

<details>
<summary>✅ **Push** - passed</summary>

✅ No issues found.
</details>
2026-11-24 09:31:06 -08:00
Sarwar BhuiyanandClaude Opus 5.5 5f87e18541 feat: create any registered Lance scalar index plugin by name (#5004)
Closes #4933

Adds a generic configuration for creating a scalar index of any type
recognized by a registered database plugin, using its type name and
optional JSON parameters. Index types without a dedicated SDK
configuration can use the same API.

- **Rust:** `Index::Plugin(PluginIndexBuilder)`, with JSON-object
parameters through `.params(...)` or `.params_json(...)`.
- **Python:** `ScalarPlugin(index_type, params=None)`, accepting a dict
or JSON-object string.
- **TypeScript:** `Index.plugin(indexType, params?)`, accepting an
object or JSON-object string.
- Type names are case-insensitive and surrounding whitespace is ignored.
Empty names and non-object parameters are rejected.
- Native index introspection preserves existing built-in types and
exposes other registered plugin types through `Custom`.

The guide and SDK references describe index creation, parameter
ownership, and errors consistently. They recommend a dedicated
configuration when one exists and refer readers to the plugin’s
documentation for parameter names and defaults. The TypeScript reference
is regenerated from its source JSDoc.

## Remote request format

Generic requests use `index_type: "PLUGIN"` and a separate upper-cased
`plugin_type`. Arbitrary parameters stay nested under `params`,
preserving omitted parameters versus an explicit empty object. This
separates the generic path from built-in handling and prevents
parameters from overwriting request fields.

## Validation

- 52 targeted tests passed: 15 Rust, 22 Python, and 15 TypeScript.
- Two Rust plugin doctests passed.
- Rust Clippy, the Node build and lint, changed-file Python lint,
TypeDoc generation, Vale, and the MkDocs SDK-reference build passed.
- Request tests cover Python sync/async calls, object and JSON-string
inputs, normalization, omitted and empty parameters, and collisions with
request metadata.
- Repository-wide Ruff reports existing findings in untouched
documentation examples. Strict Mintlify validation reports four missing
snippet-export warnings, also reproduced on the unmodified commit.

## Follow-ups

- Replace the built-in examples with a widely available custom plugin
when one is available, as discussed in review.
- Remote `list_indices()` and `index_stats()` still parse a fixed set of
type names; accepting unrecognized plugin types through a `Custom`
fallback remains separate.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 07:00:47 -08:00
Xuanwo 726a6f77a5 feat(embeddings): support Cohere v2 endpoints for Foundry text retrieval (#5193)
Continues #2519 (originally contributed by @1jamesthompson1) to address
#2518 for text retrieval with Cohere Embed models deployed on Azure AI
Foundry.

## Summary

Adds an opt-in native Cohere Embed API v2 (`ClientV2`) path to the
existing `cohere` embedding registry entry (`CohereEmbeddingFunction`)
for text-only retrieval against custom endpoints such as Azure AI
Foundry (`https://<resource>.services.ai.azure.com/providers/cohere`,
where the Cohere SDK appends `/v2/embed`).

### Behavior and Defaults

- **Opt-in v2 route (`base_url`)**: When `base_url` is set, requests use
`cohere.ClientV2` (`POST <base_url>/v2/embed`) with
`embedding_types=["float"]`, split inputs into batches of up to 96
texts, disable SDK-level retries, and validate returned vector counts
and dimensions. Application retries use `retry_with_exponential_backoff`
in `embeddings/utils.py`, which adds an optional `do_not_retry`
predicate used only by Cohere v2 so `3xx` redirects fail immediately
without backoff while transient failures such as `429` retry only the
failed batch. Non-string inputs are rejected; this change covers text
retrieval only.
- **Fixed retrieval roles**: In `base_url` mode, document embeddings use
`search_document` and query embeddings use `search_query`. Setting other
`source_input_type` or `query_input_type` values is rejected.
- **Explicit endpoint parameters**: Setting `base_url` requires explicit
`name` (the deployed model name), `output_dimension` (`> 0`, used for
both the Arrow vector column width and the v2 request
`output_dimension`), and `api_key`. Setting `output_dimension` or
`api_key` without `base_url` is rejected.
- **Unchanged hosted path**: When `base_url` is omitted, existing
behavior is preserved — `cohere.Client` (`/v1/embed`), `COHERE_API_KEY`,
existing default model/role settings, legacy table metadata restoration,
and the existing `cohere>=4.0` package floor.
- **Runtime SDK requirement**: Opting into `base_url` checks
`cohere>=5.15.0` at runtime and raises an `ImportError` on older SDK
versions without raising the minimum requirement for hosted users.

### Credentials and Endpoint Trust

- `api_key` is declared in `sensitive_keys()` and must be a registry
`$var:` reference without an inline fallback default (`$var:<name>`
only). Table metadata persists only the variable reference.
- `base_url` must be an HTTP(S) URL without embedded credentials, query
strings, or fragments, and is exposed through `endpoints()` so reopening
a table in a new process requires explicit approval via
`registry.allow_endpoint(...)`.
- `ClientV2` is cached per embedding function instance
(`@cached_property`) with `httpx.Client(follow_redirects=False,
timeout=300)` so redirects cannot forward requests or credentials off
the approved endpoint. Because Cohere v2 classifies `3xx` responses as
non-retryable via `do_not_retry`, a redirected `table.add` or
`table.search` call makes one `POST` with zero application backoff and
no request to the `Location` target (`table.add` surfaces the `307`
inside the existing Arrow/Rust `RuntimeError` wrapper; `table.search`
surfaces the Cohere `ApiError`).

## Verification

- **Loopback HTTP SDK tests (`test_cohere_embeddings.py`)**: Passed
against local loopback HTTP fixtures with real Cohere SDK `5.15.0`
(opt-in minimum), `7.0.5`, and `7.3.2`. Verified exact
`/providers/cohere/v2/embed` path, bearer auth header, JSON payload,
256-dim vector schema, `table.add`/reopen, fresh-process
`UntrustedEmbeddingConfigError` followed by `allow_endpoint(...)`,
deterministic role-based ranking, 96-text batching with
failed-batch-only `429` retry (single backoff), `307` redirect handling
with retries enabled on both `table.add` (wrapped in Arrow/Rust
`RuntimeError`) and `table.search` (Cohere `ApiError`) with one `POST`,
zero application backoff, and no `Location` request, plus invalid
input/dimension rejection.
- **Adjacent embedding, retry, and trust suites (`cohere==7.3.2`)**:
Passed across embedding, registry, trust (including the SDK-independent
Cohere metadata restoration and endpoint authorization test in
`test_embeddings_trust.py`), field metadata, NVIDIA embedding, and retry
suites (OpenAI-key test skipped without a key).
- **No-`cohere` environment**: Cohere config/legacy unit tests and
SDK-independent `test_embeddings_trust.py` metadata restoration and
endpoint authorization tests passed without `cohere` installed (real-SDK
loopback tests skipped).
- **Legacy SDK (`cohere==4.57`)**: Loopback wire check confirmed hosted
document/query requests continue targeting `/v1/embed` and opt-in
`base_url` usage raises `Cohere base_url requires cohere>=5.15.0`.
- **Docs & lint**: Offline Foundry schema test
(`test_embedding_cohere_foundry`), byte-identical regenerated snippet
(`docs/web/snippets/integrations.mdx`), and `python/` Ruff format/lint
checks passed.

### Scope of Verification

All HTTP request, authentication, redirect, trust, and ranking checks
were exercised against local loopback HTTP fixtures modeled on [Cohere's
Azure Foundry
workshop](https://github.com/cohere-ai/cohere-azure-workshops/tree/ca1c4cb162e2/lab-1-embed)
and the [Cohere Embed v2 API
reference](https://docs.cohere.com/v2/reference/embed). Acceptance
against a live Azure AI Foundry service (real Foundry credentials and
specific `output_dimension` overrides) has not been verified.
2026-11-24 20:20:18 +08:00
Xuanwo d605943e9b feat(python): add Bedrock image embeddings (#5190)
Continues #2320. Thank you @qingyuan18 for starting this work!

## Summary

Adds the `bedrock-image` (`BedrockImage`) embedding function for AWS
Bedrock image embeddings, exports it from `lancedb.embeddings`, updates
the AWS Bedrock docs, and extracts shared Bedrock runtime client setup
into `_BedrockEmbeddingFunction`.

- **Models**:
- `amazon.titan-embed-image-v1` (default, 1024 dims): PNG and JPEG
source images.
- `cohere.embed-v4:0` (1536 dims): PNG, JPEG, WebP, and GIF source
images (`search_document` for ingestion, `search_query` for queries).
Cohere v3 models remain text-only under `bedrock-text`.
- **Input & search**: Source columns accept encoded image `bytes` or
local file paths (`str`), with format detected from decoded bytes via
Pillow and `None` entries yielding `None` embeddings. Queries accept
text (`str`) or `PIL.Image.Image` (converted to RGB PNG);
`AsyncTable.search` requires `query_type="vector"` for Pillow image
queries.
- **Credentials**: `bedrock-image` uses `boto3.Session()`'s default
credential chain (e.g., `AWS_PROFILE` or the application's IAM role) and
rejects `profile_name`, `assumed_role`, and `role_session_name` on both
`create()` and metadata restore. `bedrock-text` retains its released
`profile_name`, `assumed_role`, and `role_session_name` settings.

## Validation

- Local Python tests cover the public `get_registry()` API, Arrow table
creation and ingestion (`bytes` and local path sources), table reopen
from persisted Arrow metadata, sync text and `PIL.Image` search, async
`query_type="vector"` `PIL.Image` search, credential-option rejection on
`bedrock-image` create/restore, and `bedrock-text` credential-setting
restoration and Cohere v3 text requests.
- SDK requests and payloads were validated at the `boto3`/`botocore`
`bedrock-runtime` client boundary using `botocore.stub.Stubber`. No live
AWS Bedrock service calls were run, so live IAM/STS credential
resolution, region model availability, and Bedrock service-side
validation are not covered.
2026-11-24 20:12:04 +08:00
Xuanwo 0fb15fd178 docs: add Mastra integration guide (#5189)
## Summary

Supersedes #2330 and brings the Mastra integration guide onto the
current `docs/web` Mintlify documentation structure with verified
LanceDB Embedded examples against the published `@mastra/lance` release.

Credit to @vishesh-baghel for authoring the original LanceDB Mastra
guide in #2330 and building the merged upstream Mastra storage and
vector adapters in mastra-ai/mastra#3324.

### Changes

- Add `docs/web/integrations/ai/mastra.mdx` covering LanceDB Embedded
usage with `@mastra/lance`:
- Node.js 22.13.0+ requirement and `npm install @mastra/lance
@mastra/core`.
- Runnable local `LanceVectorStore` quickstart (`create`, `createIndex`,
`upsert`, `query`, `close`) with verified nearest-neighbor output
(`lancedb 1`).
- Explanation of the two-step native vector index behavior in
`@mastra/lance` (first `createIndex()` initializes an empty table;
calling `createIndex()` again after upserting at least 256 rows builds
the native index on the `vector` column).
- Pointer to `LanceStorage` noting the published three-argument
`LanceStorage.create(id, name, uri)` signature and linking upstream
Mastra references, without unverified cloud claims.
- Register `integrations/ai/mastra` under **AI Platforms & Frameworks**
in `docs/web/docs.json`.
- Add the TypeScript example snippets to
`docs/web-tests/ts/integrations.ts` and regenerate the corresponding
exports (`TsFrameworksMastraQuickstart`,
`TsFrameworksMastraNativeIndex`) in
`docs/web/snippets/integrations.mdx`.

## Verification

- Verified against published `@mastra/lance@1.6.1` and
`@mastra/core@1.85.0` (resolving `@lancedb/lancedb@0.31.0` and
`apache-arrow@18.1.0`):
  - Two-vector local quickstart returns `lancedb 1`.
- Native `IVF_FLAT` index build after upserting 256 rows reports
`vector_idx` with 256 indexed rows, 0 unindexed rows, and
nearest-neighbor score `1`.
- Confirmed `LanceStorage.create(id, name, uri)` succeeds with three
arguments while the older two-argument call fails.
2026-11-24 18:14:29 +08:00
Jack Ye df1d3318df feat: add Azure storage account access key support to SDKs (#5177)
Add `azure_storage_account_access_key_secret` to the sync and async
Python storage integration APIs, with a matching Rust constructor. The
SDK sends a Secret reference in SQL and decodes the reference returned
by CREATE and DESCRIBE.

```python
info = db.create_storage_integration(
    "blobs", "az://customer-data/raw/",
    storage_provider="AZURE",
    azure_storage_account="customeraccount",
    azure_storage_account_access_key_secret="azure_key",
)
```

Azure requires a storage account and one authentication mode. The
account access key uses a single Secret. Service principal
authentication uses the existing three Secret references.
2026-11-23 22:49:41 -08:00
Xuanwo a6cca1efb0 feat(python)!: declare streaming Blob outputs for Functions (#5171)
BREAKING CHANGE: Rust callers constructing
`lancedb::function::FunctionOutput` with a struct literal now supply
`blob_writer_paths`. Use `Vec::new()` for an output without
writer-capable fields.

LanceDB Functions that generate large Blob v2 values can declare their
output with `BlobWriter` and write chunks during a computed column
refresh in a compatible LanceDB Enterprise environment. Row-wise and
vectorized callables use the same logical Blob schema. Named and nested
outputs can mark specific leaves with `BlobWriter.field` while retaining
ordinary binary siblings and nullable fields.

The SDK preserves writer requirements through native registration and
computed column binding. A distinct output kind lets earlier Enterprise
versions reject registrations that require a writer. Existing bytes-only
registrations retain their wire format and adapter.

On SDK commit
[`a19e7b87`](https://github.com/lancedb/lancedb/commit/a19e7b873c36aec865f092a368760be8846233ed),
a rebuilt extension preserved nested writer paths through Flight SQL
registration and version readback. Enterprise 1.14.1 rejected the writer
registration before building the Function image. With the compatible
runtime candidate, a real Flight SQL refresh published a 2 GiB + 137
byte value in each Blob layout against Moto. Independent reads verified
length and SHA-256 before and after cleanup of an older version. The run
also confirmed multipart abort and cumulative descriptor accounting.
[Runtime
evidence](https://linear.app/lancedb/issue/ENT-4209#comment-26e69e0e-faad-4aac-b148-3f4591181182)
· [Descriptor
accounting](https://linear.app/lancedb/issue/ENT-4209#comment-4d05e27a-8ff2-4003-804a-8af2f29ce2f4)

This SDK change is part of the coordinated Enterprise delivery.
[ENT-4209](https://linear.app/lancedb/issue/ENT-4209)
2026-11-24 13:53:06 +08:00
Xuanwo f183fe14c3 docs: explain storage reclamation after dropping columns (#5174)
Dropping a column can leave its data in files that the current table
still needs. The schema guide now explains how compaction and retention
determine when cleanup can reclaim those data files and their ordinary
Blob v2 sidecars.
2026-11-24 13:33:47 +08:00
Brendan Clement fe2d2b33fc docs: restore setup in standalone Python examples (#4970)
Eight Python examples on the consistency, insert and merge-insert pages
are presented as complete programs, but the published snippets started
after the imports, temporary directory and connection, so they failed
with NameError when run on their own.

The snippet start markers had been moved below the setup in the test
files. This moves them back above it and regenerates the snippets.
2026-11-23 10:08:43 -08:00
Yang Cen d9b49e8889 feat: report capacity waits in function refresh job status (#5154)
An Enterprise Function refresh can spend time waiting for execution
workers. Applications polling `job.status()` currently see `running`
during that wait. Return `waiting_for_capacity` when the server reports
that phase for an active Function refresh. The next status request
reports `running` when execution resumes. Applications can use
`job.wait()` to wait through both states until completion.

Rust, Python and Node read the phase from the existing job description
response.

## Validation

Two HTTP regression tests exercise the public job handle. They cover the
wait, work resuming, completion after another wait, a stale phase at
completion, queued and paused refreshes, other job types, and servers
that omit the phase. The Rust CI remote job runs these tests.
2026-11-22 16:00:50 +08:00
Yang Cen 08ddcdb7d7 feat: resume a failed Function refresh from its table (#5153)
LanceDB Enterprise users can resume a failed Function refresh from its
table with `table.resume_refresh(job_id)`. The synchronous and
asynchronous Python APIs return a typed job handle. Waiting on that
handle uses the same table freshness tracking as a newly submitted
refresh.

The request carries the current table identifier and branch to the
server. The server decides whether the original attempt can be resumed
and supplies the reason when it cannot. The Python refresh methods also
accept a positive `max_job_attempts` option for automatic recovery.
These features require server support for Function refresh recovery.

The PR adds remote request, branch, error propagation, and typed result
tests. Python and Rust validation runs in PR CI.
2026-11-22 15:40:22 +08:00
Jack Ye 2b1b2a29dd feat!: layer GPU settings and total execution limits (#5146)
BREAKING CHANGE: Resource inputs use the same names at Function
registration, column/MV creation, and refresh. Use total_cpu_millis,
total_memory_bytes, and total_gpu_count for execution-wide worker
budgets, plus gpu_class and positive gpu_count for each worker. Replace
budget dictionary inputs and unprefixed aggregate limits with these
fields. Move existing refresh gpu_count caps to total_gpu_count;
gpu_count now selects devices per worker.

Each setting resolves independently: refresh > column/MV creation >
Function annotation > deployment. Creation settings also apply to
initial MV population and automatic refresh. MVs sum total budgets
across distinct pinned Function versions; per-worker GPU counts use the
largest Function default unless overridden. An unset GPU class resolves
to gpu_class="any" after inheritance; an explicit "any" overrides a
registered concrete class. Use gpu_class="default" to pin the default
pool explicitly.

```python
@function(
    gpu=True, gpu_class="h100", gpu_count=2,
    total_cpu_millis=8000,
    total_memory_bytes=16 * 1024**3,
    total_gpu_count=4,
)
def embed(text: str) -> list[float]: ...

version = db.create_function(embed)
table.add_columns(
    {"embedding": version(text=col("text"))},
    gpu_class="any", gpu_count=1, total_gpu_count=8,
)
table.refresh_column_async(
    "embedding", gpu_class="h100", gpu_count=4, total_gpu_count=8,
)

mv = db.create_materialized_view(
    "embeddings", query="SELECT embed(text) AS embedding FROM documents",
    gpu_class="any", gpu_count=2, total_gpu_count=8,
)
mv.refresh(gpu_count=4, total_gpu_count=8)
```

```mermaid
flowchart TD
    R["Refresh settings"] --> E["Effective settings, resolved per field"]
    D["Column or MV creation settings"] --> E
    F["Function settings"] --> E
    C["Deployment defaults"] --> E
    E --> W["GPU class and device count per worker"]
    E --> T["Total CPU, memory and GPU ceilings"]
```

Pinned Function images retain their identity. Registration GPU counts
are defaults; execution overrides determine worker allocation. Admission
rejects GPU counts below an image's minimum requirement or above the
total budget. Python, Rust, SQL/REST and supported TypeScript operations
use the same resource model.

No local builds or tests, as requested; regression coverage runs in CI.
2026-11-21 15:04:34 -08:00
Jack Ye e3e55844bc fix: add SQL query timeout and cancellation controls
Add per-query SQL deadlines, read timeouts, and drop cancellation controls for Rust and Python.
2026-11-21 14:35:04 -08:00
Bruno Ramirez 7970d3075c docs: install the public CLI from the hosted script (#5139)
Installing the CLI from the guide previously required a repository
checkout or a manual download. The installer is available directly from
the downloads site. This updates the guide and quickstart for the
v0.42.0 stable release.
2026-11-21 13:52:49 -08:00
Xuanwo 564f8f93d4 test(python): cover embedded plans over enterprise bases (#5150)
## Summary

Clarify in the persistence guide and `persist` docstring that only the
plan destination must be Embedded. The base table can be Embedded or
Enterprise; an Enterprise base is pinned through the plan's recorded
base branch/version.

Add a focused loopback regression that persists a plan from a mock
remote base into an Embedded database, reopens the plan by destination
with `db.open_table`, advances the mock base's latest version to v2, and
verifies a fresh remote handle observes v2 while `Permutation` still
reads the plan's recorded main/v1 coordinates. Sequential iteration and
duplicate/unsorted offsets follow the stored plan order, and the mock
records nonempty v1 scan/gather requests.

## Verification

- Focused test plus affected remote mock tests: 3 passed.
- `ruff format --check` and `ruff check` passed.
- `git diff --check` passed.

This is a docs/test-only follow-up. It does not add Enterprise-resident
plan persistence or change plan ordering.
2026-11-21 17:09:53 +08:00
Jack Ye 0511aed6e9 feat: profile Enterprise Function workers from official clients 2026-11-21 00:51:08 -08:00
Jack Ye 49dedd4329 fix: expose Function metadata in SDK job listings (#5096)
Expose affected columns, pinned Function name/version, completion time,
duration and failure summaries on `JobInfo` in the Rust, Python and
TypeScript SDKs. Values come from the listing response, so callers can
inspect recent computed column refreshes without opening every job.
Older servers keep optional values absent; measured zero durations stay
zero.

```python
latest = next((info for info in db.list_jobs(table="events", job_type="function_refresh") if "embedding" in info.columns), None)
if latest is not None:
    print(latest.function_name, latest.function_version, latest.duration_millis)
    if latest.failure is not None:
        print(latest.failure.message)
```

Duration is creation-to-completion wall time, including queueing and
pauses. Adds listing response coverage across SDKs and documents the
metadata contract, including SQL `SHOW JOBS EXTENDED` for the expanded
listing. Plain `SHOW JOBS` preserves its original columns. Local builds
and tests were skipped as requested.

The dependency advisory check also fails on current main because
`libsais-rs 0.2.0` is yanked ([main
job](https://github.com/lancedb/lancedb/actions/runs/44470513618/job/135378545456));
this PR does not change dependencies.

This changes the public shape of Rust and TypeScript `JobInfo`: callers
constructing summaries must supply the added fields (including
TypeScript `columns`). TypeScript table filtering remains a separate
concern; the guide now shows its client-side selection and namespace
limitation alongside Python and Rust server-side filters.

Refs ENT-3903.
2026-11-21 00:18:29 -08:00
Xuanwo 6a7a2c4ec0 feat(nodejs): add table delta streams (#5149)
Adds the Embedded `Table.delta` API to the Node.js bindings, matching
the Rust/Python contract from #5135. `Table.delta(fromVersion,
toVersion?)` accepts a positive safe-integer number, a positive lossless
u64 `bigint`, or a same-branch tag string. `TableDelta` exposes
`beginVersion`/`endVersion` as `bigint`, streaming `insertedRows()`,
`updatedRows()`, `upsertedRows()`, `deletedRowIds()`, and
`listTransactions()` with `readVersion` as `bigint`.

Readers reuse the existing native Arrow IPC iterator adapter. They are
lazy, single-use, serialize pulls, capture/cache the schema before
polling, and release the native stream on completion, break, or error.
Row readers retain the Rust contract: equal endpoints return empty
streams with schemas, invalid/reversed/missing endpoints and
cross-branch tags are rejected, and Restore or incomplete transaction
history fail closed with full-rescan and range-end checkpoint guidance.
Enterprise tables remain unsupported through the native Rust default.

The abstract `Table` keeps a concrete unsupported `delta` default for
custom subclasses; `LocalTable` overrides it. TypeDoc API docs and
focused Node tests cover pinned targets, typed bigint values,
transaction listing, lazy rejected readers, schema/decode failures,
aliasing, and early drop.

Refs OSS-2860
2026-11-21 15:43:16 +08:00
Jack Ye b44807e4db fix!: preserve job attempt lineage, retries, and lifecycle states
BREAKING CHANGE: JobDescription, JobEventsRequest, FunctionErrorsRequest, and FunctionErrors gain optional Rust metadata/cursor fields. Existing struct literals must initialize them; use None when unavailable.

Preserve typed attempt state, pinned retry lineage, result decoders and freshness fences, and retained diagnostic paging across SDKs. Keep Python job data access method-only.
2026-11-20 20:35:59 -08:00
Jack Ye bfb55c72e9 feat(python)!: make job data access method-only (#5095)
Make all Python `Job` and `AsyncJob` data access method-only. Cached
property accessors are private and underscore-prefixed; public reads use
`id()`, `state()`, `job_type()`, `creation_ms()`, `spec()`, `result()`
and `failure()`. `checkout_latest()` refreshes the complete cached
registry record in place and returns `None`.

```python
job.checkout_latest()
print(job.state(), job.result(), job.failure())
print(job.id(), job.job_type(), job.creation_ms(), job.spec())
```

Cached read methods are synchronous on both handle types. Async handles
use `await job.checkout_latest()` for the live refresh; event history
remains a separate request through `events()`. Update Python SDK
callers, tests and guides to use method calls, including
progress/timeout handling and bounded repr. Cover method-only visibility
and holistic snapshot freshness through both sync and async clients.

BREAKING CHANGE: Python job data access now requires method calls, such
as `job.state()` instead of `job.state`. No property compatibility
aliases remain.

Fixes
https://linear.app/lancedb/issue/ENT-3902/sdk-make-cached-versus-live-job-accessors-unambiguous
2026-11-20 17:37:12 -08:00