From 45008228476dcbfea985fe9b60d14c02683bd1e5 Mon Sep 17 00:00:00 2001 From: Andrew Jiang <andrew@buildwithfern.com> Date: Fri, 13 Dec 2024 22:20:09 -0500 Subject: [PATCH] update namespace --- .../ui/docs-bundle/src/pages/api/fern-docs/search/v2/chat.ts | 2 +- .../src/pages/api/fern-docs/search/v2/reindex/turbopuffer.ts | 2 +- .../fern-docs-search-ui/src/server/run-reindex-turbopuffer.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui/docs-bundle/src/pages/api/fern-docs/search/v2/chat.ts b/packages/ui/docs-bundle/src/pages/api/fern-docs/search/v2/chat.ts index 742b853c0a..376afadf2c 100644 --- a/packages/ui/docs-bundle/src/pages/api/fern-docs/search/v2/chat.ts +++ b/packages/ui/docs-bundle/src/pages/api/fern-docs/search/v2/chat.ts @@ -30,7 +30,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) } const domain = getDocsDomainNode(req); - const namespace = `${embeddingModel.modelId}_${withoutStaging(domain)}`; + const namespace = `${withoutStaging(domain)}_${embeddingModel.modelId}`; const messages = req.body.messages; const orgMetadata = await getOrgMetadataForDomain(withoutStaging(domain)); diff --git a/packages/ui/docs-bundle/src/pages/api/fern-docs/search/v2/reindex/turbopuffer.ts b/packages/ui/docs-bundle/src/pages/api/fern-docs/search/v2/reindex/turbopuffer.ts index 4e229c60c7..00e122579a 100644 --- a/packages/ui/docs-bundle/src/pages/api/fern-docs/search/v2/reindex/turbopuffer.ts +++ b/packages/ui/docs-bundle/src/pages/api/fern-docs/search/v2/reindex/turbopuffer.ts @@ -22,7 +22,7 @@ export const maxDuration = 900; // 15 minutes export default async function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> { const domain = getDocsDomainNode(req); const deleteExisting = req.query.deleteExisting === "true"; - const namespace = `${embeddingModel.modelId}_${withoutStaging(domain)}`; + const namespace = `${withoutStaging(domain)}_${embeddingModel.modelId}`; try { const orgMetadata = await getOrgMetadataForDomain(withoutStaging(domain)); diff --git a/packages/ui/fern-docs-search-ui/src/server/run-reindex-turbopuffer.ts b/packages/ui/fern-docs-search-ui/src/server/run-reindex-turbopuffer.ts index 16278302ec..1fdca5f2e7 100644 --- a/packages/ui/fern-docs-search-ui/src/server/run-reindex-turbopuffer.ts +++ b/packages/ui/fern-docs-search-ui/src/server/run-reindex-turbopuffer.ts @@ -16,7 +16,7 @@ const model = openai.embedding("text-embedding-3-small"); export const runReindexTurbopuffer = async (domain: string): Promise<number> => { return turbopufferUpsertTask({ apiKey: turbopufferApiKey(), - namespace: `${model.modelId}_${domain}`, + namespace: `${domain}_${model.modelId}`, payload: { environment: fdrEnvironment(), fernToken: fernToken(), @@ -38,7 +38,7 @@ export const runSemanticSearchTurbopuffer = async ( topK: number = 10, ): Promise<FernTurbopufferRecord[]> => { return queryTurbopuffer(query, { - namespace: `${model.modelId}_${domain}`, + namespace: `${domain}_${model.modelId}`, apiKey: turbopufferApiKey(), topK, vectorizer: async (text) => {