This package provides a Laravel library for interacting with the LlamaCloud Parsing & Transformation API (aka LlamaParse Cloud) to parse PDF, XLS, and other file types into more efficient RAG context for consumption into other systems.
You can install the package via Composer:
composer require jpcaparas/laravel-llamaparse-client
After installing the package, publish the configuration file:
php artisan vendor:publish --provider="JPCaparas\LLamaparse\LLamaparseServiceProvider"
Then, add your LlamaParse API key to your .env
file:
LLAMAPARSE_API_KEY=your-api-key
Here is an example of how to use the package with Laravel Tinker:
- Set a variable to a path of the file:
$filePath = 'path/to/your/file.pdf';
Hint: This PDF full of charts is a good resource to upload.
- Instantiate the service:
$llamaparse = app('llamaparse');
- Upload the file and get the job ID:
$response = $llamaparse->uploadFile($filePath);
$jobId = $response['id'];
- Get the job status:
$jobStatus = $llamaparse->getJob($jobId);
- Get the job markdown result:
$markdownResult = $llamaparse->getJobResult($jobId);
$textResult = $llamaparse->getJobTextResult($jobId);
To run the tests, use the following command:
composer test
For a full API reference, please visit the LlamaCloud Parsing & Transformation API documentation.
MIT