Skip to content

Commit

Permalink
add missing change
Browse files Browse the repository at this point in the history
  • Loading branch information
leehuwuj committed Dec 3, 2024
1 parent 621197c commit a39669c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions templates/components/vectordbs/python/llamacloud/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ def add_file_to_pipeline(
) -> str:
client = get_client()
file = client.files.upload_file(project_id=project_id, upload_file=upload_file)
file_id = file.id
files = [
{
"file_id": file.id,
"custom_metadata": {"file_id": file.id, **(custom_metadata or {})},
"file_id": file_id,
"custom_metadata": {"file_id": file_id, **(custom_metadata or {})},
}
]
files = client.pipelines.add_files_to_pipeline(pipeline_id, request=files)
Expand All @@ -79,12 +80,12 @@ def add_file_to_pipeline(
max_attempts = 20
attempt = 0
while attempt < max_attempts:
result = client.pipelines.get_pipeline_file_status(pipeline_id, file.id)
result = client.pipelines.get_pipeline_file_status(file_id, pipeline_id)
if result.status == ManagedIngestionStatus.ERROR:
raise Exception(f"File processing failed: {str(result)}")
if result.status == ManagedIngestionStatus.SUCCESS:
# File is ingested - return the file id
return file.id
return file_id
attempt += 1
time.sleep(0.1) # Sleep for 100ms
raise Exception(
Expand Down

0 comments on commit a39669c

Please sign in to comment.