Skip to content

cfreyre/llm-ollama-llamaindex-invoice-cpu

 
 

Repository files navigation

Invoice data processing LLM RAG on CPU with Ollama, LlamaIndex and Weaviate

Enhancing RAG: LlamaIndex and Ollama for On-Premise Data Extraction


Quickstart

RAG runs offline on local CPU

  1. Install Weaviate local DB with Docker:
docker compose up -d
  1. Install the requirements:
pip install -r requirements.txt
  1. Install Ollama and pull LLM model specified in config.yml

  2. Copy text PDF files to the data folder

  3. Run the script, to convert text to vector embeddings and save in Weaviate:

python ingest.py
  1. Run the script, to process data with LLM RAG and return the answer:
python main.py "retrieve invoice_number, invoice_date, client_name, client_address, client_tax_id, seller_name,
seller_address, seller_tax_id, iban, names_of_invoice_items, gross_worth_of_invoice_items and total_gross_worth"

Answer:

{
    "invoice_number": 61356291,
    "invoice_date": "09/06/2012",
    "client_name": "Rodriguez-Stevens",
    "client_address": "2280 Angela Plain, Hortonshire, MS 93248",
    "client_tax_id": "939-98-8477",
    "seller_name": "Chapman, Kim and Green",
    "seller_address": "64731 James Branch, Smithmouth, NC 26872",
    "seller_tax_id": "949-84-9105",
    "iban": "GB50ACIE59715038217063",
    "names_of_invoice_items": [
        "Wine Glasses Goblets Pair Clear Glass",
        "With Hooks Stemware Storage Multiple Uses Iron Wine Rack Hanging Glass",
        "Replacement Corkscrew Parts Spiral Worm Wine Opener Bottle Houdini",
        "HOME ESSENTIALS GRADIENT STEMLESS WINE GLASSES SET OF 4 20 FL OZ (591 ml) NEW"
    ],
    "gross_worth_of_invoice_items": [
        66.0,
        123.55,
        8.25,
        14.29
    ],
    "total_gross_worth": "$212,09"
}

About

Data extraction with LLM on CPU

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%