Refactor StreamHandler to dynamically build role_tags from role_mappi…#5
Open
MazenSalama wants to merge 2 commits into
Open
Refactor StreamHandler to dynamically build role_tags from role_mappi…#5MazenSalama wants to merge 2 commits into
MazenSalama wants to merge 2 commits into
Conversation
…ngs.
This fixes an issue where the StreamHandler was not correctly using the `role_mappings` and `role_color_tags` dictionaries to handle different LLM output roles. The existing implementation had a hardcoded `role_tags` dictionary, which limited its ability to recognize and color-code various roles defined in `role_mappings`.
The new implementation iterates through the `self.role_mappings` dictionary and, based on the `category` ('thinking_process' or 'final_output'), constructs the appropriate tag format and populates `self.role_tags`. This ensures that all roles defined in `role_mappings` will be recognized and handled by the `StreamHandler`.
…ngs.
This fixes an issue where the StreamHandler was not correctly using the `role_mappings` and `role_color_tags` dictionaries to handle different LLM output roles. The existing implementation had a hardcoded `role_tags` dictionary, which limited its ability to recognize and color-code various roles defined in `role_mappings`.
The new implementation iterates through the `self.role_mappings` dictionary and, based on the `category` ('thinking_process' or 'final_output'), constructs the appropriate tag format and populates `self.role_tags`. This ensures that all roles defined in `role_mappings` will be recognized and handled by the `StreamHandler`.
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.
…ngs.
This fixes an issue where the StreamHandler was not correctly using the
role_mappingsandrole_color_tagsdictionaries to handle different LLM output roles. The existing implementation had a hardcodedrole_tagsdictionary, which limited its ability to recognize and color-code various roles defined inrole_mappings.The new implementation iterates through the
self.role_mappingsdictionary and, based on thecategory('thinking_process' or 'final_output'), constructs the appropriate tag format and populatesself.role_tags. This ensures that all roles defined inrole_mappingswill be recognized and handled by theStreamHandler.