Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net: Extend chat message parsing and add relevant unit tests #4602

Merged

Conversation

Krzysztof318
Copy link
Contributor

@Krzysztof318 Krzysztof318 commented Jan 13, 2024

Motivation and Context

Splitted PR #4536

Allow passing image content in prompt text.

Description

Added new method named 'ParseChatNode' for interpreting images and text content within chat messages.
Added unit tests for ChatPromptParser.

Contribution Checklist

The chat message parsing logic in ChatPromptParser.cs has been refactored to boost code readability and modularity. A new method named 'ParseChatNode' for interpreting images and text content within chat messages has been introduced. In addition, Image and Text tag names have been added, and the 'IsValidChatMessage' method has been enhanced to check for validity more effectively. Concurrently, unit tests for ChatPromptParser have been implemented to validate these changes.
@Krzysztof318 Krzysztof318 requested a review from a team as a code owner January 13, 2024 16:56
@shawncal shawncal added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core labels Jan 13, 2024
@github-actions github-actions bot changed the title Refactor chat message parsing and add relevant unit tests .Net: Refactor chat message parsing and add relevant unit tests Jan 13, 2024
@Krzysztof318 Krzysztof318 changed the title .Net: Refactor chat message parsing and add relevant unit tests .Net: Extend chat message parsing and add relevant unit tests Jan 13, 2024
Copy link
Member

@dmytrostruk dmytrostruk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Krzysztof318 Thank you for your contribution and thanks for adding unit tests for new functionality! I left a couple of small comments.

Krzysztof318 and others added 5 commits January 15, 2024 20:34
Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
Optimized the ChatPromptParser by removing unnecessary null checks and breaking down complex expressions. Specifically, the IsValidChatMessage method was refactored by separating the check for valid child nodes. Test headers were also removed for clarity.
@markwallace-microsoft markwallace-microsoft added this pull request to the merge queue Jan 22, 2024
Merged via the queue into microsoft:main with commit e4874bb Jan 22, 2024
18 checks passed
@Krzysztof318 Krzysztof318 deleted the prompt-parser-extend branch January 22, 2024 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel.core kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants