Skip to content

feat(tools): add native function schema for generate_image#5572

Open
Ninthkitten wants to merge 1 commit into
odysseus-dev:devfrom
Ninthkitten:pr/generate-image-native-schema
Open

feat(tools): add native function schema for generate_image#5572
Ninthkitten wants to merge 1 commit into
odysseus-dev:devfrom
Ninthkitten:pr/generate-image-native-schema

Conversation

@Ninthkitten

@Ninthkitten Ninthkitten commented Jul 16, 2026

Copy link
Copy Markdown

Summary

generate_image was exposed only in the fenced text-block tool dialect. Models driven through the OpenAI-compatible API with native function calling could never see or invoke it, and instead hallucinated malformed text-block calls that went nowhere. This PR adds a native function schema for generate_image (mirroring the existing edit_image schema), registers its required argument, and converts incoming native calls to the internal tool block. Text-dialect behaviour is unchanged.

Target branch

  • This PR targets dev, not main.

Linked Issue

Fixes #5520

Type of Change

  • Bug fix (non-breaking — fixes a confirmed issue)

Checklist

  • I searched open issues and open PRs — this is not a duplicate.
  • This PR targets dev
  • My changes are limited to the scope described above — no unrelated refactors or whitespace changes mixed in.
  • I actually ran the app (docker compose up) and verified the change works end-to-end. Type-checks and unit tests are not enough.

How to Test

  1. Configure an image model (AI Defaults) and make sure the generate_image tool is enabled.
  2. Drive a model through the OpenAI-compatible endpoint (native function calling) and ask it to generate an image.
  3. Without this patch, the model has no generate_image function available and typically emits a malformed fenced text call; nothing is generated.
  4. With this patch, the native call fires, arguments are converted to the internal tool block, and the image is returned in chat.

This fix has been running in a self-hosted deployment since 12 July, verified end-to-end with a local image model.

🤖 Generated with Claude Code

generate_image existed only in the text-block dialect, so API models could never call it and instead hallucinated broken text invocations. Add a native schema plus argument conversion. Fixes odysseus-dev#5520.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added needs work PR description incomplete — please update before review ready for review Description complete — ready for maintainer review and removed needs work PR description incomplete — please update before review labels Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Description complete — ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generate_image has no native function schema — API models can never call it and hallucinate malformed text calls

1 participant