ai-cfia / fertiscan-backend

Fertiscan backend
MIT License
2 stars 0 forks source link

Implement End-to-End Testing for Image-to-Form Processing Pipeline #58

Closed Endlessflow closed 3 months ago

Endlessflow commented 3 months ago

Pull Request: Implement End-to-End Testing for Image-to-Form Processing Pipeline

Description:

This PR introduces a comprehensive end-to-end testing script for our image-to-form processing pipeline. The aim is to ensure the pipeline’s reliability and performance by facilitating seamless testing across various components, including OCR engines and LLM models.

Key Changes:

  1. End-to-End Testing Script (e2e.py):

    • Pipeline Processing: Developed a script to process input images through all combinations of OCR engines and LLM models.
    • Directory Structure: Established a structured directory setup under e2e_tests for input images, and outputs from OCR and LLM processes.
    • Output Management: Implemented checks to skip processing if output files already exist, optimizing the testing process and preventing redundant operations.
    • Environment Management: Improved handling of environment variables and enhanced logging for better configuration validation and error tracking.
    • Error Handling: Added detailed logging and error handling to provide insights during the processing flow.
  2. GPT Class Enhancements (backend/gpt.py):

    • Debug Logging: Added optional debug logging to track the timing and details of AzureOpenAI requests, aiding in performance monitoring.
    • Request Parameter Handling: Refactored the GPT class to improve parameter handling in an attempt to support models with varying feature availability, enhancing compatibility.

Closes issue #45

Endlessflow commented 3 months ago

@snakedye this is a draft mainly because I am not sure if e2e.py should stay in the root and if not where to put it.

Otherwise, everything else is working and ready (except maybe Ollama support that needs to be discussed).

snakedye commented 3 months ago

Don't forget to pass the checks 2 to 5. For the tests post a screenshot of the result of the test suite. Unfortunately the pipeline isn't fixed yet.

Endlessflow commented 3 months ago

Alright, it appears that everything is functioning as expected locally. Proceeding with the merge seems like a reasonable next step.

image