Skip to content
Snippets Groups Projects
Unverified Commit d6c270ec authored by Alex Yang's avatar Alex Yang Committed by GitHub
Browse files

feat(cloud): support pass project and org id to llama parse reader (#1594)

parent e3a77044
No related branches found
No related tags found
No related merge requests found
---
"@llamaindex/cloud": patch
---
feat: support pass project and org id to llama parse reader
......@@ -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}`);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment