Files
Clelia (Astra) Bertelli e6a27d17fb wip: implementing Extract in TS (#839)
* wip: implementing Extract in TS

* feat: main implementation (untested)

* ci: lint

* feat: add stateless api support and retries mechanisms

* refactor: working LlamaExtract + tests

* refactor: working LlamaExtract + tests

* correct stateless extraction test

* correct stateless extraction test

* chore: intervals are now in seconds, extractStateless -> extract, support for multiple file types

* fix: infer file type

* fix: infer file type

* fix: change agent name

* docs: adding example

* docs: add link to example in extract.md
2025-08-07 12:18:58 +02:00
..

LlamaExtract Demo

A TypeScript demo application showcasing the power of LlamaExract - a structured data extraction agentic service from LlamaCloud. This demo allows you to extract structured information from scientific papers and get them into a nice markdown format.

Table of Contents

Features

  • 📄 Structured Data Extraction: Extract data from your files effortlessly, and structure them the way you want!
  • 🤖 Markdown Rendering: Generate markdown directly from your extracted data
  • 🎨 Beautiful CLI: Styled console interface with colors and ASCII art
  • Fast Development: Hot reload support with watch mode
  • 🛠️ TypeScript: Full TypeScript support with strict type checking

Prerequisites

  • Node.js (version 18 or higher)
  • pnpm package manager
  • LlamaCloud API key

Installation

  1. Clone the repository:
git clone https://github.com/run-llama/llama_cloud_services
cd lama_cloud_services/examples-ts/extract/
  1. Install dependencies:
npm install
  1. Set up your environment variables:
# Add your API key to your environment
export LLAMA_CLOUD_API_KEY="your-llamacloud-api-key"

Usage

Start the Demo

npm run start

The application will display a welcome screen and prompt you to enter the path to a document you'd like to process.

Development Mode

For development with hot reload:

npm run dev

Build the Project

npm run build

Code Quality

Format code:

npm run format

Lint code:

npm run lint

How It Works

  1. Document Input: Enter the path to your document when prompted
  2. Parsing: LlamaExtract, based on the schema you can find here, processes the document and extracts structured data
  3. Markdown Rendering: The extracted content is rendered into beautiful markdown
  4. Results: View the results directly in your terminal

Troubleshooting

Common Issues

  1. Module Resolution Errors: Ensure you're using Node.js 18+ and have all dependencies installed
  2. API Key Issues: Verify your LlamaCloud API key is correctly set
  3. File Path Errors: Use absolute paths or ensure relative paths are correct from the project root

License

MIT License - see the LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run npm run format and npm run lint
  5. Submit a pull request