From 01b15257c7424a35faafb2b6a8779077b3840c0d Mon Sep 17 00:00:00 2001 From: Mahmoud Abdelwahab Date: Wed, 23 Aug 2023 09:11:15 +0300 Subject: [PATCH] Update route.ts to use Cosine distance --- src/app/api/idea/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/idea/route.ts b/src/app/api/idea/route.ts index b5bd989..18a0c8c 100644 --- a/src/app/api/idea/route.ts +++ b/src/app/api/idea/route.ts @@ -54,7 +54,7 @@ export async function POST(request: NextRequest) { const embedding = await generateEmbeddings(idea); const result = await sql( - `SELECT id, name, "smallLogoUrl", website, "oneLiner", "longDescription", batch, url, status, industries FROM companies ORDER BY embedding <-> array[${embedding}] LIMIT 5;` + `SELECT id, name, "smallLogoUrl", website, "oneLiner", "longDescription", batch, url, status, industries FROM companies ORDER BY embedding <=> array[${embedding}] LIMIT 5;` ); return NextResponse.json({ data: result });