Skip to content

Commit

Permalink
Add api reference
Browse files Browse the repository at this point in the history
  • Loading branch information
1yefuwang1 committed Aug 26, 2024
1 parent c050f98 commit 4a4c792
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ vector_from_json(json_string) -- converts a json array of type TEXT into BLOB(a
vector_to_json(vector_blob) -- converts a vector of type BLOB(c-style float32 array) into a json array of type TEXT
vector_distance(vector_blob1, vector_blob2, distance_type_str) -- calculate vector distance between two vectors, distance_type_str could be 'l2', 'cosine', 'ip'
```
In fact, one can easily implement brute force searching using `vector_distance`:
```sql
-- use a normal sqlite table
create table my_table(rowid integer primary key, embedding blob);

-- insert
insert into my_table(rowid, embedding) values (0, {your_embedding});
-- search for 10 nearest neighbors using l2 squared distance
select rowid from my_table order by vector_distance({query_vector}, embedding, 'l2') asc limit 10

```

### Virtual Table
The core of vectorlite is the [virtual table](https://www.sqlite.org/vtab.html) module, which is used to hold vector index.
A vectorlite table can be created using:
Expand Down
8 changes: 4 additions & 4 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'Example'
copyright = 'workshop participant'
author = 'workshop participant'
release = '0.1'
project = 'vectorlite'
copyright = 'vectorlite contributors'
author = '[email protected]'
release = '0.2.0'


# -- General configuration ---------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Example's documentation!
Welcome to vectorlite's documentation!
===================================

.. toctree::
:maxdepth: 2
:caption: Contents:

markdown/overview.md
markdown/another-feature.md
markdown/api.md

0 comments on commit 4a4c792

Please sign in to comment.