diff --git a/libs/langchain-community/src/document_loaders/web/airtable.ts b/libs/langchain-community/src/document_loaders/web/airtable.ts index 7d01bfa9ea64..6ec5bb094310 100644 --- a/libs/langchain-community/src/document_loaders/web/airtable.ts +++ b/libs/langchain-community/src/document_loaders/web/airtable.ts @@ -4,10 +4,16 @@ import { Document } from "@langchain/core/documents"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import { AsyncCaller } from "@langchain/core/utils/async_caller"; +export interface AirtableRequestParams { + view?: string; + maxRecords?: number; + filterByFormula?: string; +} + export interface AirtableLoaderOptions { tableId: string; baseId: string; - kwargs?: Record; + kwargs?: AirtableRequestParams; } interface AirtableRecord { @@ -28,7 +34,7 @@ export class AirtableLoader extends BaseDocumentLoader { private readonly baseId: string; - private readonly kwargs: Record; + private readonly kwargs: AirtableRequestParams; private static readonly BASE_URL = "https://api.airtable.com/v0"; @@ -123,6 +129,10 @@ export class AirtableLoader extends BaseDocumentLoader { ); if (offset) url.searchParams.append("offset", offset); if (this.kwargs.view) url.searchParams.append("view", this.kwargs.view); + if (this.kwargs.maxRecords) + url.searchParams.append("maxRecords", this.kwargs.maxRecords.toString()); + if (this.kwargs.filterByFormula) + url.searchParams.append("filterByFormula", this.kwargs.filterByFormula); return url.toString(); }