A class that extends the BaseDocumentLoader and implements the DocumentLoader interface. It represents a document loader that loads documents from an Apify dataset.

Example

const loader = new ApifyDatasetLoader("your-dataset-id", {
datasetMappingFunction: (item) =>
new Document({
pageContent: item.text || "",
metadata: { source: item.url },
}),
clientOptions: {
token: "your-apify-token",
},
});

const docs = await loader.load();

const chain = new RetrievalQAChain();
const res = await chain.invoke({ query: "What is LangChain?" });

console.log(res.text);
console.log(res.sourceDocuments.map((d) => d.metadata.source));

Type Parameters

  • Metadata extends Record<string, any>

Hierarchy (view full)

Implements

Constructors

Properties

apifyClient: ApifyClient
caller: AsyncCaller
datasetId: string
datasetMappingFunction: ApifyDatasetMappingFunction<Metadata>

Methods

Generated using TypeDoc