LLMWhisperer JavaScript Client

2.5.0 · active · verified Tue Apr 21

The `llmwhisperer-client` is a JavaScript client library designed to facilitate interaction with the LLMWhisper API. Its primary function is to preprocess complex documents, such as PDFs and images, to extract raw text in a format optimized for consumption by Large Language Models. The library, currently at stable version 2.5.0, appears to follow an active release cadence with frequent minor updates. Key differentiators include a "Layout Preserving Mode" for maintaining document structure, automatic switching between native text and OCR modes, and intelligent handling of interactive elements like checkboxes in PDF forms. This enables robust and accurate structured data extraction from various document types, including invoices, purchase orders, and bank statements, by presenting data to LLMs in their most understandable form.

Common errors

Warnings

Install

Imports

Quickstart

Initializes the LLMWhisperer client with optional configuration, demonstrating how to provide an API key and base URL, falling back to environment variables.

import { LLMWhispererClientV2 } from 'llmwhisperer-client';

// Configure the client. API key can be set via LLMWHISPERER_API_KEY env variable.
const options = {
  apiKey: process.env.LLMWHISPERER_API_KEY ?? 'YOUR_SECRET_API_KEY',
  baseUrl: process.env.LLMWHISPERER_BASE_URL ?? 'https://api.llmwhisperer.com/v2',
  apiTimeout: 5000, // Timeout in milliseconds
  loggingLevel: 'info' // 'error', 'warn', 'info', 'debug'
};

// Create a new client instance
const client = new LLMWhispererClientV2(options);

async function runWhisperExample() {
  try {
    // Replace with actual whisper options like document content, type, etc.
    // This is a placeholder as the README does not provide a full `whisper` example.
    // Example: const whisperResult = await client.whisper({ content: '...', type: 'pdf' });
    console.log('Client initialized and ready to make API calls.');
    console.log('You can now use methods like client.whisper(), client.whisperStatus(), etc.');
  } catch (error) {
    console.error('An error occurred:', error.message);
  }
}

runWhisperExample();

view raw JSON →