feat: add transform_llm_output plugin hook (salvage of #20813)#21235
Merged
Conversation
Enables plugins to transform LLM output text after generation, useful for vocabulary/personality transformation without burning inference tokens. Follows same pattern as transform_tool_result and transform_terminal_output: - First non-empty string result wins - Fail-open: exceptions logged as warnings, agent continues - Signature: (response_text, session_id, model, platform)
- tests/test_transform_llm_output_hook.py: dispatch semantics (kwargs contract, first-non-empty-string-wins, empty-string pass-through, raising-plugin fail-open, no-plugins = no-op) - tests/hermes_cli/test_plugins.py: assert the new hook name is in VALID_HOOKS alongside the other transform_* hooks - website/docs/user-guide/features/hooks.md: summary-table entry + full section mirroring transform_tool_result / transform_terminal_output - scripts/release.py: map barnacleboy.jezzahehn@agentmail.to -> JezzaHehn (existing entry only covers the gmail address)
Contributor
🔎 Lint report:
|
1 task
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvages @JezzaHehn's #20813 onto current main, plus tests, docs, and an AUTHOR_MAP entry.
Summary
Plugins can now transform the assistant's final response text once per turn, before it's delivered. Fail-open, first-non-empty-string wins — same contract as
transform_tool_result.Changes
hermes_cli/plugins.py,run_agent.py— contributor's commit (cherry-picked with authorship preserved)tests/test_transform_llm_output_hook.py— new: dispatch-semantics tests (kwargs contract, first-non-empty wins, empty/None pass-through, raising plugin fail-open, no-plugins no-op)tests/hermes_cli/test_plugins.py— addtransform_llm_outputto the VALID_HOOKS assertionwebsite/docs/user-guide/features/hooks.md— summary-table row + full hook section (mirrorstransform_tool_result/transform_terminal_output)scripts/release.py— mapbarnacleboy.jezzahehn@agentmail.to→JezzaHehn(existing entry only covered the gmail address)Validation
77 passed targeted (
tests/test_transform_llm_output_hook.py,tests/hermes_cli/test_plugins.py,tests/test_transform_tool_result_hook.py).Closes #20813. Credit to @JezzaHehn.