Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(community): Add additional fields to airtable loader #7322

Merged
Merged
Changes from 3 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
12 changes: 10 additions & 2 deletions libs/langchain-community/src/document_loaders/web/airtable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, any>;
kwargs?: AirtableRequestParams;
}

interface AirtableRecord {
Expand All @@ -28,7 +34,7 @@ export class AirtableLoader extends BaseDocumentLoader {

private readonly baseId: string;

private readonly kwargs: Record<string, any>;
private readonly kwargs: AirtableRequestParams;

private static readonly BASE_URL = "https://api.airtable.com/v0";

Expand Down Expand Up @@ -123,6 +129,8 @@ 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();
}

Expand Down
Loading