Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 4d8116d

Browse files
committed
Change to correct alg: vec_distance_cosine
1 parent 20b083e commit 4d8116d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/codegate/storage/storage_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ async def search(
178178
query_sql = """
179179
WITH distances AS (
180180
SELECT name, type, status, description,
181-
vss_distance(embedding, ?) as distance
181+
vec_distance_cosine(embedding, ?) as distance
182182
FROM packages
183183
)
184184
SELECT name, type, status, description, distance

tests/vectordb/test_sqlitevec.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ def setup_vector_similarity(conn):
2525
# Insert a mock distance value that will be used in searches
2626
cursor.execute("INSERT INTO vector_distances (distance) VALUES (0.1)")
2727

28-
# Create a view that simulates the vss_distance function
28+
# Create a view that simulates the vec_distance_cosine function
2929
cursor.execute(
3030
"""
31-
CREATE VIEW IF NOT EXISTS vss_distance_view AS
31+
CREATE VIEW IF NOT EXISTS vec_distance_cosine_view AS
3232
SELECT distance FROM vector_distances WHERE id = 1
3333
"""
3434
)
3535

3636
# Create a function that returns the mock distance
37-
conn.create_function("vss_distance", 2, lambda x, y: 0.1)
37+
conn.create_function("vec_distance_cosine", 2, lambda x, y: 0.1)
3838

3939
mock_load.side_effect = setup_vector_similarity
4040
yield mock_load

0 commit comments

Comments
 (0)