mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 00:36:56 +02:00
small doc changes
This commit is contained in:
parent
a3b42f65b2
commit
5e5f4a38a0
5 changed files with 59 additions and 6 deletions
1
bindings/go/ncruces/go-sqlite3
Submodule
1
bindings/go/ncruces/go-sqlite3
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 21de85e849b7660b9b527535b1999f942084fd02
|
||||
46
bindings/python/extra_init.py
Normal file
46
bindings/python/extra_init.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
from typing import List
|
||||
from struct import pack
|
||||
from sqlite3 import Connection
|
||||
|
||||
def serialize_float32(vector: List[float]) -> bytes:
|
||||
""" Serializes a list of floats into the "raw bytes" format sqlite-vec expects """
|
||||
return pack("%sf" % len(vector), *vector)
|
||||
|
||||
def serialize_int8(vector: List[int]) -> bytes:
|
||||
""" Serializes a list of integers into the "raw bytes" format sqlite-vec expects """
|
||||
return pack("%sb" % len(vector), *vector)
|
||||
|
||||
def serialize_(vector: List[int]) -> bytes:
|
||||
""" Serializes a list of integers into the "raw bytes" format sqlite-vec expects """
|
||||
return pack("%sb" % len(vector), *vector)
|
||||
|
||||
try:
|
||||
import numpy.typing as npt
|
||||
|
||||
def register_numpy(db: Connection, name:str, array: npt.NDArray):
|
||||
"""ayoo"""
|
||||
|
||||
ptr = array.__array_interface__["data"][0]
|
||||
nvectors, dimensions = array.__array_interface__["shape"]
|
||||
element_type = array.__array_interface__["typestr"]
|
||||
|
||||
assert element_type == "<f4"
|
||||
|
||||
name_escaped = db.execute("select printf('%w', ?)", [name]).fetchone()[0]
|
||||
|
||||
db.execute(
|
||||
"""
|
||||
insert into temp.vec_static_blobs(name, data)
|
||||
select ?, vec_static_blob_from_raw(?, ?, ?, ?)
|
||||
""",
|
||||
[name, ptr, element_type, dimensions, nvectors],
|
||||
)
|
||||
|
||||
db.execute(
|
||||
f'create virtual table "{name_escaped}" using vec_static_blob_entries({name_escaped})'
|
||||
)
|
||||
|
||||
except ImportError:
|
||||
def register_numpy(db: Connection, name:str, array: npt.NDArray):
|
||||
raise Exception("numpy package is required for register_np")
|
||||
|
|
@ -128,14 +128,14 @@ function sidebar(): DefaultTheme.SidebarItem[] {
|
|||
text: "Getting Started",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{
|
||||
text: "Installation",
|
||||
link: "/installation",
|
||||
},
|
||||
{
|
||||
text: "Introduction",
|
||||
link: "/introduction",
|
||||
},
|
||||
{
|
||||
text: "Installation",
|
||||
link: "/installation",
|
||||
},
|
||||
{
|
||||
text: "Quick Start",
|
||||
link: "/quickstart",
|
||||
|
|
|
|||
|
|
@ -149,6 +149,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
.VPContent.is-home .language-sqlite {
|
||||
max-width: 640px;
|
||||
margin: 0 auto;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Component: Custom Block
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ features:
|
|||
details: On laptops, servers, mobile devices, browsers with WASM, Raspberry Pis, and more!
|
||||
- title: Bindings for many languages
|
||||
details: Python, Ruby, Node.js/Deno/Bun, Go, Rust, and more!
|
||||
- title: Only SQL
|
||||
details: No extra configuration or server, only CREATEs, INSERTs, and SELECTs
|
||||
- title: Pure SQL
|
||||
details: No extra configuration or server required — only CREATE, INSERT, and SELECT statements
|
||||
---
|
||||
|
||||
```sqlite
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue