Skip to content

Commit

Permalink
fix namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity committed Dec 14, 2024
1 parent d94d4a4 commit 4902d8e
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ const openai = createOpenAI({
apiKey: process.env.OPENAI_API_KEY,
});

const model = openai.embedding("text-embedding-3-small");

export const runReindexTurbopuffer = async (domain: string): Promise<number> => {
return turbopufferUpsertTask({
apiKey: turbopufferApiKey(),
namespace: domain,
namespace: `${model.modelId}_${domain}`,
payload: {
environment: fdrEnvironment(),
fernToken: fernToken(),
domain,
},
vectorizer: async (chunks) => {
const embeddings = await embedMany({
model: openai.embedding("text-embedding-3-small"),
model,
values: chunks,
});
return embeddings.embeddings;
Expand All @@ -36,12 +38,12 @@ export const runSemanticSearchTurbopuffer = async (
topK: number = 10,
): Promise<FernTurbopufferRecord[]> => {
return queryTurbopuffer(query, {
namespace: domain,
namespace: `${model.modelId}_${domain}`,
apiKey: turbopufferApiKey(),
topK,
vectorizer: async (text) => {
const embedding = await embed({
model: openai.embedding("text-embedding-3-small"),
model,
value: text,
});
return embedding.embedding;
Expand Down

0 comments on commit 4902d8e

Please sign in to comment.