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 AirtableLoader to load documents from Airtable with retry and pagination handling #7106

Merged
merged 10 commits into from
Nov 12, 2024

Conversation

SkSirius
Copy link
Contributor

As per discussion #7064

Summary:

This PR introduces the AirtableLoader class, a document loader for fetching records from Airtable using the LangChain framework. The loader supports features such as pagination, retry logic, and environment-based API token validation to facilitate reliable document loading from Airtable tables.

Changes:

Introduced AirtableLoader class that supports synchronous and asynchronous generator-based document loading.

  • load(): Retrieves all documents from Airtable with automatic pagination.
  • loadLazy(): An asynchronous generator that yields each document individually to manage memory effectively.

Testing:

  • Unit and integration tests included

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. auto:documentation Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder auto:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features labels Oct 29, 2024
Copy link

vercel bot commented Oct 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview Nov 12, 2024 0:14am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ⬜️ Ignored (Inspect) Nov 12, 2024 0:14am

const maxRetries = AirtableLoader.MAX_RETRIES;
const retryDelayMs = AirtableLoader.DEFAULT_RETRY_DELAY_MS;

if (attempt <= maxRetries) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import example

import { AsyncCaller } from "@langchain/core/utils/async_caller";

@jacoblee93
Copy link
Collaborator

Thanks! See small comment

@SkSirius
Copy link
Contributor Author

SkSirius commented Nov 5, 2024

@jacoblee93, updated loader to us AsyncCaller.

Copy link
Collaborator

@jacoblee93 jacoblee93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

);
}

this.asyncCaller = new AsyncCaller({ maxRetries: 3, maxConcurrency: 5 });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be nice to make this configurable in the future but fine for now

@dosubot dosubot bot added the lgtm PRs that are ready to be merged as-is label Nov 11, 2024
@jacoblee93 jacoblee93 changed the title [langchain_community] Add AirtableLoader to load documents from Airtable with retry and pagination handling feat(community): Add AirtableLoader to load documents from Airtable with retry and pagination handling Nov 11, 2024
@jacoblee93 jacoblee93 merged commit 18b1810 into langchain-ai:main Nov 12, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:documentation Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder auto:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features lgtm PRs that are ready to be merged as-is size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants