File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ def get_password_from_azure_credential():
34
34
35
35
engine = create_async_engine (
36
36
DATABASE_URI ,
37
- echo = False ,
37
+ echo = True ,
38
38
)
39
39
40
40
@event .listens_for (engine .sync_engine , "connect" )
Original file line number Diff line number Diff line change @@ -84,6 +84,18 @@ async def search(
84
84
else :
85
85
raise ValueError ("Both query text and query vector are empty" )
86
86
87
+ first_item = (await self .db_session .execute (select (Item ).order_by (Item .id ).limit (1 ))).scalars ().first ()
88
+ # Will it work?
89
+ (
90
+ await self .db_session .execute (
91
+ text (
92
+ f"SELECT id, { Item .__tablename__ } .embedding_ada002 <=> :embedding AS distance "
93
+ f"FROM { Item .__tablename__ } ORDER BY distance LIMIT 2"
94
+ ),
95
+ {"embedding" : first_item .embedding_ada002 },
96
+ )
97
+ ).fetchall ()
98
+
87
99
results = (
88
100
await self .db_session .execute (
89
101
sql ,
You can’t perform that action at this time.
0 commit comments