Skip to content

Commit d8475bd

Browse files
authored
hotfix: Feed LLM attributes.chunk instead of attributes.description (#2350)
1 parent 69c1612 commit d8475bd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/fern-docs/search-server/src/turbopuffer/to-documents.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ export function toDocuments(results: FernTurbopufferRecord[]): string[] {
55
return uniqBy(
66
results.map((result) => {
77
const code_snippets = zipWith(
8-
result.attributes.code_snippets ?? [],
9-
result.attributes.code_snippet_langs ?? [],
8+
result.attributes.code_snippets?.filter((snippet) => snippet.length < 1000) ?? [],
9+
result.attributes.code_snippet_langs?.filter((lang) => lang.length < 1000) ?? [],
1010
(snippet, lang) => {
1111
const lang_str: string = lang ?? "";
1212
return `\`\`\`${lang_str}\n${snippet}\n\`\`\``;
1313
}
1414
).join("\n\n");
1515
return {
1616
canonicalPathname: result.attributes.canonicalPathname,
17+
chunk: result.attributes.chunk,
1718
domain: result.attributes.domain,
1819
pathname: result.attributes.pathname,
1920
hash: result.attributes.hash,
@@ -31,6 +32,6 @@ export function toDocuments(results: FernTurbopufferRecord[]): string[] {
3132
(result) => `${result.pathname}${result.hash} - ${result.page_position}`
3233
).map(
3334
(result) =>
34-
`# ${result.title}\n Source: ${result.domain}${result.pathname}${result.hash ?? ""}\n\n${result.description}${result.content}${result.code_snippets}`
35+
`# ${result.title}\n Source: ${result.domain}${result.pathname}${result.hash ?? ""}\n\n${result.chunk}${result.description}${result.content}${result.code_snippets}`
3536
);
3637
}

0 commit comments

Comments
 (0)