mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-23 07:33:48 +00:00
Added status texts for prompt processing and reasoning to the chat (#1205)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
6cdb0bc551
commit
28b88580a9
29 files changed
+504
-30
No files matched your search
@@ -63,6 +63,25 @@ public sealed class AnthropicMessageStreamAccumulatorTests
|
||||
Assert.That(shown, Is.False, "What the model thinks stays between it and the next round.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ThinkingSaysThatTheModelReasons()
|
||||
{
|
||||
var accumulator = new AnthropicMessageStreamAccumulator();
|
||||
var parts = Lines(
|
||||
"""{"type":"content_block_start","index":0,"content_block":{"type":"thinking","thinking":""}}""",
|
||||
"""{"type":"content_block_delta","index":0,"delta":{"type":"thinking_delta","thinking":"Let me consider this."}}""",
|
||||
"""{"type":"content_block_start","index":1,"content_block":{"type":"text","text":""}}""",
|
||||
"""{"type":"content_block_delta","index":1,"delta":{"type":"text_delta","text":"The answer."}}""")
|
||||
.Select(accumulator.Process)
|
||||
.ToList();
|
||||
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(parts[1].IsReasoning, Is.True, "A thinking delta tells the user why no text arrives yet.");
|
||||
Assert.That(parts[3].IsReasoning, Is.False, "Text is the answer, not reasoning.");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AThinkingBlockKeepsItsSignature()
|
||||
{
|
||||
|
||||
@@ -131,6 +131,24 @@ public sealed class ChatCompletionToolCallAccumulatorTests
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReasoningSaysThatTheModelReasons()
|
||||
{
|
||||
var accumulator = new ChatCompletionToolCallAccumulator();
|
||||
var parts = Lines(
|
||||
"""{"choices":[{"index":0,"delta":{"reasoning_content":"Thinking about it."}}]}""",
|
||||
"""{"choices":[{"index":0,"delta":{"content":"The answer."}}]}""")
|
||||
.Select(accumulator.Process)
|
||||
.ToList();
|
||||
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(parts[0].IsReasoning, Is.True, "A reasoning delta tells the user why no text arrives yet.");
|
||||
Assert.That(parts[0].HasContent, Is.False, "The reasoning itself still does not show.");
|
||||
Assert.That(parts[1].IsReasoning, Is.False, "Text is the answer, not reasoning.");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AToolWhichTakesNothingGetsAnEmptyObject()
|
||||
{
|
||||
|
||||
@@ -46,6 +46,28 @@ public sealed class ResponsesStreamAccumulatorTests
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AnOpeningReasoningItemSaysThatTheModelReasons()
|
||||
{
|
||||
var accumulator = new ResponsesStreamAccumulator();
|
||||
var parts = Lines(
|
||||
"""{"type":"response.output_item.added","output_index":0,"item":{"id":"rs_1","type":"reasoning","summary":[]}}""",
|
||||
"""{"type":"response.reasoning_summary_text.delta","item_id":"rs_1","delta":"Weighing the options."}""",
|
||||
"""{"type":"response.output_item.added","output_index":1,"item":{"id":"msg_1","type":"message","content":[]}}""",
|
||||
"""{"type":"response.output_text.delta","delta":"The answer."}""")
|
||||
.Select(accumulator.Process)
|
||||
.ToList();
|
||||
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(parts[0].IsReasoning, Is.True, "The opening of a reasoning item is all the API says about reasoning it keeps to itself.");
|
||||
Assert.That(parts[1].IsReasoning, Is.True, "A summary of the reasoning says the same.");
|
||||
Assert.That(parts[1].HasContent, Is.False, "The reasoning itself does not show.");
|
||||
Assert.That(parts[2].IsReasoning, Is.False, "A message which opens is not reasoning.");
|
||||
Assert.That(parts[3].IsReasoning, Is.False, "Text is the answer, not reasoning.");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheTextIsShownWhileItIsBeingWritten()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user