Reference
Python API reference
Every public object of the srvdb Python package, one page each.
This section documents every public object of the srvdb package. Each page gives the signature, parameters, return value, the exact exceptions raised, durability and thread-safety notes, and a runnable example. Type stubs ship with the package, so editors show the same signatures.
Errors follow one rule: bad input raises ValueError, operating-system I/O failures raise OSError (FileNotFoundError when there is no database, FileExistsError when create finds one, BlockingIOError when it is already open), and internal faults or damaged data raise RuntimeError. See Handling errors.
Top level
Section titled “Top level”| Object | Summary |
|---|---|
srvdb.create |
Create a new database with its index and options. |
srvdb.open |
Open an existing database by path. |
srvdb.delete |
Delete a database from disk. |
| The database object | What create and open return (db), and the with block. |
Writing
Section titled “Writing”| Object | Summary |
|---|---|
db.add |
Add new vectors with their ids and metadata. |
db.upsert |
Add vectors, replacing any that already have the same id. |
db.delete |
Delete vectors by id. |
db.save |
Make every earlier write durable (crash-safe commit); db.persist() is an alias. |
db.close |
Release the database and its lock without saving. |
db.compact |
Remove deleted and replaced vectors from disk. |
Reading
Section titled “Reading”| Object | Summary |
|---|---|
db.search |
Find the k nearest vectors to a query. |
db.enable_keyword_search |
Index a metadata field for keyword (BM25) search. |
db.search_batch |
Run several searches in one call. |
db.get |
Return the metadata stored for an id. |
db.get_all_ids |
Return every live id. |
db.count |
Return the number of searchable vectors. |
db.info |
Return a one-line summary of the database. |
Tuning
Section titled “Tuning”| Object | Summary |
|---|---|
db.set_rabitq_rerank |
Change the rerank factor of a RaBitQ database. |
db.set_mode |
Switch the index mode of an open database. |
db.set_ef_search |
Set HNSW’s search candidate list size. |
db.configure_ivf |
Set the IVF partition parameters. |
db.train_ivf |
Train the IVF index on the stored vectors. |
Framework adapters
Section titled “Framework adapters”| Object | Summary |
|---|---|
srvdb.integrations.langchain.SrvDBVectorStore |
LangChain VectorStore over a SrvDB database. |
srvdb.integrations.llamaindex.SrvDBVectorStore |
LlamaIndex vector store over a SrvDB database. |
Constants
Section titled “Constants”| Object | Summary |
|---|---|
srvdb.__version__ |
The installed version string, for example "0.4.0". |
Errors and recovery
Section titled “Errors and recovery”Not part of everyday use; reach for it only when open fails, as described in Handling errors.
| Object | Summary |
|---|---|
srvdb.rebuild_checksums |
Recompute missing or damaged checksum files. |
Every example in this section is checked by a script. To run it, build the extension with maturin develop (with langchain-core and llama-index-core installed for the adapter pages), then run python website/scripts/check_examples.py from the repository root. Each example runs in its own temporary directory.
Was this page helpful? Tell us in Discussions.