Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions js/testapps/rag/src/pdf-rag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { chunk } from 'llm-chunk';
import path from 'path';
import pdf from 'pdf-parse';
import { ai } from './genkit.js';
import { augmentedPrompt } from './prompt.js';

export const pdfChatRetriever = devLocalRetrieverRef('pdfQA');

Expand All @@ -45,15 +44,12 @@ export const pdfQA = ai.defineFlow(
options: { k: 3 },
});

return augmentedPrompt(
{
question: query,
context: docs.map((d) => d.text),
},
{
onChunk: (c) => sendChunk(c.text),
}
).then((r) => r.text);
const { text } = await ai.generate({
prompt: query,
docs,
onChunk: (c) => sendChunk(c.text),
});
return text;
}
);

Expand Down