diff --git a/.changeset/proud-lies-brush.md b/.changeset/proud-lies-brush.md new file mode 100644 index 0000000000000000000000000000000000000000..c3364c42d6a17c2e953acc7a066f6bec11bf8313 --- /dev/null +++ b/.changeset/proud-lies-brush.md @@ -0,0 +1,5 @@ +--- +"llamaindex": patch +--- + +Fix LlamaCloud retrieval with multiple pipelines diff --git a/packages/llamaindex/src/cloud/LlamaCloudRetriever.ts b/packages/llamaindex/src/cloud/LlamaCloudRetriever.ts index 54f18fb863004509d8c20e7b8f065bbf9ce88a2c..d2a6595044764d2e6a0e115225a24e8ddbb97d5a 100644 --- a/packages/llamaindex/src/cloud/LlamaCloudRetriever.ts +++ b/packages/llamaindex/src/cloud/LlamaCloudRetriever.ts @@ -61,7 +61,7 @@ export class LlamaCloudRetriever extends BaseRetriever { await PipelinesService.searchPipelinesApiV1PipelinesGet({ query: { project_id: await getProjectId(this.projectName, this.organizationId), - project_name: this.pipelineName, + pipeline_name: this.pipelineName, }, throwOnError: true, }); @@ -72,25 +72,11 @@ export class LlamaCloudRetriever extends BaseRetriever { ); } - const { data: pipeline } = - await PipelinesService.getPipelineApiV1PipelinesPipelineIdGet({ - path: { - pipeline_id: pipelines[0]!.id, - }, - throwOnError: true, - }); - - if (!pipeline) { - throw new Error( - `No pipeline found with name ${this.pipelineName} in project ${this.projectName}`, - ); - } - const { data: results } = await PipelinesService.runSearchApiV1PipelinesPipelineIdRetrievePost({ throwOnError: true, path: { - pipeline_id: pipeline.id, + pipeline_id: pipelines[0]!.id, }, body: { ...this.retrieveParams, diff --git a/packages/llamaindex/src/cloud/utils.ts b/packages/llamaindex/src/cloud/utils.ts index c5fdcbb3ed89047d52345764c85758e5f5de6d52..bbaadd854c7b834171a1d5f74dfaab4d1483b9ac 100644 --- a/packages/llamaindex/src/cloud/utils.ts +++ b/packages/llamaindex/src/cloud/utils.ts @@ -40,9 +40,9 @@ export async function getProjectId( ): Promise<string> { const { data: projects } = await ProjectsService.listProjectsApiV1ProjectsGet( { - path: { + query: { project_name: projectName, - organization_id: organizationId, + organization_id: organizationId ?? null, }, throwOnError: true, },