Skip to content

Commit

Permalink
Merge pull request #131 from technologiestiftung/staging
Browse files Browse the repository at this point in the history
chore: adapt num probes
  • Loading branch information
Jaszkowic authored Aug 1, 2024
2 parents 7b33a09 + 4bd855c commit 5eba365
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
7 changes: 6 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
NEXT_PUBLIC_KI_PARLA_API_URL=http://localhost:8080
NEXT_PUBLIC_MATOMO_URL=
NEXT_PUBLIC_MATOMO_SITE_ID=
NEXT_PUBLIC_MATOMO_SITE_ID=

# num_probes should be set to sqrt(num_rows_of_table / 1000)
# for reference, see https://github.com/pgvector/pgvector
NEXT_PUBLIC_NUM_PROBES_SUMMARY=4
NEXT_PUBLIC_NUM_PROBES_CHUNKS=12
17 changes: 11 additions & 6 deletions src/lib/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,28 +83,33 @@ export enum Algorithms {
SummariesThenChunks = "summaries-then-chunks",
}

// num_probes should be set to sqrt(num_rows_of_table / 1000)
// for reference, see https://github.com/pgvector/pgvector
const NUM_PROBES_SUMMARY = process.env.NEXT_PUBLIC_NUM_PROBES_SUMMARY || 4;
const NUM_PROBES_CHUNKS = process.env.NEXT_PUBLIC_NUM_PROBES_CHUNKS || 12;

export const availableAlgorithms = [
{
match_threshold: 0.85,
num_probes_summaries: 3,
num_probes_chunks: 9,
num_probes_summaries: NUM_PROBES_SUMMARY,
num_probes_chunks: NUM_PROBES_CHUNKS,
chunk_limit: 64,
document_limit: 20,
search_algorithm: Algorithms.ChunksOnly,
} as DocumentSearchBody,
{
match_threshold: 0.85,
num_probes_summaries: 3,
num_probes_chunks: 9,
num_probes_summaries: NUM_PROBES_SUMMARY,
num_probes_chunks: NUM_PROBES_CHUNKS,
chunk_limit: 128,
summary_limit: 16,
document_limit: 20,
search_algorithm: Algorithms.ChunksAndSummaries,
} as DocumentSearchBody,
{
match_threshold: 0.85,
num_probes_summaries: 3,
num_probes_chunks: 9,
num_probes_summaries: NUM_PROBES_SUMMARY,
num_probes_chunks: NUM_PROBES_CHUNKS,
summary_limit: 64,
document_limit: 20,
search_algorithm: Algorithms.SummariesThenChunks,
Expand Down

0 comments on commit 5eba365

Please sign in to comment.