mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-07-21 06:45:25 -04:00
feat(cloud): support pass project and org id to llama parse reader (#1594)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@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}`);
|
||||
|
||||
Reference in New Issue
Block a user