mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-07-21 14:55:36 -04:00
fix: pRetry not working with CommonJS
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@llamaindex/cloud": patch
|
||||
---
|
||||
|
||||
Fix pRetry not working with CommonJS
|
||||
@@ -1,5 +1,13 @@
|
||||
import { LlamaParseReader } from "@llamaindex/cloud";
|
||||
import { VectorStoreIndex } from "llamaindex";
|
||||
import { openai, OpenAIEmbedding } from "@llamaindex/openai";
|
||||
import { Settings, VectorStoreIndex } from "llamaindex";
|
||||
|
||||
Settings.llm = openai({
|
||||
model: "gpt-4.1",
|
||||
});
|
||||
Settings.embedModel = new OpenAIEmbedding({
|
||||
model: "text-embedding-3-small",
|
||||
});
|
||||
|
||||
async function main() {
|
||||
// Load PDF using LlamaParse
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import { type Client, createClient, createConfig } from "@hey-api/client-fetch";
|
||||
import { Document, FileReader } from "@llamaindex/core/schema";
|
||||
import { fs, getEnv, path } from "@llamaindex/env";
|
||||
import pRetry from "p-retry";
|
||||
import {
|
||||
type BodyUploadFileApiParsingUploadPost,
|
||||
type FailPageMode,
|
||||
@@ -391,6 +390,7 @@ export class LlamaParseReader extends FileReader {
|
||||
): Promise<any> {
|
||||
let tries = 0;
|
||||
let currentInterval = this.checkInterval;
|
||||
const { default: pRetry } = await import("p-retry");
|
||||
|
||||
while (true) {
|
||||
await sleep(currentInterval * 1000);
|
||||
|
||||
Reference in New Issue
Block a user