GitHub - 0xthierry/llama-parse-cli: A non-official CLI for Llama Index Parser
Extracto
A non-official CLI for Llama Index Parser. Contribute to 0xthierry/llama-parse-cli development by creating an account on GitHub.
Contenido
Llama Parse CLI
A non-official command-line interface (CLI) for parsing documents using the LlamaIndex Parser.
Installation
To install the llama-parse-cli, you need to have Node.js and npm installed on your system. Then, you can install it globally using:
npm install -g llama-parse-cli
Usage
The CLI provides two main commands: auth and parse.
Authentication
Before using the parse functionality, you need to authenticate with your API key:
This command will prompt you to enter your API key, which should start with "llx-". The key will be securely stored in ~/.llama-parse/config.json.
Parsing Documents
To parse a document, use the parse command:
llama-parse parse <file> [options]
Options:
-f, --format <format>: Output format (json, markdown, text). Default: markdown-o, --output <output>: The output file-ol, --ocr-language <ocr-language>: The language of the document-pi, --parsing-instructions <parsing-instructions>: The parsing instructions-ps, --page-separator <page-separator>: The page separator-sd, --skip-diagonal-text: Skip diagonal text-ic, --invalidate-cache: Invalidate cache-dc, --do-not-cache: Do not cache-dnc, --do-not-unroll-columns: Do not unroll columns-fm, --fast-mode: Fast mode-gpt4o, --gpt-4o: Use GPT-4o-tp, --target-pages <target-pages>: The target pages (comma-separated list, starting from 0)-v, --verbose: Verbose mode
Examples
- Parse a PDF file and output in markdown format:
 
llama-parse parse example/sample-pdf.pdf
- Parse a document and save the output to a file:
 
llama-parse parse example/sample-pdf.pdf -o output.md
- Parse specific pages of a document:
 
llama-parse parse example/sample-pdf.pdf -tp 0
- Parse a document in verbose mode:
 
llama-parse parse example/sample-pdf.pdf -v
Development
The project is built using TypeScript and uses the following key dependencies:
- Commander.js for CLI argument parsing
 - Zod for input validation
 - Inquirer for interactive prompts
 - Ora for spinner animations
 - Chalk for colorful console output
 
To set up the development environment:
- Clone the repository
 - Run 
pnpm installto install dependencies - Use 
pnpm devto run the CLI in development mode - Use 
pnpm buildto build the project - Use 
pnpm link .to link the CLI globally 
The main entry point is in src/index.ts:
#!/usr/bin/env node import { version } from "../package.json"; import { program } from "commander"; import { createAuthCommand, createParseCommand } from "./commands"; program .name("llama-parse") .addCommand(createAuthCommand()) .addCommand(createParseCommand()) .description("A CLI for parsing documents with llama parse") .version(`${version}`); program.parse(process.argv);
The CLI commands are defined in separate files under the src/commands directory:
export { createAuthCommand } from "./auth"; export { createParseCommand } from "./parse";
Contributing
Contributions to the llama-parse-cli are welcome. Please ensure that your code adheres to the existing style and includes appropriate tests.
Fuente: GitHub

