mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-10 20:19:22 +00:00
Adding an additional comment
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
This commit is contained in:
parent
058668d667
commit
2f017b8590
1 changed files with 2 additions and 1 deletions
|
@ -79,9 +79,10 @@ class SQLiteVecIndex(EmbeddingIndex):
|
|||
try:
|
||||
# Start transaction
|
||||
cur.execute("BEGIN TRANSACTION")
|
||||
# Serialize and insert the chunk metadata.
|
||||
chunk_data = [(chunk.model_dump_json(),) for chunk in chunks]
|
||||
cur.executemany(f"INSERT INTO {self.metadata_table} (chunk) VALUES (?)", chunk_data)
|
||||
# Fetch the last N inserted row IDs
|
||||
# Fetch the last *n* inserted row_ids -- note: this is more reliable than `row_id = cur.lastrowid`
|
||||
cur.execute(f"SELECT rowid FROM {self.metadata_table} ORDER BY rowid DESC LIMIT {len(chunks)}")
|
||||
row_ids = [row[0] for row in cur.fetchall()]
|
||||
row_ids.reverse() # Reverse to maintain the correct order of insertion
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue