diff --git a/Endpoints/AgentEndpoint.cs b/Endpoints/AgentEndpoint.cs
index 0dca9e7..c8f52eb 100644
--- a/Endpoints/AgentEndpoint.cs
+++ b/Endpoints/AgentEndpoint.cs
@@ -66,6 +66,7 @@ public static class AgentEndpoint
a.UseMemory,
a.UseAutoContext,
a.UseGitHubSearch,
+ a.UseSerperSearch,
a.UseWebSearch,
a.WebSearchVersion,
a.AllowUserChoice,
@@ -123,6 +124,7 @@ public static class AgentEndpoint
UseMemory = !body.TryGetProperty("useMemory", out var um) || um.GetBoolean(),
UseAutoContext = !body.TryGetProperty("useAutoContext", out var uac) || uac.GetBoolean(),
UseGitHubSearch = body.TryGetProperty("useGitHubSearch", out var ughs) && ughs.GetBoolean(),
+ UseSerperSearch = body.TryGetProperty("useSerperSearch", out var usps) && usps.GetBoolean(),
UseWebSearch = body.TryGetProperty("webSearchVersion", out var wsv) && !string.IsNullOrEmpty(wsv.GetString()),
WebSearchVersion = body.TryGetProperty("webSearchVersion", out var wsv2) ? wsv2.GetString() ?? "" : "",
AllowUserChoice = !body.TryGetProperty("allowUserChoice", out var auc) || auc.GetBoolean(),
@@ -166,6 +168,7 @@ public static class AgentEndpoint
if (body.TryGetProperty("useMemory", out var um)) agent.UseMemory = um.GetBoolean();
if (body.TryGetProperty("useAutoContext", out var uac)) agent.UseAutoContext = uac.GetBoolean();
if (body.TryGetProperty("useGitHubSearch", out var ughs)) agent.UseGitHubSearch = ughs.GetBoolean();
+ if (body.TryGetProperty("useSerperSearch", out var usps)) agent.UseSerperSearch = usps.GetBoolean();
if (body.TryGetProperty("webSearchVersion", out var wsv))
{
agent.WebSearchVersion = wsv.GetString() ?? "";
diff --git a/Endpoints/ChatEndpoint.cs b/Endpoints/ChatEndpoint.cs
index 2a9fcfc..e361010 100644
--- a/Endpoints/ChatEndpoint.cs
+++ b/Endpoints/ChatEndpoint.cs
@@ -216,7 +216,7 @@ public static class ChatEndpoint
else
{
// Standard: Anthropic
- await anthropic.StreamChat(res, ctx.ModelId, ctx.SystemPrompt, messages, ctx.ChainId, ctx.Workspace, sessionId, agentId: ctx.AgentId, userId: userId, useMemory: ctx.UseMemory, webSearchVersion: ctx.WebSearchVersion, maxIterations: ctx.MaxIterations, toolChoice: effectiveToolChoice, review: ctx.Review, finalizer: ctx.Finalizer, allowUserChoice: ctx.Agent?.AllowUserChoice ?? true, planMode: ctx.PlanMode, useAutoContext: ctx.Agent?.UseAutoContext ?? true, useGitHubSearch: ctx.Agent?.UseGitHubSearch ?? false, workCt: workCt, hardCt: hardCt, sseCt: sseCt, remoteMgr: remoteMgr);
+ await anthropic.StreamChat(res, ctx.ModelId, ctx.SystemPrompt, messages, ctx.ChainId, ctx.Workspace, sessionId, agentId: ctx.AgentId, userId: userId, useMemory: ctx.UseMemory, webSearchVersion: ctx.WebSearchVersion, maxIterations: ctx.MaxIterations, toolChoice: effectiveToolChoice, review: ctx.Review, finalizer: ctx.Finalizer, allowUserChoice: ctx.Agent?.AllowUserChoice ?? true, planMode: ctx.PlanMode, useAutoContext: ctx.Agent?.UseAutoContext ?? true, useGitHubSearch: ctx.Agent?.UseGitHubSearch ?? false, useSerperSearch: ctx.Agent?.UseSerperSearch ?? false, workCt: workCt, hardCt: hardCt, sseCt: sseCt, remoteMgr: remoteMgr);
}
}
finally
diff --git a/Models/AgentRecord.cs b/Models/AgentRecord.cs
index b4980c1..6ea5b18 100644
--- a/Models/AgentRecord.cs
+++ b/Models/AgentRecord.cs
@@ -18,6 +18,7 @@ public class AgentRecord
public bool UseMemory { get; set; } = true;
public bool UseAutoContext { get; set; } = true;
public bool UseGitHubSearch { get; set; }
+ public bool UseSerperSearch { get; set; }
public bool UseWebSearch { get; set; }
public string WebSearchVersion { get; set; } = "";
public bool AllowUserChoice { get; set; } = true;
diff --git a/Services/AnthropicService.cs b/Services/AnthropicService.cs
index fd397d6..b6d5a83 100644
--- a/Services/AnthropicService.cs
+++ b/Services/AnthropicService.cs
@@ -97,6 +97,7 @@ public class AnthropicService
bool planMode = false,
bool useAutoContext = true,
bool useGitHubSearch = false,
+ bool useSerperSearch = false,
CancellationToken workCt = default,
CancellationToken hardCt = default,
CancellationToken sseCt = default,
@@ -178,7 +179,7 @@ public class AnthropicService
payload["system"] = systemPrompt;
var hasRemote = remoteMgr?.GetBySessionId(sessionId) != null;
- AddToolsToPayload(payload, workspace, agentId, useMemory, webSearchVersion, toolChoice, iterations, allowUserChoice, planMode, includeRemote: hasRemote, includeGitHubSearch: useGitHubSearch && _toolService.HasGitHubToken);
+ AddToolsToPayload(payload, workspace, agentId, useMemory, webSearchVersion, toolChoice, iterations, allowUserChoice, planMode, includeRemote: hasRemote, includeGitHubSearch: useGitHubSearch && _toolService.HasGitHubToken, includeSerperSearch: useSerperSearch && _toolService.HasSerperKey);
var client = CreateClient();
var json = JsonSerializer.Serialize(payload, new JsonSerializerOptions { WriteIndented = true });
@@ -1620,13 +1621,13 @@ public class AnthropicService
///
/// Fügt Tool-Definitionen und WebSearch zum Payload hinzu.
///
- private void AddToolsToPayload(Dictionary payload, string workspace, string agentId, bool useMemory, string webSearchVersion, string toolChoice, int iteration, bool allowUserChoice = false, bool planMode = false, bool includeRemote = false, bool includeGitHubSearch = false)
+ private void AddToolsToPayload(Dictionary payload, string workspace, string agentId, bool useMemory, string webSearchVersion, string toolChoice, int iteration, bool allowUserChoice = false, bool planMode = false, bool includeRemote = false, bool includeGitHubSearch = false, bool includeSerperSearch = false)
{
var hasWorkspace = !string.IsNullOrEmpty(workspace);
var includeMemory = useMemory && _memoryService != null && !string.IsNullOrEmpty(agentId);
var includeMemorySearch = _vectorSearch != null && _vectorSearch.GetEmbeddingCount() > 0;
var includeSendToSession = _db != null && _chatService != null;
- var hasTools = hasWorkspace || includeMemory || includeRemote || includeMemorySearch || includeSendToSession || includeGitHubSearch;
+ var hasTools = hasWorkspace || includeMemory || includeRemote || includeMemorySearch || includeSendToSession || includeGitHubSearch || includeSerperSearch;
var hasWebSearch = !string.IsNullOrEmpty(webSearchVersion);
if (!hasTools && !hasWebSearch) return;
@@ -1634,7 +1635,7 @@ public class AnthropicService
var tools = new List