Skip to content

accept map on generate object#301

Merged
mikehostetler merged 1 commit intoagentjido:mainfrom
DanielAlegriaLino:fix/generate-object-spec-accept-map
Dec 29, 2025
Merged

accept map on generate object#301
mikehostetler merged 1 commit intoagentjido:mainfrom
DanielAlegriaLino:fix/generate-object-spec-accept-map

Conversation

@DanielAlegriaLino
Copy link
Contributor

@DanielAlegriaLino DanielAlegriaLino commented Dec 25, 2025

Description

Fix incorrect @spec for generate_object/4 and generate_object!/4 in ReqLLM.Generation. The spec was missing map() as a valid type for the object_schema parameter, even though the implementation fully supports raw JSON Schema maps.

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update

Breaking Changes

N/A - This is a non-breaking fix that corrects the typespec to match existing behavior.

Testing

  • Tests pass (mix test)
  • Quality checks pass (mix quality)

Checklist

  • My code follows the project's style guidelines
  • I have updated the documentation accordingly
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass
  • My commits follow conventional commit format
  • I have NOT edited CHANGELOG.md (it is auto-generated by git_ops)

Related Issues

Closes #


Details:

The @spec specified keyword() | Zoi.Type.t() but Schema.compile/1 accepts keyword() | map() | struct(), and the documentation explicitly shows passing raw JSON Schema maps:

array_schema = %{"type" => "array", "items" => person_schema}
ReqLLM.generate_object("openai:gpt-4o", "Generate 3 heroes", array_schema)

@mikehostetler mikehostetler merged commit 064f7ba into agentjido:main Dec 29, 2025
6 checks passed
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.

2 participants