feat(paddleocr-vl): add PaddleOCR-VL full pipeline Docker image and API server, plus integration tests and docker helpers
This commit is contained in:
@@ -1,15 +1,23 @@
|
||||
/**
|
||||
* Bank statement extraction test using MiniCPM-V (visual) + PaddleOCR-VL (table recognition)
|
||||
*
|
||||
* This is the combined/dual-VLM approach that uses both models for consensus:
|
||||
* - MiniCPM-V for visual extraction
|
||||
* - PaddleOCR-VL for table recognition
|
||||
*/
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { execSync } from 'child_process';
|
||||
import * as os from 'os';
|
||||
import { ensurePaddleOcrVl, ensureMiniCpm } from './helpers/docker.js';
|
||||
|
||||
// Service URLs
|
||||
const OLLAMA_URL = 'http://localhost:11434';
|
||||
const PADDLEOCR_VL_URL = 'http://localhost:8000';
|
||||
|
||||
// Models
|
||||
const MINICPM_MODEL = 'openbmb/minicpm-v4.5:q8_0';
|
||||
const MINICPM_MODEL = 'minicpm-v:latest';
|
||||
const PADDLEOCR_VL_MODEL = 'paddleocr-vl';
|
||||
|
||||
// Prompt for MiniCPM-V visual extraction
|
||||
@@ -477,11 +485,18 @@ function findTestCases(): Array<{ name: string; pdfPath: string; jsonPath: strin
|
||||
|
||||
// Tests
|
||||
|
||||
tap.test('should connect to Ollama API', async () => {
|
||||
const response = await fetch(`${OLLAMA_URL}/api/tags`);
|
||||
expect(response.ok).toBeTrue();
|
||||
const data = await response.json();
|
||||
expect(data.models).toBeArray();
|
||||
tap.test('setup: ensure Docker containers are running', async () => {
|
||||
console.log('\n[Setup] Checking Docker containers...\n');
|
||||
|
||||
// Ensure PaddleOCR-VL is running (auto-detects GPU/CPU)
|
||||
const paddleOk = await ensurePaddleOcrVl();
|
||||
expect(paddleOk).toBeTrue();
|
||||
|
||||
// Ensure MiniCPM is running
|
||||
const minicpmOk = await ensureMiniCpm();
|
||||
expect(minicpmOk).toBeTrue();
|
||||
|
||||
console.log('\n[Setup] All containers ready!\n');
|
||||
});
|
||||
|
||||
tap.test('should have MiniCPM-V 4.5 model loaded', async () => {
|
||||
@@ -494,8 +509,7 @@ tap.test('should have MiniCPM-V 4.5 model loaded', async () => {
|
||||
tap.test('should check PaddleOCR-VL availability', async () => {
|
||||
const available = await isPaddleOCRVLAvailable();
|
||||
console.log(`PaddleOCR-VL available: ${available}`);
|
||||
// This test passes regardless - PaddleOCR-VL is optional
|
||||
expect(true).toBeTrue();
|
||||
expect(available).toBeTrue();
|
||||
});
|
||||
|
||||
// Dynamic test for each PDF/JSON pair
|
||||
|
||||
Reference in New Issue
Block a user