PraisonAI icon indicating copy to clipboard operation
PraisonAI copied to clipboard

AutoGenerator: OpenAI rejects the response_format schema (400 Invalid schema)

Open MervinPraison opened this issue 2 weeks ago • 1 comments

What happens

AutoGenerator (agents file generation, e.g. praisonai --auto "...") and the workflow generator get an OpenAI 400 BadRequestError: Invalid schema for response_format with current OpenAI models.

Why

OpenAI strict structured outputs need every object to set additionalProperties: false. The response models in src/praisonai/praisonai/auto.py use open maps that cannot be expressed that way:

  • TeamStructure.roles: Dict[str, RoleDetails] and RoleDetails.tasks: Dict[str, TaskDetails] (~L1089-1094)
  • WorkflowStructure.agents: Dict[str, WorkflowAgentDetails] and route: Dict[str, List[str]] (~L1645-1664)

Where it shows

The real-key suite (openai-live job) marks TestAutoGeneratorIntegration as xfail(strict=True) until this is fixed (PR #6657).

Fix

Change the maps to lists of named items (for example roles: List[RoleDetails] with a name field), then convert back to the dict shape the YAML writer expects. Keep the generated YAML unchanged.

🤖 Generated with Claude Code

MervinPraison avatar Nov 18 '26 15:11 MervinPraison

I checked the current auto.py and would like to help with a focused fix for the structured-output schemas while preserving the generated YAML shape. Before starting: src/praisonai-agents/AGENTS.md §9.5 requires a real agentic/LLM test for changes. I can run deterministic schema validation and generator-to-YAML regressions locally, but this environment has neither a live OpenAI key nor a running local model. For this bug, would you accept those offline checks plus your existing openai-live CI as the real-provider verification, or should a contributor with live access take it? No implementation or PR has been submitted by me. AI assistance used for source investigation.

austinchennn avatar Nov 18 '26 16:11 austinchennn