Skip to content

Make result formatters injectable in registry references - #42

Open
chr-hertel wants to merge 1 commit into
mainfrom
fix/issue-16-injectable-formatters
Open

chr-hertel wants to merge 1 commit into
mainfrom
fix/issue-16-injectable-formatters

Conversation

@chr-hertel

Copy link
Copy Markdown
Owner

The registry references built their formatters inline ((new ToolResultFormatter())->format(...)), bypassing the seam that already existed as separate classes.

  • Add ToolResultFormatterInterface, PromptResultFormatterInterface, ResourceResultFormatterInterface, implemented by the existing formatters
  • Inject the formatter as an optional constructor dependency on ToolReference, PromptReference, ResourceReference, ResourceTemplateReference, defaulting to the current formatter — all existing construction sites unchanged
  • Test proving an injected custom formatter is used

Closes #16

Confidence: 9/10 — minimal, BC-safe change; full unit suite, cs-fixer and phpstan green.

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.

[B2] Registry value objects carrying behaviour and building their own dependencies

1 participant