langchain-ai/langchainjs

AirTable Document Loader not working with additional parameters

eduardconstantin opened this issue · 2 comments

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

const loaderView = new AirtableLoader({
  tableId: "YOUR_TABLE_ID",
  baseId: "YOUR_BASE_ID",
  kwargs: { view: "YOUR_VIEW_NAME", maxRecords: 10 },
});
const documents = await loader.load();
console.log("Loaded documents with view:", documents);

Error Message and Stack Trace (if applicable)

No response

Description

I am trying to retrieve a certain number of rows from airtable, if I try to add the maxRecords: 10 parameter to kwargs it still returns all the rows from the selected table.

System Info

platform windows
Node v20.14.0
yarn 1.22.22

Hey @eduardconstantin! I'm here to help you with bugs, questions, and becoming a contributor. Let's tackle this issue together.

The issue you're experiencing with the AirtableLoader not respecting the maxRecords parameter in kwargs is likely due to the current implementation of the AirtableLoader. Based on the available information, the AirtableLoader internally handles the kwargs parameter by appending additional query parameters to the Airtable API request URL, but it explicitly supports only the view parameter [1].

There is no indication that maxRecords is currently supported or handled by the AirtableLoader. This means that even if you pass maxRecords in kwargs, it might not be used in constructing the API request, resulting in all records being fetched instead of the limited number you specified.

To address this, you might need to modify the AirtableLoader code to explicitly handle the maxRecords parameter by appending it to the API request URL, similar to how the view parameter is handled. If you're comfortable with making changes to the code, you can add logic to include maxRecords in the URL construction. Otherwise, you might need to wait for an update from the maintainers that includes support for this parameter.

To continue talking to Dosu, mention @dosu.

@dosu I can try to add it.