Allowed restricting the web search to the past week

This commit is contained in:
Thorsten Sommer committed 2026-09-24 12:00:57 +02:00
1 parent 91de164d1c
commit c17d726814
2 files changed
+23 -6

No files matched your search

@@ -93,9 +93,22 @@ public sealed class WebSearchToolArgumentTests
});
}
[TestCase("day")]
[TestCase("week")]
[TestCase("month")]
[TestCase("year")]
public void EveryOfferedTimeRangeIsAccepted(string timeRange)
{
//
// The week is the one a model asks for when the user says "this week". Both services with
// a time filter understand it, and refusing it only made the model try it again and again.
//
Assert.That(WebSearchTool.ReadTimeRange(Arguments($$"""{"query":"weather","time_range":"{{timeRange}}"}""")), Is.EqualTo(timeRange));
}
[TestCase("\"\"")]
[TestCase("\"Day\"")]
[TestCase("\"week\"")]
[TestCase("\"decade\"")]
[TestCase("5")]
public void AWrongTimeRangeIsRefusedWithTheValuesThatWouldDo(string value)
{
@@ -103,7 +116,7 @@ public sealed class WebSearchToolArgumentTests
Assert.Multiple(() =>
{
Assert.That(message, Does.Contain("'time_range'").And.Contain("one of day, month, year"));
Assert.That(message, Does.Contain("'time_range'").And.Contain("one of day, week, month, year"));
Assert.That(message, Does.Contain($"but was {value}."));
Assert.That(message, Does.Contain("Leave it out"));
});