MCPcopy Index your code
hub / github.com/edwinkys/oasysdb

github.com/edwinkys/oasysdb @v0.7.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.7.3 ↗ · + Follow
192 symbols 493 edges 18 files 83 documented · 43% updated 19mo agov0.7.3 · 2024-08-07★ 376
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

OasysDB Use Case

GitHub Stars Discord Documentation Crates.io

Introducing OasysDB 👋

OasysDB is a hybrid vector database that allows you to utilize relational databases like SQLite and Postgres as a storage engine for your vector data without using them to compute expensive vector operations.

This allows you to consolidate your data into a single database and ensure high data integrity with the ACID properties of traditional databases while also having a fast and isolated vector indexing layer.

For more details about OasysDB, please visit the Documentation.

Quickstart 🚀

Currently, OasysDB is only available for Rust projects as an embedded database. We are still working on implementing RPC APIs to allow you to use OasysDB in any language as a standalone service.

OasysDB has 2 primary components: Database and Index.

  • The Database is responsible for managing the vector indices and connecting the storage engine, the SQL database, to the indices as the data source. OasysDB uses SQLx to handle the SQL database operations.

  • The Index implements a vector indexing algorithm and is responsible for storing and querying vectors. The functionality and algorithm of the index depends on the algorithm we choose when creating the index.

Embedded in Rust

To use OasysDB as an embedded vector database in your Rust project, simply add it to the project Cargo.toml file or run the command below on the terminal:

cargo add oasysdb

When running OasysDB as an embedded database, you have access to both the Database and Index interfaces. In a rare occassion that you're building a project that doesn't utilize SQL, you can use the Index interface directly. Otherwise, the quickstart guide below will show you how to use the Database interface.

```rust no_run // Use the prelude module to import all necessary functionalities. use oasysdb::prelude::*;

// Open OasysDB database with connection to SQLite. // Connection is required for new database but optional for existing ones. let sqlite = "sqlite://sqlite.db"; let db = Database::open("odb_test", Some(sqlite)).unwrap();

// Create a new index with IVFPQ algorithm with default parameters. let params = ParamsIVFPQ::default(); let algorithm = IndexAlgorithm::IVFPQ(params); // Setup where the data of the index will come from. let config = SourceConfig::new("table", "id", "vector"); db.create_index("index", algorithm, config).unwrap();

// Search the index for nearest neighbors of a query vector. let query = vec![0.0; 128]; let filters = ""; // Optional SQL-like filter for the search. let results = db.search_index("index", query, 10, filters).unwrap(); ```

More Resources

Discord Documentation

There are more to OasysDB than what is shown in this Quickstart guide. Please visit OasysDB's Documentation for more information. In addition, if you have any question or need help that needs immediate response, please join our Discord Server and I will try my best to help you as soon as possible.

Contributing 🤝

The easiest way to contribute to this project is to star this project and share it with your friends. This will help us grow the community and make the project more visible to others who might need it.

If you want to go further and contribute your expertise, we will gladly welcome your code contributions. For more information and guidance about this, please see Contributing to OasysDB.

If you have a deep experience in the space but don't have the free time to contribute codes, we also welcome advices, suggestions, or feature requests. We are also looking for advisors to help guide the project direction and roadmap.

If you are interested about the project in any way, please join us on Discord Server. Help us grow the community and make OasysDB better 😁

Disclaimer

This project is still in the early stages of development. We are actively working on improving it and we expect the API and functionality to change. We do not recommend using this in production yet. If you do, however, please let us know so we can help you with any issues you might encounter as promptly as possible.

Extension points exported contracts — how you extend this code

IndexOps (Interface)
Trait for an index implementation. This trait defines the basic operations that an index should support. The trait come [2 …
src/indices/mod.rs
RowOps (Interface)
(no doc) [3 implementers]
src/types/record.rs
VectorIndex (Interface)
Trait for operating an index implementation. This trait defines operational methods to interact with the index such as [2 …
src/indices/mod.rs
IndexParams (Interface)
Trait for custom index parameters. Every index implementation should have a custom parameter struct that implements thi [2 …
src/indices/mod.rs

Core symbols most depended-on inside this repo

insert
called by 11
src/indices/idx_flat.rs
to_vec
called by 10
src/types/record.rs
distance
called by 8
src/types/distance.rs
try_get_index
called by 8
src/db/database.rs
create_test_database
called by 8
src/db/database.rs
get_index_ref
called by 7
src/db/database.rs
state
called by 7
src/db/database.rs
len
called by 5
src/types/record.rs

Shape

Method 121
Function 40
Class 19
Enum 8
Interface 4

Languages

Rust100%

Modules by API surface

src/db/database.rs51 symbols
src/indices/mod.rs40 symbols
src/indices/idx_ivfpq.rs21 symbols
examples/common/mod.rs14 symbols
src/utils/kmeans.rs13 symbols
src/indices/idx_flat.rs13 symbols
src/types/record.rs12 symbols
src/types/filter.rs11 symbols
src/types/err.rs5 symbols
src/types/distance.rs5 symbols
src/utils/file.rs3 symbols
examples/measure_recall.rs3 symbols

Datastores touched

(mysql)Database · 1 repos
dbDatabase · 1 repos
dbDatabase · 1 repos

For agents

$ claude mcp add oasysdb \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page