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():
3434
3535 engine = create_async_engine (
3636 DATABASE_URI ,
37- echo = False ,
37+ echo = True ,
3838 )
3939
4040 @event .listens_for (engine .sync_engine , "connect" )
Original file line number Diff line number Diff line change @@ -84,6 +84,18 @@ async def search(
8484 else :
8585 raise ValueError ("Both query text and query vector are empty" )
8686
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+
8799 results = (
88100 await self .db_session .execute (
89101 sql ,
You can’t perform that action at this time.
0 commit comments