summaryrefslogtreecommitdiff
path: root/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Agent.Core.Tests/PromptAndRuntimeTests.cs')
-rw-r--r--tests/Agent.Core.Tests/PromptAndRuntimeTests.cs13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs b/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs
index 6dad528..082ea9b 100644
--- a/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs
+++ b/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs
@@ -124,6 +124,7 @@ public sealed class PromptAndRuntimeTests
Assert.Equal("file_edit", backend.Calls[0].Name);
Assert.Equal(2, ollama.CallCount);
Assert.Equal(InternalToolCatalog.All.Count, ollama.ToolCount);
+ Assert.True(ollama.ThinkingPreservedForToolContinuation);
}
[Fact]
@@ -270,7 +271,7 @@ public sealed class PromptAndRuntimeTests
}
[Fact]
- public async Task Invalid_structured_plan_retries_once_with_think_disabled()
+ public async Task Invalid_structured_plan_retries_once_without_disabling_configured_thinking()
{
TaskRegistry registry = new();
var ollama = new ThinkRetryOllamaClient(succeedOnRetry: true);
@@ -282,7 +283,7 @@ public sealed class PromptAndRuntimeTests
Assert.True(registry.TryGet(task.TaskId, null, out TaskSnapshot? completed));
Assert.Equal(AgentTaskState.Completed, completed!.State);
- Assert.Equal([null, false], ollama.ThinkOverrides);
+ Assert.Equal([null, null], ollama.ThinkOverrides);
Assert.All(ollama.Temperatures, value => Assert.Equal(0.7, value));
Assert.Contains(ollama.PlanningMessages[0], message =>
message.Role == "system" && message.Content.Contains("There is no file_write Tool", StringComparison.Ordinal));
@@ -305,7 +306,7 @@ public sealed class PromptAndRuntimeTests
Assert.True(registry.TryGet(task.TaskId, null, out TaskSnapshot? failed));
Assert.Equal(AgentTaskState.Failed, failed!.State);
- Assert.Contains("think=false retry", failed.Result, StringComparison.OrdinalIgnoreCase);
+ Assert.Contains("one corrected retry", failed.Result, StringComparison.OrdinalIgnoreCase);
Assert.Equal(0, ollama.RunCalls);
}
@@ -453,6 +454,7 @@ public sealed class PromptAndRuntimeTests
{
public int CallCount { get; private set; }
public int ToolCount { get; private set; }
+ public bool ThinkingPreservedForToolContinuation { get; private set; }
public Task<OllamaResult> ChatAsync(IReadOnlyList<OllamaMessage> messages, double? temperatureOverride, CancellationToken cancellationToken) =>
Task.FromResult(new OllamaResult("修正しました。", 1, 1));
public Task<OllamaResult> ChatStructuredAsync(IReadOnlyList<OllamaMessage> messages, double? temperatureOverride, JsonElement format, CancellationToken cancellationToken)
@@ -468,8 +470,11 @@ public sealed class PromptAndRuntimeTests
if (CallCount == 1)
{
using JsonDocument document = JsonDocument.Parse("""{"path":"x","operation":"overwrite","content":"new"}""");
- return Task.FromResult(new OllamaResult("", 2, 1, [new OllamaToolCall(new OllamaFunctionCall("file_edit", document.RootElement.Clone()))]));
+ return Task.FromResult(new OllamaResult("", 2, 1,
+ [new OllamaToolCall(new OllamaFunctionCall("file_edit", document.RootElement.Clone()))], Thinking: "private tool reasoning"));
}
+ ThinkingPreservedForToolContinuation = messages.Any(message =>
+ message.Role == "assistant" && message.Thinking == "private tool reasoning" && message.ToolCalls?.Count == 1);
return Task.FromResult(new OllamaResult("修正しました。", 2, 2));
}
}