Skip to content

Commit df9b4c7

Browse files
authored
Get k semantic (#4788)
1 parent e68e935 commit df9b4c7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/fern-docs/search-server/ask-fern/src/ask-fern/run-query-turbopuffer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { EmbeddingModel } from "ai";
44
import { embed } from "ai";
55

66
import { isAuthError, queryTurbopuffer, type TurbopufferQueryResult } from "../turbopuffer";
7+
import { TOP_K } from "./stream-constants";
78

89
export async function runQueryTurbopuffer(
910
query: string | null | undefined,
@@ -26,7 +27,7 @@ export async function runQueryTurbopuffer(
2627
const results = await queryTurbopuffer(query, {
2728
namespace: opts.namespace,
2829
apiKey: turbopufferApiKey(),
29-
topK: opts.topK ?? 5,
30+
topK: opts.topK ?? TOP_K,
3031
vectorizer: async (text) => {
3132
const embedding = await embed({
3233
model: opts.embeddingModel,

packages/fern-docs/search-server/ask-fern/src/turbopuffer/inference/query-turbopuffer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export async function queryTurbopuffer(
8686
? await ns.query({
8787
vector,
8888
distance_metric: "cosine_distance",
89-
top_k: 1,
89+
top_k: topK,
9090
include_attributes: true,
9191
filters: queryFilters
9292
})

0 commit comments

Comments
 (0)