-
Notifications
You must be signed in to change notification settings - Fork 302
write chunks in TextParserStreamer #3025
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
Open
pavel-esir
wants to merge
9
commits into
openvinotoolkit:master
Choose a base branch
from
pavel-esir:write_chunks_during_parse
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+250
−128
Open
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2be242f
write chunks in TextParserStreamer
pavel-esir 4017fb5
Fix pytests and gtests for parsers
pavel-esir 6e5dcc2
get rid of 'ensure_message_fields'; extend texts
pavel-esir ae2f662
Apply suggestions from code review
pavel-esir a8764fe
Apply suggestions from code review
pavel-esir 23fa222
use 'JsonContainer::concatenate'; improve variable naming
pavel-esir 3a8e302
Update src/cpp/src/parsers.cpp
pavel-esir db57dd4
Merge branch 'master' into write_chunks_during_parse
pavel-esir 48a0b14
apply review comments
pavel-esir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,18 +20,6 @@ class ReasoningIncrementalParser::ReasoningParserImpl { | |||||||
| bool m_think_tag_opened = false; | ||||||||
| std::string m_text_cache = ""; | ||||||||
| bool m_deactivated = false; | ||||||||
|
|
||||||||
| /** | ||||||||
| * @brief Ensure required fields exist in the message container. | ||||||||
| */ | ||||||||
| void ensure_message_fields(JsonContainer& message) { | ||||||||
| if (!message.contains("reasoning_content")) { | ||||||||
| message["reasoning_content"] = ""; | ||||||||
| } | ||||||||
| if (!message.contains("content")) { | ||||||||
| message["content"] = ""; | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * @brief Find the longest suffix of text that is a prefix of the close tag. | ||||||||
|
|
@@ -61,8 +49,8 @@ class ReasoningIncrementalParser::ReasoningParserImpl { | |||||||
| void handle_complete_reasoning(JsonContainer& message, std::string_view txt_chunk, | ||||||||
| size_t open_idx, size_t close_idx, std::string& delta_text) { | ||||||||
| // Extract reasoning content between tags | ||||||||
| message["reasoning_content"] = std::string(txt_chunk.substr(open_idx + m_open_tag.size(), | ||||||||
| close_idx - (open_idx + m_open_tag.size()))); | ||||||||
| message["reasoning_content"] = std::string(txt_chunk.substr(open_idx + m_open_tag.size(), close_idx - (open_idx + m_open_tag.size()))); | ||||||||
|
||||||||
| message["reasoning_content"] = std::string(txt_chunk.substr(open_idx + m_open_tag.size(), close_idx - (open_idx + m_open_tag.size()))); | |
| size_t reasoning_length = close_idx - (open_idx + m_open_tag.size()); | |
| message["reasoning_content"] = std::string(txt_chunk.substr(open_idx + m_open_tag.size(), reasoning_length)); |
pavel-esir marked this conversation as resolved.
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
pavel-esir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update doc. Replace message -> delta_message in
@param message JsonContainer to store parsed results and reasoning metadata