Skip to content

Build your personal knowledge base with Trilium Notes

fix(llm): unbreak typecheck on the Anthropic web-search tool

Elian Doranebee6c7a0ebd
diff --git a/apps/server/src/services/llm/providers/anthropic.ts b/apps/server/src/services/llm/providers/anthropic.ts
index 4d8445aaf4..d491c03278 100644
--- a/apps/server/src/services/llm/providers/anthropic.ts
+++ b/apps/server/src/services/llm/providers/anthropic.ts
@@ -54,9 +54,12 @@ export class AnthropicProvider extends BaseProvider {
}
protected override addWebSearchTool(tools: ToolSet): void {
+ // `ToolSet` pins its input parameter to `never` in two of its four arms, which a
+ // provider-executed tool declaring a real input matches none of. Upstream's to fix; drop
+ // the cast once `ai` and `@ai-sdk/anthropic` agree again.
tools.web_search = this.anthropic.tools.webSearch_20250305({
maxUses: 5
- });
+ }) as ToolSet[string];
}
override recommendedModelIds(models: ModelInfo[]): Set<string> {