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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@omniyat/adviamodule

v1.0.0

Published

Module ia avancée pour le traitement des données

Readme

invoice-ai

Module npm Node.js (CommonJS) pour :

  • 📄 Lire des factures (PDF ou image) et retourner les données structurées en JSON
  • 🔧 Proposer des tâches d'intervention automobile depuis une description texte
  • 🎙️ Proposer des tâches depuis un fichier audio (transcription + analyse)

Propulsé par Gemini AI (Google).


Installation

npm install invoice-ai

Prérequis


Configuration

export GEMINI_API_KEY=AIzaSy...

Ou passez la clé directement dans les options.


Utilisation (CommonJS)

const { readInvoice, proposerTaches, proposerTachesDepuisAudio } = require('invoice-ai');

API

1. Lecture de facture — readInvoice(input, options?)

const { readInvoice } = require('invoice-ai');

// Depuis un chemin de fichier
const facture = await readInvoice('./facture.pdf');
const facture = await readInvoice('./facture.jpg');

// Depuis un Buffer
const fs = require('fs');
const buffer = fs.readFileSync('./facture.png');
const facture = await readInvoice(buffer, { mimeType: 'image/png' });

Formats supportés : .pdf, .jpg, .jpeg, .png, .webp, .gif

Résultat :

{
  "fournisseur": {
    "nom": "Garage Martin SARL",
    "adresse": "12 rue de la Paix, 75001 Paris",
    "telephone": "01 23 45 67 89",
    "email": "[email protected]",
    "siret": "123 456 789 00012"
  },
  "numero_facture": "FAC-2024-0042",
  "date": "2024-03-15",
  "date_echeance": "2024-04-15",
  "client": { "nom": "Jean Dupont", "adresse": "5 avenue des Champs, Lyon" },
  "items": [
    {
      "description": "Remplacement plaquettes de frein avant",
      "quantite": 1,
      "unite": "forfait",
      "prix_unitaire_ht": 120.00,
      "taux_tva": 20,
      "montant_ht": 120.00,
      "montant_ttc": 144.00
    }
  ],
  "sous_total_ht": 165.00,
  "total_tva": 33.00,
  "cout_total": 198.00,
  "devise": "EUR",
  "mode_paiement": "Virement bancaire",
  "notes": null
}

2. Tâches d'intervention (texte) — proposerTaches(params, options?)

const { proposerTaches } = require('invoice-ai');

const resultat = await proposerTaches({
  vehicule: 'Renault Clio IV 1.5 dCi 90ch - 2016',
  description: "Bruit métallique à l'avant gauche lors du freinage, voiture tire à gauche.",
  kilometrage: '87000',      // optionnel
  historique: 'Plaquettes remplacées à 60 000 km',  // optionnel
});

Résultat :

{
  "vehicule": "Renault Clio IV 1.5 dCi 90ch - 2016",
  "diagnostic_probable": "Usure avancée des plaquettes/disques avant gauche, possible étrier grippé",
  "niveau_urgence": "élevé",
  "taches": [
    {
      "id": 1,
      "categorie": "diagnostic",
      "titre": "Contrôle visuel du freinage avant",
      "description": "Déposer la roue et inspecter plaquettes, disques, étriers et flexibles.",
      "pieces_necessaires": [],
      "duree_estimee_minutes": 30,
      "ordre_execution": 1,
      "obligatoire": true,
      "cout_main_oeuvre_estime": 37.50,
      "notes_technicien": "Vérifier l'épaisseur minimale des disques (min 17mm)"
    }
  ],
  "duree_totale_estimee_minutes": 180,
  "cout_main_oeuvre_total_estime": 225.00,
  "recommandations_supplementaires": ["Vérifier le liquide de frein"],
  "avertissements": ["Ne pas rouler avant réparation du système de freinage"]
}

3. Tâches depuis audio — proposerTachesDepuisAudio(params, options?)

const { proposerTachesDepuisAudio } = require('invoice-ai');

// Depuis un fichier audio
const resultat = await proposerTachesDepuisAudio({
  audio: './description_client.mp3',
  vehicule: 'Peugeot 308 II 1.6 THP 125ch - 2015',
  kilometrage: '120000',
});

// Depuis un Buffer
const fs = require('fs');
const buf = fs.readFileSync('./voix.wav');
const resultat = await proposerTachesDepuisAudio({
  audio: buf,
  mimeType: 'audio/wav',
  vehicule: 'Citroën C3 1.2 PureTech - 2020',
});

Formats audio : .mp3, .wav, .m4a, .ogg, .flac, .webm


4. Classe InvoiceAI (contrôle total)

const InvoiceAI = require('invoice-ai');

const ai = new InvoiceAI({
  apiKey: 'AIzaSy...',       // ou variable GEMINI_API_KEY
  model: 'gemini-2.5-flash-lite',   // optionnel, défaut: gemini-2.5-flash
});

const facture      = await ai.readInvoice('./facture.pdf');
const intervention = await ai.proposerTaches({ vehicule: '...', description: '...' });
const depuisAudio  = await ai.proposerTachesDepuisAudio({ audio: './audio.mp3', vehicule: '...' });

Modèles Gemini recommandés

| Modèle | Usage recommandé | |--------|-----------------| | gemini-2.5-flash | Rapide et économique, usage quotidien (défaut) | | gemini-2.5-flash-lite | Plus précis, documents complexes | | gemini-2.5-flash | Dernière génération flash |


Niveaux d'urgence

| Niveau | Description | |--------|-------------| | faible | Peut attendre la prochaine révision | | moyen | À traiter dans les 2–4 semaines | | élevé | À traiter rapidement (< 1 semaine) | | critique | Véhicule à immobiliser immédiatement |


Gestion des erreurs

try {
  const facture = await readInvoice('./facture.pdf');
} catch (err) {
  console.error(err.message);
  // "Fichier introuvable: ..."
  // "Format non supporté: ..."
  // "Clé API Gemini manquante..."
  // "Impossible de parser la réponse de l'IA: ..."
}

Licence

MIT