How to send a llama_parse job in python async? #352

Open
opened 2026-02-16 00:17:36 -05:00 by yindo · 10 comments
Owner

Originally created by @AyushParikh on GitHub (Nov 24, 2024).

hi, I want to start a job in python but not wait for the response. How can I achieve this?

    parser = LlamaParse(
        webhook_url=webhook_url
    ).load_data(file_path=path)

Originally created by @AyushParikh on GitHub (Nov 24, 2024). hi, I want to start a job in python but not wait for the response. How can I achieve this? ``` parser = LlamaParse( webhook_url=webhook_url ).load_data(file_path=path) ```
yindo added the enhancement label 2026-02-16 00:17:36 -05:00
Author
Owner

@logan-markewich commented on GitHub (Nov 24, 2024):

await parser.aload_data(...)

@logan-markewich commented on GitHub (Nov 24, 2024): `await parser.aload_data(...)`
Author
Owner

@AyushParikh commented on GitHub (Nov 24, 2024):

await parser.aload_data(...)

When I do this, i get

'await parser.aload_data(...)' was never awaited

@AyushParikh commented on GitHub (Nov 24, 2024): > `await parser.aload_data(...)` When I do this, i get 'await parser.aload_data(...)' was never awaited
Author
Owner

@AyushParikh commented on GitHub (Nov 24, 2024):

i also tried:

async def start_parser(parser, local_file_path: str):
    await parser.aload_data(file_path=local_file_path)
    
start_parser(parser=parser, local_file_path=local_file_path)
@AyushParikh commented on GitHub (Nov 24, 2024): i also tried: ``` async def start_parser(parser, local_file_path: str): await parser.aload_data(file_path=local_file_path) start_parser(parser=parser, local_file_path=local_file_path) ```
Author
Owner

@AyushParikh commented on GitHub (Nov 24, 2024):

@logan-markewich

@AyushParikh commented on GitHub (Nov 24, 2024): @logan-markewich
Author
Owner

@AyushParikh commented on GitHub (Nov 25, 2024):

ok so this work, but issue is that my lambda endpoint returns right away before the job even starts. any suggestions?

@AyushParikh commented on GitHub (Nov 25, 2024): ok so this work, but issue is that my lambda endpoint returns right away before the job even starts. any suggestions?
Author
Owner

@logan-markewich commented on GitHub (Nov 25, 2024):

Sorry, I misunderstood your question. Async is probably not what you want.

You'll probably want to use the raw api. Create a job, return the job ID, use the job ID to check if the status is done and retrieve the result
https://docs.cloud.llamaindex.ai/category/API/parsing

@logan-markewich commented on GitHub (Nov 25, 2024): Sorry, I misunderstood your question. Async is probably not what you want. You'll probably want to use the raw api. Create a job, return the job ID, use the job ID to check if the status is done and retrieve the result https://docs.cloud.llamaindex.ai/category/API/parsing
Author
Owner

@logan-markewich commented on GitHub (Nov 25, 2024):

https://docs.cloud.llamaindex.ai/llamaparse/getting_started/api

@logan-markewich commented on GitHub (Nov 25, 2024): https://docs.cloud.llamaindex.ai/llamaparse/getting_started/api
Author
Owner

@AyushParikh commented on GitHub (Nov 25, 2024):

@logan-markewich i see but in the docs i don't see how i can provide webhook url in the API call?

curl -X 'POST' \
  'https://api.cloud.llamaindex.ai/api/parsing/upload'  \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
  -F 'file=@/path/to/your/file.pdf;type=application/pdf'
@AyushParikh commented on GitHub (Nov 25, 2024): @logan-markewich i see but in the docs i don't see how i can provide webhook url in the API call? ``` curl -X 'POST' \ 'https://api.cloud.llamaindex.ai/api/parsing/upload' \ -H 'accept: application/json' \ -H 'Content-Type: multipart/form-data' \ -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \ -F 'file=@/path/to/your/file.pdf;type=application/pdf' ```
Author
Owner

@AyushParikh commented on GitHub (Nov 25, 2024):

https://docs.cloud.llamaindex.ai/llamaparse/features/webhook @logan-markewich this is webhook docs for llama cloud. the API example doesnt show how to pass webhook url @logan-markewich

@AyushParikh commented on GitHub (Nov 25, 2024): https://docs.cloud.llamaindex.ai/llamaparse/features/webhook @logan-markewich this is webhook docs for llama cloud. the API example doesnt show how to pass webhook url @logan-markewich
Author
Owner

@AyushParikh commented on GitHub (Nov 25, 2024):

ok it works. you have to pass in

        data = {
            'webhook_url': webhook_url
        }

in the payload. maybe docs should be updated

@AyushParikh commented on GitHub (Nov 25, 2024): ok it works. you have to pass in ``` data = { 'webhook_url': webhook_url } ``` in the payload. maybe docs should be updated
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_cloud_services#352