Skip to content

Add include_profile_context option to form fills (#770) - #771

Open
vikash7485 wants to merge 1 commit into
fireform-core:developmentfrom
vikash7485:feat/770-profile-context
Open

vikash7485 wants to merge 1 commit into
fireform-core:developmentfrom
vikash7485:feat/770-profile-context

Conversation

@vikash7485

@vikash7485 vikash7485 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Part of #770.

filler.fill() can already add a profile to the model input, but FormService never passed one, so the saved profile never reached the model.

This adds include_profile_context (default false) to POST /api/v1/forms/fill and POST /api/v1/forms/jobs. When it is true, the current profile (the one GET /api/v1/profiles/ returns) is passed to the filler. If no profile is saved, the fill runs without one. For /forms/jobs the profile is read once when the request is submitted, so all jobs in the batch use the same values.

Known problem: this only passes the profile through. With qwen2.5:3b the current profile block often ends up in the wrong fields, for example the contacts table instead of "Prepared by" (details and screenshots on #770). I kept the default off and left the model input change out until we agree on it there.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • Added tests/test_profile_context.py (9 tests): on, off, default, no saved profile, async jobs and the Celery task. 3 of them fail on development without this change.
  • Updated the two apply_async assertions in tests/test_jobs.py for the new argument.
  • pytest tests/: 481 passed. test_desktop_migration_failure_restores_database and test_uploaded_audio_is_decoded_and_transcribed fail on my machine, the same way they do on development.
  • ruff check app/ and alembic check are clean.
  • Ran the API locally with Ollama (qwen2.5:3b): sync fill with the option off and on, and an async job with it on. Off gives the same fields as before. A non-boolean value returns 422.
  • Not tested in Docker yet.

Test Configuration:

  • Python version: 3.13.7
  • Docker/Compose version: not tested
  • OS: Windows 11

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules (the toggle is fireform-frontend#70, not done yet)

Add include_profile_context (default false) to POST /forms/fill and
POST /forms/jobs. When it is true, the current profile is passed to the
filler, which already adds it to the model input. For /forms/jobs the
profile is read once when the request is submitted, so every job in the
batch uses the same values.

Part of fireform-core#770.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant