Skip to content

[FEAT]: Add Confidence Score for Each Extracted Field #60

@Cubix33

Description

@Cubix33

📝 Description

Add a confidence score for each field extracted by the LLM.

Instead of returning only the value, the model should return both:

  • The extracted value
  • A confidence score (0 to 1)

Example output:

{
  "employee_name": {
    "value": "John Doe",
    "confidence": 0.92
  }
}

💡 Rationale

Currently, FireForm blindly trusts the LLM output.

Adding a confidence score will:

  • Help detect uncertain extractions
  • Enable human review workflows
  • Improve reliability for real-world use
  • Make debugging easier

This is especially useful for ambiguous or incomplete transcripts.


🛠️ Proposed Solution

  • Update the LLM prompt to request confidence scores.

  • Parse and validate the extended JSON structure.

  • Modify PDF filling logic to use the "value" key.

  • Optionally log low-confidence fields.

  • Logic change in src/

  • Update to requirements.txt

  • New prompt for Mistral/Ollama


✅ Acceptance Criteria

  • Each field returns both value and confidence
  • Confidence score is between 0 and 1
  • PDF filling still works correctly
  • Feature works inside Docker

📌 Additional Context

This enhancement improves reliability and prepares FireForm for future UI or review-based workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    to-thinkMore time to think about, advantages and disadvantages of each

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions