Skip to content

humanitarian_verification response shape parity between OpenAI / Groq / Test #269

Description

@kilodesodiq-arch

Problem Statement. humanitarian_verification.py::_get_deterministic_response builds
the response out-of-band; OpenAI / Groq responses are parsed from raw JSON. The test
provider path serialises its own dict via json.dumps(separators=(",",":")) whereas
OpenAI / Groq responses come from data["choices"][0]["message"]["content"] and can be
mid-edit-token truncated.

Why it matters. Stable output is required by callers of the verification endpoint.

Technical Context.
app/ai-service/services/humanitarian_verification.py.

Expected Outcome. A parse_verification_response(provider_name, raw_content) function
unifies parsing; deterministic stamp on every response (provider, model,
prompt_variant).

Acceptance Criteria.

  • E2E tests against all three providers produce identical-shape responses.
  • A snapshot test pins the JSON schema.

Files or modules likely to be affected.
app/ai-service/services/humanitarian_verification.py,
new app/ai-service/schemas/humanitarian_verification_v2.py.

Difficulty. Medium
Estimated effort. M



Backlog item #61 from `docs/maintainer-issue-backlog.md.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions