npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

llama-parse-cli

v0.0.2

Published

A CLI for parsing files with LlamaIndex Parser

Downloads

37

Readme

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:

llama-parse auth

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

  1. Parse a PDF file and output in markdown format:
llama-parse parse example/sample-pdf.pdf
  1. Parse a document and save the output to a file:
llama-parse parse example/sample-pdf.pdf -o output.md
  1. Parse specific pages of a document:
llama-parse parse example/sample-pdf.pdf -tp 0
  1. 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:

  1. Clone the repository
  2. Run pnpm install to install dependencies
  3. Use pnpm dev to run the CLI in development mode
  4. Use pnpm build to build the project
  5. 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.