Prompt Caching: Top-Level cache_control im Request-Body

This commit is contained in:
Meleki committed 2026-02-28 17:16:58 +01:00
1 parent 52e9ef7f9e
commit 92072f5064
3 files changed
+14 -33

No files matched your search

+11 -29
View File
@@ -11,7 +11,7 @@ namespace Gott.Services;
public class ToolService
{
public object[] GetToolDefinitions(bool markLastAsCached = false)
public object[] GetToolDefinitions()
{
return new object[]
{
@@ -88,38 +88,20 @@ public class ToolService
required = new[] { "path" }
}
},
// Letztes Tool bekommt cache_control – Anthropic cached alles bis einschließlich
// dieses Breakpoints (System-Prompt + alle Tool-Definitionen) für 5 Minuten.
markLastAsCached
? (object)new
new
{
name = "execute",
description = "Führt einen Shell-Befehl im Workspace-Verzeichnis aus. Gibt stdout und stderr zurück. Timeout: 30 Sekunden.",
input_schema = new
{
name = "execute",
description = "Führt einen Shell-Befehl im Workspace-Verzeichnis aus. Gibt stdout und stderr zurück. Timeout: 30 Sekunden.",
input_schema = new
type = "object",
properties = new Dictionary<string, object>
{
type = "object",
properties = new Dictionary<string, object>
{
["command"] = new { type = "string", description = "Shell-Befehl zum Ausführen" }
},
required = new[] { "command" }
["command"] = new { type = "string", description = "Shell-Befehl zum Ausführen" }
},
cache_control = new { type = "ephemeral" }
}
: new
{
name = "execute",
description = "Führt einen Shell-Befehl im Workspace-Verzeichnis aus. Gibt stdout und stderr zurück. Timeout: 30 Sekunden.",
input_schema = new
{
type = "object",
properties = new Dictionary<string, object>
{
["command"] = new { type = "string", description = "Shell-Befehl zum Ausführen" }
},
required = new[] { "command" }
}
required = new[] { "command" }
}
}
};
}