diff --git a/.env.example b/.env.example index 5e9a00d..ae5fbda 100644 --- a/.env.example +++ b/.env.example @@ -13,6 +13,7 @@ DOCS_VECTOR_TYPE=XXXXX CODE_VECTOR_TYPE=XXXXX PROJECT_VECTOR_TYPE=XXXXX ISSUE_VECTOR_TYPE=XXXXX +SEARCH_VECTOR_TYPE=XXXXX # Generate a random secret: https://generate-secret.vercel.app/32 or `openssl rand -base64 32` AUTH_SECRET=XXXXXXXX diff --git a/lib/tools/utils/embeddings.ts b/lib/tools/utils/embeddings.ts index a4bb768..7d24ed1 100644 --- a/lib/tools/utils/embeddings.ts +++ b/lib/tools/utils/embeddings.ts @@ -10,7 +10,7 @@ const openai = new OpenAI(config) export async function getEmbeddings(input: string) { try { const response = await openai.embeddings.create({ - model: 'text-embedding-ada-002', + model: 'text-embedding-3-small', input: input.replace(/\n/g, ' ') }) diff --git a/lib/tools/utils/pinecone.ts b/lib/tools/utils/pinecone.ts index f9c53d4..c60bd81 100644 --- a/lib/tools/utils/pinecone.ts +++ b/lib/tools/utils/pinecone.ts @@ -10,7 +10,7 @@ export type Metadata = { hash: string } -type VectorType = 'docs' | 'code' | 'project' | 'issue' +type VectorType = 'docs' | 'code' | 'project' | 'issue' | 'search' function getVectorType(vector_type: string): string | undefined { if (!isVectorType(vector_type)) { @@ -20,14 +20,15 @@ function getVectorType(vector_type: string): string | undefined { docs: process.env.DOCS_VECTOR_TYPE, code: process.env.CODE_VECTOR_TYPE, project: process.env.PROJECT_VECTOR_TYPE, - issue: process.env.ISSUE_VECTOR_TYPE + issue: process.env.ISSUE_VECTOR_TYPE, + search: process.env.SEARCH_VECTOR_TYPE } return vectorTypeMap[vector_type] } function isVectorType(type: string): type is VectorType { - return ['docs', 'code', 'project', 'issue'].includes(type) + return ['docs', 'code', 'project', 'issue', 'search'].includes(type) } const getMatchesFromEmbeddings = async (