teff.rag.stores¶
teff.rag.stores
¶
Vector store implementations.
Modules:
| Name | Description |
|---|---|
chroma |
Chroma vector store — requires |
factory |
Build a :class: |
faiss |
FAISS vector store — requires |
lance |
LanceDB vector store — requires |
memory |
In-memory vector store — zero dependencies. |
milvus |
Milvus vector store — requires |
pgvector |
PostgreSQL + pgvector store — requires |
pinecone |
Pinecone vector store — requires |
qdrant |
Qdrant vector store — requires |
sqlite |
SQLite vector store — file persistence with zero extra dependencies. |
weaviate |
Weaviate vector store — requires |
Classes:
| Name | Description |
|---|---|
InMemoryVectorStore |
In-memory vector store using cosine similarity. |
SQLiteVectorStore |
File-persistent vector store backed by SQLite (stdlib only). |
InMemoryVectorStore
¶
Bases: VectorStore
In-memory vector store using cosine similarity.
No external dependencies required. Useful for testing and small-scale use cases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim
|
int
|
Vector dimensionality (default 1536 for OpenAI ada-002). |
1536
|
Source code in teff/rag/stores/memory.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
SQLiteVectorStore
¶
Bases: VectorStore
File-persistent vector store backed by SQLite (stdlib only).
Vectors are stored as JSON blobs in a local .db file. Search is a
brute-force cosine similarity scan over all rows — suitable for small
to medium collections where you want persistence without installing a
heavy vector database.
All database work runs in a worker thread behind a lock, so searches and writes never block the event loop.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the SQLite database file. |
'./vectors.db'
|
dim
|
int | None
|
Vector dimensionality (used as a sanity check on add). |
None
|
Methods:
| Name | Description |
|---|---|
count_sync |
Synchronous count — lets a fresh process adopt an existing store. |
Source code in teff/rag/stores/sqlite.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
count_sync
¶
count_sync()
Synchronous count — lets a fresh process adopt an existing store.
Source code in teff/rag/stores/sqlite.py
106 107 108 109 | |