Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,12 @@ impl From<DeltaChoice> for dynamo_async_openai::types::ChatChoice {
message: dynamo_async_openai::types::ChatCompletionResponseMessage {
role: delta.role.expect("delta should have a Role"),
content: if delta.text.is_empty() {
None
// If we have reasoning content, provide an empty string instead of None.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why?

if delta.reasoning_content.is_some() {
Some(String::new())
} else {
None
}
Comment on lines 286 to +292
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add test coverage for the empty content with reasoning_content scenario.

The code change at lines 286-292 intentionally returns Some(String::new()) for the content field when reasoning_content is present but text is empty. While this behavior is clearly documented in the inline comment, there is no test coverage for this specific scenario. Add a test case to verify this behavior and prevent regressions.

🤖 Prompt for AI Agents
In lib/llm/src/protocols/openai/chat_completions/aggregator.rs around lines
286-292, add a unit test that constructs a delta with empty text and a
Some(reasoning_content) value, runs it through the aggregator code path that
builds the output struct, and asserts that the resulting content field is
Some(String::new()) (not None) while reasoning_content is preserved; place the
test alongside existing aggregator tests, name it clearly (e.g.,
empty_text_with_reasoning_returns_empty_string), and include any necessary
setup/mocks so it executes deterministically in CI.

Comment on lines +288 to +292
Copy link
Contributor

Choose a reason for hiding this comment

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

this fix does not make sense to me.

} else {
Some(delta.text)
},
Expand Down
Loading