Skip to content

Add structured output schema API#340

Open
ProtonsAndElectrons wants to merge 1 commit into
droidrun:mainfrom
ProtonsAndElectrons:structured-output-schema-125
Open

Add structured output schema API#340
ProtonsAndElectrons wants to merge 1 commit into
droidrun:mainfrom
ProtonsAndElectrons:structured-output-schema-125

Conversation

@ProtonsAndElectrons
Copy link
Copy Markdown

Summary

  • Add MobileAgent.set_output_schema(...) so callers can attach a Pydantic schema after constructing an agent.
  • Validate JSON or fenced JSON final answers locally before falling back to the existing LLM structured extraction path.
  • Document the post-initialization schema flow and add regression coverage for no-schema behavior.

Closes #125

Validation

  • .venv\Scripts\python.exe tests/test_structured_output.py (8 tests)
  • .venv\Scripts\python.exe -m ruff check mobilerun/agent/oneflows/structured_output_agent.py mobilerun/agent/droid/droid_agent.py tests/test_structured_output.py
  • cmd.exe /c "set PYTHONUTF8=1&& set PYTHONIOENCODING=utf-8&& .venv\Scripts\python.exe -m unittest discover -s tests" (68 tests)

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.

Feature Request: Structured Output via Pydantic Models

1 participant