diff --git a/.changeset/sharp-walls-marry.md b/.changeset/sharp-walls-marry.md new file mode 100644 index 0000000000000000000000000000000000000000..4244dfed0ff130d1ad42cd57bab7c5d46f822de2 --- /dev/null +++ b/.changeset/sharp-walls-marry.md @@ -0,0 +1,5 @@ +--- +"@llamaindex/cloud": patch +--- + +feat: support pass project and org id to llama parse reader diff --git a/packages/cloud/src/reader.ts b/packages/cloud/src/reader.ts index 3dea35c939d03c04595ad2cc93929ff2a10bbcc4..d8197e7864b7de652c7f5ac5d891e7b15fc557fe 100644 --- a/packages/cloud/src/reader.ts +++ b/packages/cloud/src/reader.ts @@ -31,6 +31,8 @@ var process: any; * See https://github.com/run-llama/llama_parse */ export class LlamaParseReader extends FileReader { + project_id?: string | undefined; + organization_id?: string | undefined; // The API key for the LlamaParse API. Can be set as an environment variable: LLAMA_CLOUD_API_KEY apiKey: string; // The base URL of the Llama Cloud Platform. @@ -259,6 +261,10 @@ export class LlamaParseReader extends FileReader { const response = await uploadFileApiV1ParsingUploadPost({ client: this.#client, throwOnError: true, + query: { + project_id: this.project_id ?? null, + organization_id: this.organization_id ?? null, + }, signal: AbortSignal.timeout(this.maxTimeout * 1000), body, }); @@ -284,6 +290,10 @@ export class LlamaParseReader extends FileReader { path: { job_id: jobId, }, + query: { + project_id: this.project_id ?? null, + organization_id: this.organization_id ?? null, + }, signal, }); const { data } = result; @@ -300,6 +310,10 @@ export class LlamaParseReader extends FileReader { path: { job_id: jobId, }, + query: { + project_id: this.project_id ?? null, + organization_id: this.organization_id ?? null, + }, signal, }); break; @@ -311,6 +325,10 @@ export class LlamaParseReader extends FileReader { path: { job_id: jobId, }, + query: { + project_id: this.project_id ?? null, + organization_id: this.organization_id ?? null, + }, signal, }); break; @@ -322,6 +340,10 @@ export class LlamaParseReader extends FileReader { path: { job_id: jobId, }, + query: { + project_id: this.project_id ?? null, + organization_id: this.organization_id ?? null, + }, signal, }); break; @@ -511,6 +533,10 @@ export class LlamaParseReader extends FileReader { job_id: jobId, name: imageName, }, + query: { + project_id: this.project_id ?? null, + organization_id: this.organization_id ?? null, + }, }); if (response.error) { throw new Error(`Failed to download image: ${response.error.detail}`);