diff --git a/docs/core_docs/docs/integrations/retrievers/arxiv-retriever.mdx b/docs/core_docs/docs/integrations/retrievers/arxiv-retriever.mdx index fff4da2a0a2d..8f85886c38aa 100644 --- a/docs/core_docs/docs/integrations/retrievers/arxiv-retriever.mdx +++ b/docs/core_docs/docs/integrations/retrievers/arxiv-retriever.mdx @@ -34,7 +34,7 @@ npm install pdf-parse fast-xml-parser ```typescript const retriever = new ArxivRetriever({ - returnFullDocuments: false, // Set to true to fetch full documents (PDFs) + getFullDocuments: false, // Set to true to fetch full documents (PDFs) maxSearchResults: 5, // Maximum number of results to retrieve }); ``` diff --git a/examples/src/retrievers/arxiv.ts b/examples/src/retrievers/arxiv.ts index fe4a4346371c..3e74502e7d49 100644 --- a/examples/src/retrievers/arxiv.ts +++ b/examples/src/retrievers/arxiv.ts @@ -7,7 +7,7 @@ export const run = async () => { const queryId = "1605.08386 2103.03404"; const retrieverById = new ArxivRetriever({ - returnFullDocuments: true, + getFullDocuments: true, maxSearchResults: 5, }); const documentsById = await retrieverById.invoke(queryId); @@ -42,7 +42,7 @@ export const run = async () => { const queryNat = "What is the ImageBind model?"; const retrieverByNat = new ArxivRetriever({ - returnFullDocuments: false, + getFullDocuments: false, maxSearchResults: 2, }); const documentsByQuery = await retrieverByNat.invoke(queryNat); diff --git a/libs/langchain-community/src/retrievers/arxiv.ts b/libs/langchain-community/src/retrievers/arxiv.ts index 2eb0ab6c5675..8009ce9f8320 100644 --- a/libs/langchain-community/src/retrievers/arxiv.ts +++ b/libs/langchain-community/src/retrievers/arxiv.ts @@ -7,7 +7,7 @@ import { } from "../utils/arxiv.js"; export type ArxivRetrieverOptions = { - returnFullDocuments?: boolean; + getFullDocuments?: boolean; maxSearchResults?: number; } & BaseRetrieverInput; @@ -22,14 +22,13 @@ export class ArxivRetriever extends BaseRetriever { lc_namespace = ["langchain", "retrievers", "arxiv_retriever"]; - returnFullDocuments = false; + getFullDocuments = false; maxSearchResults = 10; constructor(options: ArxivRetrieverOptions = {}) { super(options); - this.returnFullDocuments = - options.returnFullDocuments ?? this.returnFullDocuments; + this.getFullDocuments = options.getFullDocuments ?? this.getFullDocuments; this.maxSearchResults = options.maxSearchResults ?? this.maxSearchResults; } @@ -37,7 +36,7 @@ export class ArxivRetriever extends BaseRetriever { try { const results = await searchArxiv(query, this.maxSearchResults); - if (this.returnFullDocuments) { + if (this.getFullDocuments) { // Fetch and parse PDFs to get full documents return await loadDocsFromResults(results); } else { diff --git a/libs/langchain-community/src/retrievers/tests/arxiv.int.test.ts b/libs/langchain-community/src/retrievers/tests/arxiv.int.test.ts index 2d8467fe1f57..bb05f11504e5 100644 --- a/libs/langchain-community/src/retrievers/tests/arxiv.int.test.ts +++ b/libs/langchain-community/src/retrievers/tests/arxiv.int.test.ts @@ -4,7 +4,7 @@ import { ArxivRetriever } from "../arxiv.js"; test("ArxivRetriever fetching document summaries test", async () => { // Sample integration test for ArxivRetriever using the "machine learning" query const retriever = new ArxivRetriever({ - returnFullDocuments: false, + getFullDocuments: false, maxSearchResults: 5, }); const query = "machine learning"; @@ -43,7 +43,7 @@ test("ArxivRetriever fetching document summaries test", async () => { test("ArxivRetriever fetching document summaries with invalid query test", async () => { // Sample test for ArxivRetriever using an invalid query const retriever = new ArxivRetriever({ - returnFullDocuments: false, + getFullDocuments: false, maxSearchResults: 5, }); const query = "fjalsdkjfw"; @@ -56,7 +56,7 @@ test("ArxivRetriever fetching document summaries with invalid query test", async test("ArxivRetriever fetching document summaries with empty query test", async () => { // Sample test for ArxivRetriever using an empty query const retriever = new ArxivRetriever({ - returnFullDocuments: false, + getFullDocuments: false, maxSearchResults: 5, }); const query = ""; @@ -70,7 +70,7 @@ test("ArxivRetriever fetching document summaries with invalid maxSearchResults t // Sample test for ArxivRetriever using an invalid maxSearchResults try { const retriever = new ArxivRetriever({ - returnFullDocuments: true, + getFullDocuments: true, maxSearchResults: -1, }); const query = "machine learning"; @@ -87,7 +87,7 @@ test("ArxivRetriever fetching document summaries with zero maxSearchResults test // Sample test for ArxivRetriever using an zero maxSearchResults try { const retriever = new ArxivRetriever({ - returnFullDocuments: true, + getFullDocuments: true, maxSearchResults: 0, }); const query = "machine learning"; @@ -103,7 +103,7 @@ test("ArxivRetriever fetching document summaries with zero maxSearchResults test test("ArxivRetriever fetching full documents test", async () => { // Sample test for fetching full documents with ArxivRetriever const retriever = new ArxivRetriever({ - returnFullDocuments: true, + getFullDocuments: true, maxSearchResults: 5, }); const query = "machine learning"; @@ -145,7 +145,7 @@ test("ArxivRetriever fetching full documents test", async () => { test("ArxivRetriever fetching full documents with invalid query test", async () => { // Sample test for fetching full documents with ArxivRetriever using an invalid query const retriever = new ArxivRetriever({ - returnFullDocuments: true, + getFullDocuments: true, maxSearchResults: 5, }); const query = "fjalsdkjfw"; @@ -158,7 +158,7 @@ test("ArxivRetriever fetching full documents with invalid query test", async () test("ArxivRetriever fetching full documents with empty query test", async () => { // Sample test for fetching full documents with ArxivRetriever using an empty query const retriever = new ArxivRetriever({ - returnFullDocuments: true, + getFullDocuments: true, maxSearchResults: 5, }); const query = ""; @@ -172,7 +172,7 @@ test("ArxivRetriever fetching full documents with invalid maxSearchResults test" // Sample test for fetching full documents with ArxivRetriever using an invalid maxSearchResults try { const retriever = new ArxivRetriever({ - returnFullDocuments: true, + getFullDocuments: true, maxSearchResults: -1, }); const query = "machine learning"; @@ -189,7 +189,7 @@ test("ArxivRetriever fetching full documents with zero maxSearchResults", async // Sample test for fetching full documents with ArxivRetriever using an zero maxSearchResults try { const retriever = new ArxivRetriever({ - returnFullDocuments: true, + getFullDocuments: true, maxSearchResults: 0, }); const query = "machine learning"; @@ -206,7 +206,7 @@ test("ArxivRetriever search articles by id test", async () => { // Sample test for fetching articles by arXiv IDs const fetchIds = "2103.03404 2103.03405"; const retriever = new ArxivRetriever({ - returnFullDocuments: false, + getFullDocuments: false, maxSearchResults: 5, }); const results = await retriever.invoke(fetchIds); @@ -244,7 +244,7 @@ test("ArxivRetriever search articles by id with invalid id test", async () => { // Sample test for fetching articles by arXiv IDs with an invalid ID const fetchIds = "2103.03404 2103.03405 1234.56789"; const retriever = new ArxivRetriever({ - returnFullDocuments: false, + getFullDocuments: false, maxSearchResults: 5, }); const results = await retriever.invoke(fetchIds); @@ -257,7 +257,7 @@ test("ArxivRetriever search articles by id with empty id test", async () => { // Sample test for fetching articles by arXiv IDs with an empty ID const fetchIds = ""; const retriever = new ArxivRetriever({ - returnFullDocuments: false, + getFullDocuments: false, maxSearchResults: 5, }); const results = await retriever.invoke(fetchIds); @@ -271,7 +271,7 @@ test("ArxivRetriever search articles by id with invalid maxSearchResults test", try { const fetchIds = "2103.03404 2103.03405"; const retriever = new ArxivRetriever({ - returnFullDocuments: false, + getFullDocuments: false, maxSearchResults: -1, }); const results = await retriever.invoke(fetchIds); @@ -288,7 +288,7 @@ test("ArxivRetriever search articles by id with invalid id and maxSearchResults try { const fetchIds = "2103.03404 2103.03405 1234.56789"; const retriever = new ArxivRetriever({ - returnFullDocuments: false, + getFullDocuments: false, maxSearchResults: -1, }); const results = await retriever.invoke(fetchIds); @@ -305,7 +305,7 @@ test("ArxivRetriever search articles by id with invalid id and zero maxSearchRes try { const fetchIds = "2103.03404 2103.03405 1234.56789"; const retriever = new ArxivRetriever({ - returnFullDocuments: false, + getFullDocuments: false, maxSearchResults: 0, }); const results = await retriever.invoke(fetchIds);