[PR #363] [MERGED] CLI Testing Tool for Parsing Results to Standard Output #715

Closed
opened 2026-02-16 00:18:53 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/run-llama/llama_cloud_services/pull/363
Author: @adreichert
Created: 8/23/2024
Status: Merged
Merged: 10/16/2024
Merged by: @logan-markewich

Base: mainHead: adreichert/cli-tool


📝 Commits (10+)

📊 Changes

6 files changed (+1134 additions, -824 deletions)

View changed files

📝 README.md (+16 -1)
📝 examples/test_tesla_impact_report/test_gpt4o.ipynb (+1 -1)
llama_parse/cli/__init__.py (+0 -0)
llama_parse/cli/main.py (+92 -0)
📝 poetry.lock (+1020 -821)
📝 pyproject.toml (+5 -1)

📄 Description

Summary

This PR adds a simple CLI tool that wraps the LlamaParse constructor.

It is intended to make testing easier. It's useful for quickly parsing files to see the results, visually comparing different models, or quickly inspecting JSON output to see the different fields. Hopefully, it will also help people get started with the tool more quickly. It is not intended to be complete. I've included the options I vary most of the time.

  • The output JSON is typically passed to jq -r
  • I've been using is for the past several months.

I think others would benefit. I have a more complicated version that will fetch past jobs' results or status using job ids. I'll add more functionality to this file if this PR is approved.

Example Usage

python -m llama_parse.tool parse foo.pdf

Testing

Help Message

python -m llama_parse.tool parse --help

Usage: python -m llama_parse.tool parse [OPTIONS] FILE

  Parse the given file and output the result to the STDOUT

  All supported arguments match those of the LlamaParse constructor. Please
  refer to the official documentation for more information.

Options:
  --api-key <api-key>             Defaults to $LLAMA_CLOUD_API_KEY
  --vendor-multimodal-model-name <model>
  --vendor-multimodal-api-key <vendor-api-key>
  --invalidate-cache
  --result-type <result-type>
  --help                          Show this message and exit.

Example Script

Everything parsed

python -m llama_parse.tool parse \
    $FILE \
    --invalidate-cache > ~/Desktop/a.md

python -m llama_parse.tool parse \
    $FILE \
    --result-type='text' \
    --invalidate-cache > ~/Desktop/a.txt

python -m llama_parse.tool parse \
    $FILE \
    --result-type='json' \
    --invalidate-cache > ~/Desktop/a.json

python -m llama_parse.tool parse \
    $FILE \
    --vendor-multimodal-model-name='openai-gpt4o' \
    --vendor-multimodal-api-key=$VENDOR_KEY \
    --invalidate-cache > ~/Desktop/b.md


python -m llama_parse.tool parse \
    $FILE \
    --result-type='json' \
    --api-key=$LLAMA_CLOUD_API_KEY \
    --vendor-multimodal-model-name='openai-gpt4o' \
    --vendor-multimodal-api-key=$VENDOR_KEY \
    --invalidate-cache > ~/Desktop/b.json

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/run-llama/llama_cloud_services/pull/363 **Author:** [@adreichert](https://github.com/adreichert) **Created:** 8/23/2024 **Status:** ✅ Merged **Merged:** 10/16/2024 **Merged by:** [@logan-markewich](https://github.com/logan-markewich) **Base:** `main` ← **Head:** `adreichert/cli-tool` --- ### 📝 Commits (10+) - [`8c8cf0b`](https://github.com/run-llama/llama_cloud_services/commit/8c8cf0b14f3305a2bca9652e02d46a17a92a60ab) CLI Tool - [`bb25813`](https://github.com/run-llama/llama_cloud_services/commit/bb25813dcee6a5b0ec599d42c8587c832ade6aba) Fix linting and formatting issue - [`112fb03`](https://github.com/run-llama/llama_cloud_services/commit/112fb0313a90811241d49bff46ced4f9ceec7e36) CLI Tool - [`5be610c`](https://github.com/run-llama/llama_cloud_services/commit/5be610cf3f74f2ded8a09646a15be4a9e0cc0396) Fix linting and formatting issue - [`5f5d1f5`](https://github.com/run-llama/llama_cloud_services/commit/5f5d1f5cdd91a0c14ea6e19c436cba01a3969f1b) Add CLI Tool + Update Readme - [`8a96f3b`](https://github.com/run-llama/llama_cloud_services/commit/8a96f3bcfee4f9d7881c0711efaeb4a971d4fb4f) Merge branch 'adreichert/cli-tool' of https://github.com/adreichert/llama_parse into adreichert/cli-tool - [`f481b4f`](https://github.com/run-llama/llama_cloud_services/commit/f481b4f61d1b03290ddc94dfb1e6408c013abb2f) Add Missing line - [`4f653d5`](https://github.com/run-llama/llama_cloud_services/commit/4f653d54aa0858c72f5c3535a0fe37c83f92b3eb) Merge branch 'main' into adreichert/cli-tool - [`e551d2b`](https://github.com/run-llama/llama_cloud_services/commit/e551d2b0140ea0192ef9751b81407adf371b890e) make CLI complete - [`cfcde21`](https://github.com/run-llama/llama_cloud_services/commit/cfcde21de6009cb845af792e01d026b5d7c508d3) lock ### 📊 Changes **6 files changed** (+1134 additions, -824 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+16 -1) 📝 `examples/test_tesla_impact_report/test_gpt4o.ipynb` (+1 -1) ➕ `llama_parse/cli/__init__.py` (+0 -0) ➕ `llama_parse/cli/main.py` (+92 -0) 📝 `poetry.lock` (+1020 -821) 📝 `pyproject.toml` (+5 -1) </details> ### 📄 Description # Summary This PR adds a simple CLI tool that wraps the `LlamaParse` constructor. It is intended to make testing easier. It's useful for quickly parsing files to see the results, visually comparing different models, or quickly inspecting JSON output to see the different fields. Hopefully, it will also help people get started with the tool more quickly. It is not intended to be complete. I've included the options I vary most of the time. * The output JSON is typically passed to `jq -r` * I've been using is for the past several months. I think others would benefit. I have a more complicated version that will fetch past jobs' results or status using job ids. I'll add more functionality to this file if this PR is approved. # Example Usage ``` python -m llama_parse.tool parse foo.pdf ``` # Testing ## Help Message ``` python -m llama_parse.tool parse --help Usage: python -m llama_parse.tool parse [OPTIONS] FILE Parse the given file and output the result to the STDOUT All supported arguments match those of the LlamaParse constructor. Please refer to the official documentation for more information. Options: --api-key <api-key> Defaults to $LLAMA_CLOUD_API_KEY --vendor-multimodal-model-name <model> --vendor-multimodal-api-key <vendor-api-key> --invalidate-cache --result-type <result-type> --help Show this message and exit. ``` ## Example Script Everything parsed ``` python -m llama_parse.tool parse \ $FILE \ --invalidate-cache > ~/Desktop/a.md python -m llama_parse.tool parse \ $FILE \ --result-type='text' \ --invalidate-cache > ~/Desktop/a.txt python -m llama_parse.tool parse \ $FILE \ --result-type='json' \ --invalidate-cache > ~/Desktop/a.json python -m llama_parse.tool parse \ $FILE \ --vendor-multimodal-model-name='openai-gpt4o' \ --vendor-multimodal-api-key=$VENDOR_KEY \ --invalidate-cache > ~/Desktop/b.md python -m llama_parse.tool parse \ $FILE \ --result-type='json' \ --api-key=$LLAMA_CLOUD_API_KEY \ --vendor-multimodal-model-name='openai-gpt4o' \ --vendor-multimodal-api-key=$VENDOR_KEY \ --invalidate-cache > ~/Desktop/b.json ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 00:18:53 -05:00
yindo closed this issue 2026-02-16 00:18:53 -05:00
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#715