Parse reasoning text content (#2277)

Sometimes COT is returns as text content instead of `ReasoningText`. We
should parse it but not serialize back on requests.

---------

Co-authored-by: Ahmed Ibrahim <aibrahim@openai.com>
This commit is contained in:
pakrym-oai
2025-08-13 18:39:58 -07:00
committed by GitHub
parent a62510e0ae
commit f1be7978cf
8 changed files with 169 additions and 58 deletions

View File

@@ -11,6 +11,7 @@ pub(crate) enum StreamKind {
pub(crate) struct StreamState {
pub(crate) collector: MarkdownStreamCollector,
pub(crate) streamer: AnimatedLineStreamer,
pub(crate) has_seen_delta: bool,
}
impl StreamState {
@@ -18,11 +19,13 @@ impl StreamState {
Self {
collector: MarkdownStreamCollector::new(),
streamer: AnimatedLineStreamer::new(),
has_seen_delta: false,
}
}
pub(crate) fn clear(&mut self) {
self.collector.clear();
self.streamer.clear();
self.has_seen_delta = false;
}
pub(crate) fn step(&mut self) -> crate::markdown_stream::StepResult {
self.streamer.step()