Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
Update tuning.ts
Developers Digestf623f21ce840
diff --git a/apps/api/src/services/monitoring/search/tuning.ts b/apps/api/src/services/monitoring/search/tuning.tsindex 2e14db3d5..63b539272 100644--- a/apps/api/src/services/monitoring/search/tuning.ts+++ b/apps/api/src/services/monitoring/search/tuning.ts@@ -1,3 +1,4 @@+import type { GoogleLanguageModelOptions } from "@ai-sdk/google";import { getModel } from "../../../lib/generic-ai";import { config } from "../../../config";@@ -10,29 +11,6 @@ export type LlmUsageLabels = {monitorCheckId: string;};-export function googleProviderOptions(- functionId: string,- labels?: LlmUsageLabels,-) {- return {- providerOptions: {- google: {- thinkingConfig: { thinkingLevel: "minimal" as const },- ...(labels- ? {- labels: {- functionId,- teamId: labels.teamId,- monitorId: labels.monitorId,- monitorCheckId: labels.monitorCheckId,- },- }- : {}),- },- },- };-}-function geminiApiKey(): string | undefined {return process.env.GOOGLE_GENERATIVE_AI_API_KEY ?? process.env.GEMINI_API_KEY;}@@ -51,3 +29,20 @@ export function hasLlmProvider(): boolean {export function googleModel(modelId: string) {return getModel(modelId, hasVertex() ? "vertex" : "google");}++export function googleProviderOptions(+ functionId: string,+ labels?: LlmUsageLabels,+) {+ const provider = hasVertex() ? "vertex" : "google";++ const options: GoogleLanguageModelOptions = {+ thinkingConfig: { thinkingLevel: "minimal" },+ };+ // Billing labels are Vertex-only; the GenAI provider ignores them.+ if (provider === "vertex" && labels) {+ options.labels = { functionId, ...labels };+ }++ return { providerOptions: { [provider]: options } };+}