|
1 | | -import { openai } from "@ai-sdk/openai"; |
2 | 1 | import { generateObject, type LanguageModel } from "ai"; |
3 | 2 | import { z } from "zod"; |
4 | 3 | import { experimental_createMCPClient } from "@ai-sdk/mcp"; |
5 | 4 | import { Experimental_StdioMCPTransport } from "@ai-sdk/mcp/mcp-stdio"; |
| 5 | +import { getOpenRouterModel } from "@sentry/mcp-core/internal/agents/openrouter-provider"; |
6 | 6 |
|
7 | 7 | // Cache for available tools to avoid reconnecting for each test |
8 | 8 | let cachedTools: string[] | null = null; |
@@ -64,8 +64,6 @@ interface ToolPredictionScorerOptions { |
64 | 64 | result?: any; |
65 | 65 | } |
66 | 66 |
|
67 | | -const defaultModel = openai("gpt-4o"); |
68 | | - |
69 | 67 | const predictionSchema = z.object({ |
70 | 68 | score: z.number().min(0).max(1).describe("Score from 0 to 1"), |
71 | 69 | rationale: z.string().describe("Explanation of the score"), |
@@ -129,7 +127,7 @@ CRITICAL: The expected tools represent the actual realistic behavior for this sp |
129 | 127 | * A scorer that uses AI to predict what tools would be called without executing them. |
130 | 128 | * This is much faster than actually running the tools and checking what was called. |
131 | 129 | * |
132 | | - * @param model - Optional language model to use for predictions (defaults to gpt-4o) |
| 130 | + * @param model - Optional language model to use for predictions (defaults to OpenRouter) |
133 | 131 | * @returns A scorer function that compares predicted vs expected tool calls |
134 | 132 | * |
135 | 133 | * @example |
@@ -170,7 +168,9 @@ CRITICAL: The expected tools represent the actual realistic behavior for this sp |
170 | 168 | * If `expectedTools` is not provided in test data, the scorer is automatically skipped |
171 | 169 | * and returns `{ score: null }` to allow other scorers to run without interference. |
172 | 170 | */ |
173 | | -export function ToolPredictionScorer(model: LanguageModel = defaultModel) { |
| 171 | +export function ToolPredictionScorer( |
| 172 | + model: LanguageModel = getOpenRouterModel(), |
| 173 | +) { |
174 | 174 | return async function ToolPredictionScorer( |
175 | 175 | opts: ToolPredictionScorerOptions, |
176 | 176 | ) { |
|
0 commit comments