Skip to content

Refactor StreamHandler to dynamically build role_tags from role_mappi…#5

Open
MazenSalama wants to merge 2 commits into
bsides230:mainfrom
MazenSalama:fix-streamhandler-roles
Open

Refactor StreamHandler to dynamically build role_tags from role_mappi…#5
MazenSalama wants to merge 2 commits into
bsides230:mainfrom
MazenSalama:fix-streamhandler-roles

Conversation

@MazenSalama

Copy link
Copy Markdown

…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`.
…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`.
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.

1 participant