[PROTOTYPE] tool result formatters#946
Draft
LasmarKhalifa wants to merge 1 commit into
Draft
Conversation
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.

Prototype for tool_result formatters.
Example outputs for tool results to illustrate the proposed design:

We use Nokogiri here, an XML parser to parse the message for TaskOutput, which can look something like: "<retrieval_status>success</retrieval_status>\n\n<task_id>adfgh456b87d647</task_id>\n\n<task_type>local_agent</task_type>\n\n<status>completed</status>\n\n<output>\nThe total count is 0.\n\nNo existing issues found.\n\nThere are no GitHub issues in this org with the
speciallabel that mentionClass::Special.\n</output>”.This allows us to robustly extract the parts we want (retrieval status and status).
We have 2 versions in this prototype:
tool_result.rbandtool_result_dry.rbThe dry version focuses on minimizing repetition and lines of code, while the other one is explicit and localizes all the code for each formatter in its own method.I think a hybrid approach is best, where we take the
tool_result.rbbut move the error lines in the formatter as well as create a helper method (like theokmethod in the dry version) for formatters that repeat the same output format, but I’m open to other suggestions!