mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
16 lines
484 B
TypeScript
16 lines
484 B
TypeScript
import { RunnablePassthrough, RunnableSequence } from "@langchain/core/runnables";
|
|
|
|
const fakeRetriever = RunnablePassthrough.from((_q: string) =>
|
|
Promise.resolve([{ pageContent: "Hello world." }])
|
|
);
|
|
|
|
const formatDocumentsAsString = (documents: { pageContent: string }[]) =>documents.map((d) => d.pageContent).join("\n\n");
|
|
|
|
const chain = RunnableSequence.from([
|
|
{
|
|
context: fakeRetriever.pipe(formatDocumentsAsString),
|
|
question: new RunnablePassthrough(),
|
|
},
|
|
"",
|
|
]);
|