|
1 | 1 | import { Agent } from '@mastra/core/agent' |
2 | 2 |
|
3 | | -import type { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google' |
| 3 | +import type { GoogleGenerativeAIProviderOptions, GoogleLanguageModelOptions } from '@ai-sdk/google' |
4 | 4 | import { |
5 | 5 | TokenLimiterProcessor |
6 | 6 | } from '@mastra/core/processors' |
7 | 7 | import { |
8 | 8 | createAnswerRelevancyScorer, |
9 | 9 | createToxicityScorer, |
10 | 10 | } from '@mastra/evals/scorers/prebuilt' |
11 | | -import { |
12 | | - google3, |
13 | | - googleAI3, |
14 | | - googleAIFlashLite, |
15 | | -} from '../config/google' |
16 | 11 | import { log } from '../config/logger' |
17 | 12 |
|
18 | 13 | import { InternalSpans } from '@mastra/core/observability' |
19 | 14 | import { pgMemory } from '../config/pg-storage' |
20 | 15 | import { codeAnalysisTool } from '../tools/code-analysis.tool' |
21 | 16 | import { codeSearchTool } from '../tools/code-search.tool' |
22 | 17 | import { diffReviewTool } from '../tools/diff-review.tool' |
23 | | -import { |
24 | | - checkFileExists, |
25 | | - createDirectory, |
26 | | - createSandbox, |
27 | | - deleteFile, |
28 | | - getFileInfo, |
29 | | - getFileSize, |
30 | | - listFiles, |
31 | | - runCode, |
32 | | - runCommand, |
33 | | - watchDirectory, |
34 | | - writeFile, |
35 | | - writeFiles, |
36 | | -} from '../tools/e2b' |
37 | 18 | import { findReferencesTool } from '../tools/find-references.tool' |
38 | 19 | import { findSymbolTool } from '../tools/find-symbol.tool' |
39 | 20 | import { |
@@ -87,34 +68,13 @@ const codeReviewerTools = { |
87 | 68 | const testEngineerTools = { |
88 | 69 | codeAnalysisTool, |
89 | 70 | testGeneratorTool, |
90 | | - createSandbox, |
91 | | - runCommand, |
92 | | - runCode, |
93 | | - writeFile, |
94 | | - writeFiles, |
95 | | - deleteFile, |
96 | | - listFiles, |
97 | | - getFileInfo, |
98 | | - getFileSize, |
99 | | - checkFileExists, |
| 71 | + |
100 | 72 | } |
101 | 73 |
|
102 | 74 | const refactoringTools = { |
103 | 75 | codeAnalysisTool, |
104 | 76 | diffReviewTool, |
105 | 77 | multiStringEditTool, |
106 | | - createSandbox, |
107 | | - runCode, |
108 | | - runCommand, |
109 | | - writeFile, |
110 | | - writeFiles, |
111 | | - deleteFile, |
112 | | - listFiles, |
113 | | - getFileInfo, |
114 | | - getFileSize, |
115 | | - checkFileExists, |
116 | | - createDirectory, |
117 | | - watchDirectory, |
118 | 78 | searchCode, |
119 | 79 | getFileContent, |
120 | 80 | getRepositoryInfo, |
@@ -178,19 +138,19 @@ Always consider maintainability, scalability, and testability in your recommenda |
178 | 138 | responseModalities: ['TEXT'], |
179 | 139 | cachedContent: |
180 | 140 | 'Repo Name, Description, Key Modules, Recent Commits', |
181 | | - } satisfies GoogleGenerativeAIProviderOptions, |
| 141 | + } satisfies GoogleLanguageModelOptions, |
182 | 142 | }, |
183 | 143 | } |
184 | 144 | }, |
185 | 145 | model: ({ requestContext }) => { |
186 | 146 | const userTier = getUserTierFromContext(requestContext) |
187 | | - return userTier === 'enterprise' ? googleAI3 : google3 |
| 147 | + return userTier === 'enterprise' ? 'google/gemini-3.1-flash-preview' : 'google/gemini-3.1-flash-lite-preview' |
188 | 148 | }, |
189 | 149 | tools: codeArchitectTools, |
190 | 150 | memory: pgMemory, |
191 | 151 | scorers: { |
192 | 152 | relevancy: { |
193 | | - scorer: createAnswerRelevancyScorer({ model: googleAIFlashLite }), |
| 153 | + scorer: createAnswerRelevancyScorer({ model: 'google/gemini-3.1-flash-lite-preview' }), |
194 | 154 | sampling: { type: 'ratio', rate: 0.5 }, |
195 | 155 | }, |
196 | 156 | }, |
@@ -304,11 +264,11 @@ Be constructive and educational in feedback.`, |
304 | 264 | }, |
305 | 265 | scorers: { |
306 | 266 | relevancy: { |
307 | | - scorer: createAnswerRelevancyScorer({ model: googleAIFlashLite }), |
| 267 | + scorer: createAnswerRelevancyScorer({ model: 'google/gemini-3.1-flash-lite-preview' }), |
308 | 268 | sampling: { type: 'ratio', rate: 0.5 }, |
309 | 269 | }, |
310 | 270 | safety: { |
311 | | - scorer: createToxicityScorer({ model: googleAIFlashLite }), |
| 271 | + scorer: createToxicityScorer({ model: 'google/gemini-3.1-flash-lite-preview' }), |
312 | 272 | sampling: { type: 'ratio', rate: 0.3 }, |
313 | 273 | }, |
314 | 274 | }, |
@@ -427,7 +387,7 @@ Always use Vitest syntax: describe, it, expect, vi.mock, vi.fn.`, |
427 | 387 | }, |
428 | 388 | scorers: { |
429 | 389 | relevancy: { |
430 | | - scorer: createAnswerRelevancyScorer({ model: googleAIFlashLite }), |
| 390 | + scorer: createAnswerRelevancyScorer({ model: 'google/gemini-3.1-flash-lite-preview' }), |
431 | 391 | sampling: { type: 'ratio', rate: 0.5 }, |
432 | 392 | }, |
433 | 393 | }, |
@@ -554,7 +514,7 @@ For each refactoring: |
554 | 514 | }, |
555 | 515 | scorers: { |
556 | 516 | relevancy: { |
557 | | - scorer: createAnswerRelevancyScorer({ model: googleAIFlashLite }), |
| 517 | + scorer: createAnswerRelevancyScorer({ model: 'google/gemini-3.1-flash-lite-preview' }), |
558 | 518 | sampling: { type: 'ratio', rate: 0.5 }, |
559 | 519 | }, |
560 | 520 | }, |
|
0 commit comments