haiku.rag 0.7.4__py3-none-any.whl → 0.7.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of haiku.rag might be problematic. Click here for more details.
- haiku/rag/migration.py +24 -24
- {haiku_rag-0.7.4.dist-info → haiku_rag-0.7.5.dist-info}/METADATA +1 -1
- {haiku_rag-0.7.4.dist-info → haiku_rag-0.7.5.dist-info}/RECORD +6 -6
- {haiku_rag-0.7.4.dist-info → haiku_rag-0.7.5.dist-info}/WHEEL +0 -0
- {haiku_rag-0.7.4.dist-info → haiku_rag-0.7.5.dist-info}/entry_points.txt +0 -0
- {haiku_rag-0.7.4.dist-info → haiku_rag-0.7.5.dist-info}/licenses/LICENSE +0 -0
haiku/rag/migration.py
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Migration script to migrate from SQLite to LanceDB.
|
|
4
|
-
|
|
5
|
-
This script will:
|
|
6
|
-
1. Read data from an existing SQLite database
|
|
7
|
-
2. Create a new LanceDB database with the same data
|
|
8
|
-
3. Preserve all documents, chunks, embeddings, and settings
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
1
|
import json
|
|
12
2
|
import sqlite3
|
|
13
3
|
import struct
|
|
@@ -55,6 +45,22 @@ class SQLiteToLanceDBMigrator:
|
|
|
55
45
|
sqlite_conn = sqlite3.connect(self.sqlite_path)
|
|
56
46
|
sqlite_conn.row_factory = sqlite3.Row
|
|
57
47
|
|
|
48
|
+
# Load the sqlite-vec extension
|
|
49
|
+
try:
|
|
50
|
+
import sqlite_vec
|
|
51
|
+
|
|
52
|
+
sqlite_conn.enable_load_extension(True)
|
|
53
|
+
sqlite_vec.load(sqlite_conn)
|
|
54
|
+
self.console.print("[blue]Loaded sqlite-vec extension[/blue]")
|
|
55
|
+
except Exception as e:
|
|
56
|
+
self.console.print(
|
|
57
|
+
f"[yellow]Warning: Could not load sqlite-vec extension: {e}[/yellow]"
|
|
58
|
+
)
|
|
59
|
+
self.console.print(
|
|
60
|
+
"[yellow]Install sqlite-vec with[/yellow]\n[green]uv pip install sqlite-vec [/green]"
|
|
61
|
+
)
|
|
62
|
+
exit(1)
|
|
63
|
+
|
|
58
64
|
# Create LanceDB store
|
|
59
65
|
lance_store = Store(self.lancedb_path, skip_validation=True)
|
|
60
66
|
|
|
@@ -180,30 +186,24 @@ class SQLiteToLanceDBMigrator:
|
|
|
180
186
|
|
|
181
187
|
chunks_data = cursor.fetchall()
|
|
182
188
|
|
|
183
|
-
# Get embeddings
|
|
189
|
+
# Get embeddings using the sqlite-vec virtual table
|
|
184
190
|
embeddings_map = {}
|
|
185
191
|
try:
|
|
186
|
-
#
|
|
192
|
+
# Use the virtual table to get embeddings properly
|
|
187
193
|
cursor.execute("""
|
|
188
|
-
SELECT
|
|
189
|
-
|
|
190
|
-
v.vectors
|
|
191
|
-
FROM chunk_embeddings_rowids r
|
|
192
|
-
JOIN chunk_embeddings_vector_chunks00 v ON r.rowid = v.rowid
|
|
194
|
+
SELECT chunk_id, embedding
|
|
195
|
+
FROM chunk_embeddings
|
|
193
196
|
""")
|
|
194
197
|
|
|
195
198
|
for row in cursor.fetchall():
|
|
196
199
|
chunk_id = row[0]
|
|
197
|
-
|
|
198
|
-
if
|
|
199
|
-
embeddings_map[chunk_id] =
|
|
200
|
+
embedding_blob = row[1]
|
|
201
|
+
if embedding_blob and chunk_id not in embeddings_map:
|
|
202
|
+
embeddings_map[chunk_id] = embedding_blob
|
|
200
203
|
|
|
201
204
|
except sqlite3.OperationalError as e:
|
|
202
205
|
self.console.print(
|
|
203
|
-
f"[yellow]Warning: Could not extract embeddings: {e}[/yellow]"
|
|
204
|
-
)
|
|
205
|
-
self.console.print(
|
|
206
|
-
"[yellow]Continuing migration without embeddings...[/yellow]"
|
|
206
|
+
f"[yellow]Warning: Could not extract embeddings from virtual table: {e}[/yellow]"
|
|
207
207
|
)
|
|
208
208
|
|
|
209
209
|
chunks = []
|
|
@@ -6,7 +6,7 @@ haiku/rag/client.py,sha256=N4zkWjE9Rsw9YgPvNo83xptHUQR2ognfOnjkoV_w6hc,20999
|
|
|
6
6
|
haiku/rag/config.py,sha256=3H41da9BU1R1y2JJHD0cOSErX_VSM1UXA7M2JSOxFXE,1795
|
|
7
7
|
haiku/rag/logging.py,sha256=a0ELyeMqb85ebeOTN8OQCTL1PiMWiiV9R_OOH-VZoA8,1665
|
|
8
8
|
haiku/rag/mcp.py,sha256=bR9Y-Nz-hvjiql20Y0KE0hwNGwyjmPGX8K9d-qmXptY,4683
|
|
9
|
-
haiku/rag/migration.py,sha256=
|
|
9
|
+
haiku/rag/migration.py,sha256=n5G6SDhTo8wTf0uCYbWGegq1LqIgILDLNjWcGvSj-SQ,11053
|
|
10
10
|
haiku/rag/monitor.py,sha256=r386nkhdlsU8UECwIuVwnrSlgMk3vNIuUZGNIzkZuec,2770
|
|
11
11
|
haiku/rag/reader.py,sha256=qkPTMJuQ_o4sK-8zpDl9WFYe_MJ7aL_gUw6rczIpW-g,3274
|
|
12
12
|
haiku/rag/utils.py,sha256=c8F0ECsFSqvQxzxINAOAnvShoOnJPLsOaNE3JEY2JSc,3230
|
|
@@ -34,8 +34,8 @@ haiku/rag/store/repositories/chunk.py,sha256=v4y4eh4yIf6zJaWfHxljvnmb12dmvwdinzm
|
|
|
34
34
|
haiku/rag/store/repositories/document.py,sha256=lP8Lo82KTP-qwXFRpYZ46WjeAdAsHwZ5pJcrXdz4g0U,6988
|
|
35
35
|
haiku/rag/store/repositories/settings.py,sha256=dqnAvm-98nQrWpLBbf9QghJw673QD80-iqQhRMP5t0c,5025
|
|
36
36
|
haiku/rag/store/upgrades/__init__.py,sha256=wUiEoSiHTahvuagx93E4FB07v123AhdbOjwUkPusiIg,14
|
|
37
|
-
haiku_rag-0.7.
|
|
38
|
-
haiku_rag-0.7.
|
|
39
|
-
haiku_rag-0.7.
|
|
40
|
-
haiku_rag-0.7.
|
|
41
|
-
haiku_rag-0.7.
|
|
37
|
+
haiku_rag-0.7.5.dist-info/METADATA,sha256=URf4qAZuzeL3OpTKuF6IhOeSmfRWlph-1pLboZTQUnw,4610
|
|
38
|
+
haiku_rag-0.7.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
39
|
+
haiku_rag-0.7.5.dist-info/entry_points.txt,sha256=G1U3nAkNd5YDYd4v0tuYFbriz0i-JheCsFuT9kIoGCI,48
|
|
40
|
+
haiku_rag-0.7.5.dist-info/licenses/LICENSE,sha256=eXZrWjSk9PwYFNK9yUczl3oPl95Z4V9UXH7bPN46iPo,1065
|
|
41
|
+
haiku_rag-0.7.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|