From ce611acf4d1232b9ba02b2a920fd1f15b14d5428 Mon Sep 17 00:00:00 2001 From: Aakash Amod Rajput Date: Thu, 21 Nov 2024 20:01:54 +0530 Subject: [PATCH 1/5] Added Gemini Ai --- packages/api/ai/config.mts | 11 + packages/api/db/schema.mts | 1 + .../api/drizzle/0014_Gemini_Integration.sql | 1 + packages/api/drizzle/meta/0014_snapshot.json | 276 ++++++++++++++++++ packages/api/drizzle/meta/_journal.json | 7 + packages/shared/src/ai.mts | 2 + packages/web/src/components/use-settings.tsx | 1 + packages/web/src/routes/settings.tsx | 34 +++ packages/web/src/types.ts | 1 + 9 files changed, 334 insertions(+) create mode 100644 packages/api/drizzle/0014_Gemini_Integration.sql create mode 100644 packages/api/drizzle/meta/0014_snapshot.json diff --git a/packages/api/ai/config.mts b/packages/api/ai/config.mts index def8f0fc..0f05d4d9 100644 --- a/packages/api/ai/config.mts +++ b/packages/api/ai/config.mts @@ -30,6 +30,17 @@ export async function getModel(): Promise { const anthropic = createAnthropic({ apiKey: config.anthropicKey }); return anthropic(model); + case 'Gemini': + if (!config.geminiKey) { + throw new Error('Gemini API key is not set'); + } + const gemini = createOpenAI({ + compatibility: 'compatible', + baseURL: 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=', + apiKey: config.geminiKey, + }); + return gemini(model); + case 'Xai': if (!config.xaiKey) { throw new Error('Xai API key is not set'); diff --git a/packages/api/db/schema.mts b/packages/api/db/schema.mts index 8adc5e82..eba6b7d5 100644 --- a/packages/api/db/schema.mts +++ b/packages/api/db/schema.mts @@ -9,6 +9,7 @@ export const configs = sqliteTable('config', { openaiKey: text('openai_api_key'), anthropicKey: text('anthropic_api_key'), xaiKey: text('xai_api_key'), + geminiKey: text('gemini_api_key'), // TODO: This is deprecated in favor of SRCBOOK_DISABLE_ANALYTICS env variable. Remove this. enabledAnalytics: integer('enabled_analytics', { mode: 'boolean' }).notNull().default(true), // Stable ID for posthog diff --git a/packages/api/drizzle/0014_Gemini_Integration.sql b/packages/api/drizzle/0014_Gemini_Integration.sql new file mode 100644 index 00000000..4015a8bf --- /dev/null +++ b/packages/api/drizzle/0014_Gemini_Integration.sql @@ -0,0 +1 @@ +ALTER TABLE `config` ADD `gemini_api_key` text; \ No newline at end of file diff --git a/packages/api/drizzle/meta/0014_snapshot.json b/packages/api/drizzle/meta/0014_snapshot.json new file mode 100644 index 00000000..b079efc4 --- /dev/null +++ b/packages/api/drizzle/meta/0014_snapshot.json @@ -0,0 +1,276 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "c148b92f-4dbc-4a31-887d-dfaebd4db615", + "prevId": "0acbefdc-659a-48ad-a4c1-a44ebca56c08", + "tables": { + "apps": { + "name": "apps", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "history": { + "name": "history", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'[]'" + }, + "history_version": { + "name": "history_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + } + }, + "indexes": { + "apps_external_id_unique": { + "name": "apps_external_id_unique", + "columns": [ + "external_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "config": { + "name": "config", + "columns": { + "base_dir": { + "name": "base_dir", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "default_language": { + "name": "default_language", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'typescript'" + }, + "openai_api_key": { + "name": "openai_api_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "anthropic_api_key": { + "name": "anthropic_api_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "xai_api_key": { + "name": "xai_api_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "gemini_api_key": { + "name": "gemini_api_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "enabled_analytics": { + "name": "enabled_analytics", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "srcbook_installation_id": { + "name": "srcbook_installation_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'gid1al6p9ibob8tb6qmmuokg94'" + }, + "ai_provider": { + "name": "ai_provider", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'openai'" + }, + "ai_model": { + "name": "ai_model", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'gpt-4o'" + }, + "ai_base_url": { + "name": "ai_base_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "subscription_email": { + "name": "subscription_email", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "secrets": { + "name": "secrets", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "secrets_name_unique": { + "name": "secrets_name_unique", + "columns": [ + "name" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "secrets_to_sessions": { + "name": "secrets_to_sessions", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "session_id": { + "name": "session_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "secret_id": { + "name": "secret_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "secrets_to_sessions_session_id_secret_id_unique": { + "name": "secrets_to_sessions_session_id_secret_id_unique", + "columns": [ + "session_id", + "secret_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "secrets_to_sessions_secret_id_secrets_id_fk": { + "name": "secrets_to_sessions_secret_id_secrets_id_fk", + "tableFrom": "secrets_to_sessions", + "tableTo": "secrets", + "columnsFrom": [ + "secret_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/packages/api/drizzle/meta/_journal.json b/packages/api/drizzle/meta/_journal.json index eafa07c0..fb21da73 100644 --- a/packages/api/drizzle/meta/_journal.json +++ b/packages/api/drizzle/meta/_journal.json @@ -99,6 +99,13 @@ "when": 1731347691803, "tag": "0013_add_x_ai", "breakpoints": true + }, + { + "idx": 14, + "version": "6", + "when": 1732197490638, + "tag": "0014_Gemini_Integration", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/shared/src/ai.mts b/packages/shared/src/ai.mts index 24676e15..c88d2e09 100644 --- a/packages/shared/src/ai.mts +++ b/packages/shared/src/ai.mts @@ -2,6 +2,7 @@ export const AiProvider = { OpenAI: 'openai', Anthropic: 'anthropic', XAI: 'Xai', + Gemini: 'Gemini', Custom: 'custom', } as const; @@ -12,6 +13,7 @@ export const defaultModels: Record = { [AiProvider.Anthropic]: 'claude-3-5-sonnet-latest', [AiProvider.Custom]: 'mistral-nemo', [AiProvider.XAI]: 'grok-beta', + [AiProvider.Gemini]: 'google-developer-ai', } as const; export function isValidProvider(provider: string): provider is AiProviderType { diff --git a/packages/web/src/components/use-settings.tsx b/packages/web/src/components/use-settings.tsx index 648ce0b7..c9e99992 100644 --- a/packages/web/src/components/use-settings.tsx +++ b/packages/web/src/components/use-settings.tsx @@ -35,6 +35,7 @@ export function SettingsProvider({ config, children }: ProviderPropsType) { (config.openaiKey && config.aiProvider === 'openai') || (config.anthropicKey && config.aiProvider === 'anthropic') || (config.xaiKey && config.aiProvider === 'Xai') || + (config.geminiKey && config.aiProvider === 'Gemini') || (config.aiProvider === 'custom' && !!config.aiBaseUrl) || false; diff --git a/packages/web/src/routes/settings.tsx b/packages/web/src/routes/settings.tsx index c552dfb7..8f3079c1 100644 --- a/packages/web/src/routes/settings.tsx +++ b/packages/web/src/routes/settings.tsx @@ -151,6 +151,13 @@ function AiInfoBanner() { ); + case 'Gemini': + return ( +
+

API key required

+
+ ); + case 'custom': return (
@@ -235,12 +242,14 @@ export function AiSettings({ saveButtonLabel }: AiSettingsProps) { openaiKey: configOpenaiKey, anthropicKey: configAnthropicKey, xaiKey: configXaiKey, + geminiKey: configGeminiKey, updateConfig: updateConfigContext, } = useSettings(); const [openaiKey, setOpenaiKey] = useState(configOpenaiKey ?? ''); const [anthropicKey, setAnthropicKey] = useState(configAnthropicKey ?? ''); const [xaiKey, setXaiKey] = useState(configXaiKey ?? ''); + const [geminiKey, setGeminiKey] = useState(configGeminiKey ?? ''); const [model, setModel] = useState(aiModel); const [baseUrl, setBaseUrl] = useState(aiBaseUrl || ''); @@ -268,6 +277,11 @@ export function AiSettings({ saveButtonLabel }: AiSettingsProps) { ((configXaiKey === null || configXaiKey === undefined) && xaiKey.length > 0) || model !== aiModel; + const geminiKeySaveEnabled = + (typeof configGeminiKey === 'string' && geminiKey !== configXaiKey) || + ((configGeminiKey === null || configGeminiKey === undefined) && geminiKey.length > 0) || + model !== aiModel; + const customModelSaveEnabled = (typeof aiBaseUrl === 'string' && baseUrl !== aiBaseUrl) || ((aiBaseUrl === null || aiBaseUrl === undefined) && baseUrl.length > 0) || @@ -285,6 +299,7 @@ export function AiSettings({ saveButtonLabel }: AiSettingsProps) { openai anthropic Xai + Gemini custom @@ -356,6 +371,25 @@ export function AiSettings({ saveButtonLabel }: AiSettingsProps) {
)} + {aiProvider === 'Gemini' && ( +
+ setGeminiKey(e.target.value)} + /> + +
+ )} + {aiProvider === 'custom' && (

diff --git a/packages/web/src/types.ts b/packages/web/src/types.ts index c84a55f5..19c6d7a5 100644 --- a/packages/web/src/types.ts +++ b/packages/web/src/types.ts @@ -13,6 +13,7 @@ export type SettingsType = { openaiKey?: string | null; anthropicKey?: string | null; xaiKey?: string | null; + geminiKey?: string | null; aiProvider: AiProviderType; aiModel: string; aiBaseUrl?: string | null; From c6d3ac82968189e34c5aa907aba3cdeef30a4be0 Mon Sep 17 00:00:00 2001 From: Aakash Amod Rajput Date: Thu, 21 Nov 2024 20:12:48 +0530 Subject: [PATCH 2/5] Removed Linting issue --- packages/api/ai/config.mts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/api/ai/config.mts b/packages/api/ai/config.mts index 0f05d4d9..240d25d5 100644 --- a/packages/api/ai/config.mts +++ b/packages/api/ai/config.mts @@ -36,7 +36,8 @@ export async function getModel(): Promise { } const gemini = createOpenAI({ compatibility: 'compatible', - baseURL: 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=', + baseURL: + 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=', apiKey: config.geminiKey, }); return gemini(model); From 44ac9b0fb5940b0f0c5a2ba5fdddf73db2af2e0f Mon Sep 17 00:00:00 2001 From: Aakash Amod Rajput Date: Fri, 22 Nov 2024 02:51:29 +0530 Subject: [PATCH 3/5] Gemini Integrated Successfully --- package.json | 5 ++-- packages/api/ai/config.mts | 10 ++----- packages/api/package.json | 1 + packages/shared/package.json | 1 + packages/shared/src/ai.mts | 2 +- pnpm-lock.yaml | 53 ++++++++++++++++++++++++++++++++++++ 6 files changed, 62 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 080ab5a3..5ed4963c 100644 --- a/package.json +++ b/package.json @@ -20,11 +20,12 @@ "@changesets/cli": "^2.27.8", "@srcbook/configs": "workspace:^", "@types/node": "^20.14.2", + "eslint": "^8.57.0", "prettier": "^3.3.3", - "typescript": "5.6.2", - "eslint": "^8.57.0" + "typescript": "5.6.2" }, "dependencies": { + "@ai-sdk/google": "^1.0.1", "turbo": "^2.1.1" }, "packageManager": "pnpm@9.12.1", diff --git a/packages/api/ai/config.mts b/packages/api/ai/config.mts index 240d25d5..54c833a1 100644 --- a/packages/api/ai/config.mts +++ b/packages/api/ai/config.mts @@ -3,6 +3,7 @@ import { createAnthropic } from '@ai-sdk/anthropic'; import { getConfig } from '../config.mjs'; import type { LanguageModel } from 'ai'; import { getDefaultModel, type AiProviderType } from '@srcbook/shared'; +import { createGoogleGenerativeAI } from '@ai-sdk/google'; /** * Get the correct client and model configuration. @@ -34,13 +35,8 @@ export async function getModel(): Promise { if (!config.geminiKey) { throw new Error('Gemini API key is not set'); } - const gemini = createOpenAI({ - compatibility: 'compatible', - baseURL: - 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=', - apiKey: config.geminiKey, - }); - return gemini(model); + const google = createGoogleGenerativeAI({apiKey: config.geminiKey}) + return google(model); case 'Xai': if (!config.xaiKey) { diff --git a/packages/api/package.json b/packages/api/package.json index 714c6d07..eda5fb17 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -23,6 +23,7 @@ }, "dependencies": { "@ai-sdk/anthropic": "catalog:", + "@ai-sdk/google": "^1.0.1", "@ai-sdk/openai": "catalog:", "@srcbook/shared": "workspace:^", "ai": "^3.3.33", diff --git a/packages/shared/package.json b/packages/shared/package.json index 2f9a8204..c768f01f 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -12,6 +12,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { + "@ai-sdk/google": "1.0.1", "@scure/base": "^1.1.8", "zod": "catalog:" }, diff --git a/packages/shared/src/ai.mts b/packages/shared/src/ai.mts index c88d2e09..b6753f5a 100644 --- a/packages/shared/src/ai.mts +++ b/packages/shared/src/ai.mts @@ -13,7 +13,7 @@ export const defaultModels: Record = { [AiProvider.Anthropic]: 'claude-3-5-sonnet-latest', [AiProvider.Custom]: 'mistral-nemo', [AiProvider.XAI]: 'grok-beta', - [AiProvider.Gemini]: 'google-developer-ai', + [AiProvider.Gemini]: 'gemini-1.5-pro-latest', } as const; export function isValidProvider(provider: string): provider is AiProviderType { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f70e944a..5d1f04f9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,6 +26,9 @@ importers: .: dependencies: + '@ai-sdk/google': + specifier: ^1.0.1 + version: 1.0.1(zod@3.23.8) turbo: specifier: ^2.1.1 version: 2.1.1 @@ -54,6 +57,9 @@ importers: '@ai-sdk/anthropic': specifier: 'catalog:' version: 0.0.49(zod@3.23.8) + '@ai-sdk/google': + specifier: ^1.0.1 + version: 1.0.1(zod@3.23.8) '@ai-sdk/openai': specifier: 'catalog:' version: 0.0.58(zod@3.23.8) @@ -286,6 +292,9 @@ importers: packages/shared: dependencies: + '@ai-sdk/google': + specifier: 1.0.1 + version: 1.0.1(zod@3.23.8) '@scure/base': specifier: ^1.1.8 version: 1.1.8 @@ -490,6 +499,12 @@ packages: peerDependencies: zod: ^3.0.0 + '@ai-sdk/google@1.0.1': + resolution: {integrity: sha512-RnUnx3TjyegrURFXiWWqcpeNiMlfQfotSM198Wdl2XiD+kaqEBzcBB/imHMlqY5VJdnXi0DCleFlcMQldK5SCA==} + engines: {node: '>=18'} + peerDependencies: + zod: ^3.0.0 + '@ai-sdk/openai@0.0.58': resolution: {integrity: sha512-Eao1L0vzfXdymgvc5FDHwV2g2A7BCWml1cShNA+wliY1RL7NNREGcuQvBDNoggB9PM24fawzZyk0ZJ5jlo9Q0w==} engines: {node: '>=18'} @@ -505,10 +520,23 @@ packages: zod: optional: true + '@ai-sdk/provider-utils@2.0.1': + resolution: {integrity: sha512-TNg7rPhRtETB2Z9F0JpOvpGii9Fs8EWM8nYy1jEkvSXkrPJ6b/9zVnDdaJsmLFDyrMbOsPJlkblYtmYEQou36w==} + engines: {node: '>=18'} + peerDependencies: + zod: ^3.0.0 + peerDependenciesMeta: + zod: + optional: true + '@ai-sdk/provider@0.0.23': resolution: {integrity: sha512-oAc49O5+xypVrKM7EUU5P/Y4DUL4JZUWVxhejoAVOTOl3WZUEWsMbP3QZR+TrimQIsS0WR/n9UuF6U0jPdp0tQ==} engines: {node: '>=18'} + '@ai-sdk/provider@1.0.0': + resolution: {integrity: sha512-Sj29AzooJ7SYvhPd+AAWt/E7j63E9+AzRnoMHUaJPRYzOd/WDrVNxxv85prF9gDcQ7XPVlSk9j6oAZV9/DXYpA==} + engines: {node: '>=18'} + '@ai-sdk/react@0.0.55': resolution: {integrity: sha512-9fUUEEEoH01M6ZhvyZ/2v0DI6tiYnSldBg6RaKoy+qx2tSeKvOpFNZhT/iOvQ7oqAyyp0Ocg5Rj7L/jcLXSMxw==} engines: {node: '>=18'} @@ -3441,6 +3469,10 @@ packages: resolution: {integrity: sha512-v0eOBUbiaFojBu2s2NPBfYUoRR9GjcDNvCXVaqEf5vVfpIAh9f8RCo4vXTP8c63QRKCFwoLpMpTdPwwhEKVgzA==} engines: {node: '>=14.18'} + eventsource-parser@3.0.0: + resolution: {integrity: sha512-T1C0XCUimhxVQzW4zFipdx0SficT651NnkR0ZSH3yQwh+mFMdLfgjABVi4YtMTtaL4s168593DaoaRLMqryavA==} + engines: {node: '>=18.0.0'} + execa@8.0.1: resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} engines: {node: '>=16.17'} @@ -5527,6 +5559,12 @@ snapshots: '@ai-sdk/provider-utils': 1.0.18(zod@3.23.8) zod: 3.23.8 + '@ai-sdk/google@1.0.1(zod@3.23.8)': + dependencies: + '@ai-sdk/provider': 1.0.0 + '@ai-sdk/provider-utils': 2.0.1(zod@3.23.8) + zod: 3.23.8 + '@ai-sdk/openai@0.0.58(zod@3.23.8)': dependencies: '@ai-sdk/provider': 0.0.23 @@ -5542,10 +5580,23 @@ snapshots: optionalDependencies: zod: 3.23.8 + '@ai-sdk/provider-utils@2.0.1(zod@3.23.8)': + dependencies: + '@ai-sdk/provider': 1.0.0 + eventsource-parser: 3.0.0 + nanoid: 3.3.7 + secure-json-parse: 2.7.0 + optionalDependencies: + zod: 3.23.8 + '@ai-sdk/provider@0.0.23': dependencies: json-schema: 0.4.0 + '@ai-sdk/provider@1.0.0': + dependencies: + json-schema: 0.4.0 + '@ai-sdk/react@0.0.55(react@18.3.1)(zod@3.23.8)': dependencies: '@ai-sdk/provider-utils': 1.0.18(zod@3.23.8) @@ -8692,6 +8743,8 @@ snapshots: eventsource-parser@1.1.2: {} + eventsource-parser@3.0.0: {} + execa@8.0.1: dependencies: cross-spawn: 7.0.3 From 83dacd4212e4ea78bea279debeb6dd1e81adc7ea Mon Sep 17 00:00:00 2001 From: Aakash Amod Rajput Date: Fri, 22 Nov 2024 11:26:44 +0530 Subject: [PATCH 4/5] Removed type error for Ci/Cd Pipeline --- package.json | 1 - packages/api/ai/config.mts | 2 +- packages/api/package.json | 5 +- pnpm-lock.yaml | 270 +++++++++++++++++++++++++++++++++---- 4 files changed, 249 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index 5ed4963c..70edd78f 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "typescript": "5.6.2" }, "dependencies": { - "@ai-sdk/google": "^1.0.1", "turbo": "^2.1.1" }, "packageManager": "pnpm@9.12.1", diff --git a/packages/api/ai/config.mts b/packages/api/ai/config.mts index 54c833a1..8638a7ae 100644 --- a/packages/api/ai/config.mts +++ b/packages/api/ai/config.mts @@ -36,7 +36,7 @@ export async function getModel(): Promise { throw new Error('Gemini API key is not set'); } const google = createGoogleGenerativeAI({apiKey: config.geminiKey}) - return google(model); + return google(model) as LanguageModel; case 'Xai': if (!config.xaiKey) { diff --git a/packages/api/package.json b/packages/api/package.json index eda5fb17..b915e588 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -23,10 +23,11 @@ }, "dependencies": { "@ai-sdk/anthropic": "catalog:", - "@ai-sdk/google": "^1.0.1", + "@ai-sdk/google": "^1.0.3", "@ai-sdk/openai": "catalog:", + "@ai-sdk/provider": "^1.0.1", "@srcbook/shared": "workspace:^", - "ai": "^3.3.33", + "ai": "^3.4.33", "archiver": "^7.0.1", "better-sqlite3": "^11.3.0", "cors": "^2.8.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5d1f04f9..47419cec 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,9 +26,6 @@ importers: .: dependencies: - '@ai-sdk/google': - specifier: ^1.0.1 - version: 1.0.1(zod@3.23.8) turbo: specifier: ^2.1.1 version: 2.1.1 @@ -58,17 +55,20 @@ importers: specifier: 'catalog:' version: 0.0.49(zod@3.23.8) '@ai-sdk/google': - specifier: ^1.0.1 - version: 1.0.1(zod@3.23.8) + specifier: ^1.0.3 + version: 1.0.3(zod@3.23.8) '@ai-sdk/openai': specifier: 'catalog:' version: 0.0.58(zod@3.23.8) + '@ai-sdk/provider': + specifier: ^1.0.1 + version: 1.0.1 '@srcbook/shared': specifier: workspace:^ version: link:../shared ai: - specifier: ^3.3.33 - version: 3.3.33(openai@4.52.3)(react@18.3.1)(sswr@2.1.0(svelte@4.2.18))(svelte@4.2.18)(vue@3.4.31(typescript@5.6.2))(zod@3.23.8) + specifier: ^3.4.33 + version: 3.4.33(openai@4.52.3)(react@18.3.1)(sswr@2.1.0(svelte@4.2.18))(svelte@4.2.18)(vue@3.4.31(typescript@5.6.2))(zod@3.23.8) archiver: specifier: ^7.0.1 version: 7.0.1 @@ -505,6 +505,12 @@ packages: peerDependencies: zod: ^3.0.0 + '@ai-sdk/google@1.0.3': + resolution: {integrity: sha512-vxHQw2ogNUMgiVtflDUh+8izc1H0DUo0GusT+YHG/2qdcoY4M1GxCD6pB1osNDeIxfjzToA5HfqdatjaRiYR9g==} + engines: {node: '>=18'} + peerDependencies: + zod: ^3.0.0 + '@ai-sdk/openai@0.0.58': resolution: {integrity: sha512-Eao1L0vzfXdymgvc5FDHwV2g2A7BCWml1cShNA+wliY1RL7NNREGcuQvBDNoggB9PM24fawzZyk0ZJ5jlo9Q0w==} engines: {node: '>=18'} @@ -520,6 +526,15 @@ packages: zod: optional: true + '@ai-sdk/provider-utils@1.0.22': + resolution: {integrity: sha512-YHK2rpj++wnLVc9vPGzGFP3Pjeld2MwhKinetA0zKXOoHAT/Jit5O8kZsxcSlJPu9wvcGT1UGZEjZrtO7PfFOQ==} + engines: {node: '>=18'} + peerDependencies: + zod: ^3.0.0 + peerDependenciesMeta: + zod: + optional: true + '@ai-sdk/provider-utils@2.0.1': resolution: {integrity: sha512-TNg7rPhRtETB2Z9F0JpOvpGii9Fs8EWM8nYy1jEkvSXkrPJ6b/9zVnDdaJsmLFDyrMbOsPJlkblYtmYEQou36w==} engines: {node: '>=18'} @@ -529,14 +544,31 @@ packages: zod: optional: true + '@ai-sdk/provider-utils@2.0.2': + resolution: {integrity: sha512-IAvhKhdlXqiSmvx/D4uNlFYCl8dWT+M9K+IuEcSgnE2Aj27GWu8sDIpAf4r4Voc+wOUkOECVKQhFo8g9pozdjA==} + engines: {node: '>=18'} + peerDependencies: + zod: ^3.0.0 + peerDependenciesMeta: + zod: + optional: true + '@ai-sdk/provider@0.0.23': resolution: {integrity: sha512-oAc49O5+xypVrKM7EUU5P/Y4DUL4JZUWVxhejoAVOTOl3WZUEWsMbP3QZR+TrimQIsS0WR/n9UuF6U0jPdp0tQ==} engines: {node: '>=18'} + '@ai-sdk/provider@0.0.26': + resolution: {integrity: sha512-dQkfBDs2lTYpKM8389oopPdQgIU007GQyCbuPPrV+K6MtSII3HBfE0stUIMXUb44L+LK1t6GXPP7wjSzjO6uKg==} + engines: {node: '>=18'} + '@ai-sdk/provider@1.0.0': resolution: {integrity: sha512-Sj29AzooJ7SYvhPd+AAWt/E7j63E9+AzRnoMHUaJPRYzOd/WDrVNxxv85prF9gDcQ7XPVlSk9j6oAZV9/DXYpA==} engines: {node: '>=18'} + '@ai-sdk/provider@1.0.1': + resolution: {integrity: sha512-mV+3iNDkzUsZ0pR2jG0sVzU6xtQY5DtSCBy3JFycLp6PwjyLw/iodfL3MwdmMCRJWgs3dadcHejRnMvF9nGTBg==} + engines: {node: '>=18'} + '@ai-sdk/react@0.0.55': resolution: {integrity: sha512-9fUUEEEoH01M6ZhvyZ/2v0DI6tiYnSldBg6RaKoy+qx2tSeKvOpFNZhT/iOvQ7oqAyyp0Ocg5Rj7L/jcLXSMxw==} engines: {node: '>=18'} @@ -549,6 +581,18 @@ packages: zod: optional: true + '@ai-sdk/react@0.0.70': + resolution: {integrity: sha512-GnwbtjW4/4z7MleLiW+TOZC2M29eCg1tOUpuEiYFMmFNZK8mkrqM0PFZMo6UsYeUYMWqEOOcPOU9OQVJMJh7IQ==} + engines: {node: '>=18'} + peerDependencies: + react: ^18 || ^19 || ^19.0.0-rc + zod: ^3.0.0 + peerDependenciesMeta: + react: + optional: true + zod: + optional: true + '@ai-sdk/solid@0.0.44': resolution: {integrity: sha512-3kMhxalepc78jWr2Qg1BAHbY04JKYxp8wRu3TACrRUdokxzwD5sbZYtTb7vu9tw2wx78rfu0DH44CESFWpSfZg==} engines: {node: '>=18'} @@ -558,6 +602,15 @@ packages: solid-js: optional: true + '@ai-sdk/solid@0.0.54': + resolution: {integrity: sha512-96KWTVK+opdFeRubqrgaJXoNiDP89gNxFRWUp0PJOotZW816AbhUf4EnDjBjXTLjXL1n0h8tGSE9sZsRkj9wQQ==} + engines: {node: '>=18'} + peerDependencies: + solid-js: ^1.7.7 + peerDependenciesMeta: + solid-js: + optional: true + '@ai-sdk/svelte@0.0.46': resolution: {integrity: sha512-cokqS91vQkpqiRgf8xKwOONFb/RwkIbRg9jYVRb+z5NR9OsWXKMEfoCAf8+VgURfVbp8nqA+ddRXvtgYCwqQjQ==} engines: {node: '>=18'} @@ -567,6 +620,15 @@ packages: svelte: optional: true + '@ai-sdk/svelte@0.0.57': + resolution: {integrity: sha512-SyF9ItIR9ALP9yDNAD+2/5Vl1IT6kchgyDH8xkmhysfJI6WrvJbtO1wdQ0nylvPLcsPoYu+cAlz1krU4lFHcYw==} + engines: {node: '>=18'} + peerDependencies: + svelte: ^3.0.0 || ^4.0.0 || ^5.0.0 + peerDependenciesMeta: + svelte: + optional: true + '@ai-sdk/ui-utils@0.0.41': resolution: {integrity: sha512-I0trJKWxVG8hXeG0MvKqLG54fZjdeGjXvcVZocaSnWMBhl9lpTQxrqAR6ZsQMFDXs5DbvXoKtQs488qu2Bzaiw==} engines: {node: '>=18'} @@ -576,6 +638,15 @@ packages: zod: optional: true + '@ai-sdk/ui-utils@0.0.50': + resolution: {integrity: sha512-Z5QYJVW+5XpSaJ4jYCCAVG7zIAuKOOdikhgpksneNmKvx61ACFaf98pmOd+xnjahl0pIlc/QIe6O4yVaJ1sEaw==} + engines: {node: '>=18'} + peerDependencies: + zod: ^3.0.0 + peerDependenciesMeta: + zod: + optional: true + '@ai-sdk/vue@0.0.46': resolution: {integrity: sha512-H366ydskPbZP8uRs4sm3SAi97P3JVTRI5Q8xYTI6uTaY4UFBA6aOWdDxniYZNa67ebemfe11m7ksX4wHW6Wl8g==} engines: {node: '>=18'} @@ -585,6 +656,15 @@ packages: vue: optional: true + '@ai-sdk/vue@0.0.59': + resolution: {integrity: sha512-+ofYlnqdc8c4F6tM0IKF0+7NagZRAiqBJpGDJ+6EYhDW8FHLUP/JFBgu32SjxSxC6IKFZxEnl68ZoP/Z38EMlw==} + engines: {node: '>=18'} + peerDependencies: + vue: ^3.3.4 + peerDependenciesMeta: + vue: + optional: true + '@alloc/quick-lru@5.2.0': resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==} engines: {node: '>=10'} @@ -2186,8 +2266,8 @@ packages: '@types/minimatch@3.0.5': resolution: {integrity: sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==} - '@types/node-fetch@2.6.11': - resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==} + '@types/node-fetch@2.6.12': + resolution: {integrity: sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==} '@types/node@12.20.55': resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} @@ -2438,6 +2518,27 @@ packages: zod: optional: true + ai@3.4.33: + resolution: {integrity: sha512-plBlrVZKwPoRTmM8+D1sJac9Bq8eaa2jiZlHLZIWekKWI1yMWYZvCCEezY9ASPwRhULYDJB2VhKOBUUeg3S5JQ==} + engines: {node: '>=18'} + peerDependencies: + openai: ^4.42.0 + react: ^18 || ^19 || ^19.0.0-rc + sswr: ^2.1.0 + svelte: ^3.0.0 || ^4.0.0 || ^5.0.0 + zod: ^3.0.0 + peerDependenciesMeta: + openai: + optional: true + react: + optional: true + sswr: + optional: true + svelte: + optional: true + zod: + optional: true + ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} @@ -3910,8 +4011,8 @@ packages: resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} engines: {node: '>=8'} - is-reference@3.0.2: - resolution: {integrity: sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==} + is-reference@3.0.3: + resolution: {integrity: sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==} is-regex@1.1.4: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} @@ -4140,8 +4241,8 @@ packages: magic-string@0.30.11: resolution: {integrity: sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==} - magic-string@0.30.12: - resolution: {integrity: sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==} + magic-string@0.30.13: + resolution: {integrity: sha512-8rYBO+MsWkgjDSOvLomYnzhdwEG51olQ4zL5KXnNJWV5MNmrb4rTZdrtkhxjnD/QyZUqR/Z/XDsUs/4ej2nx0g==} marked-react@2.0.0: resolution: {integrity: sha512-Mp5HqfONf/RDqFtA+6xw2EjKkSbA8/xNPwyJ8ewLy/q3v21lRsPA7h+HUndVAW/yEIoebvcyzzSDpbjzL/xjZg==} @@ -4551,8 +4652,8 @@ packages: resolution: {integrity: sha512-7KTLTdzdZZYscUc65XmjFiB73vBhBfbPztCYdUNvlaso9PrzjzcmjqBPR0lNGkcVlcO4BjiO5rK/qNz+XAen1Q==} engines: {node: ^10 || ^12 || >=14} - postcss@8.4.48: - resolution: {integrity: sha512-GCRK8F6+Dl7xYniR5a4FYbpBzU8XnZVeowqsQFYdcXuSbChgiks7qybSkbvnaeqv0G0B+dd9/jJgH8kkLDQeEA==} + postcss@8.4.49: + resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==} engines: {node: ^10 || ^12 || >=14} posthog-js@1.174.2: @@ -5125,6 +5226,10 @@ packages: thenify@3.3.1: resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + throttleit@2.1.0: + resolution: {integrity: sha512-nt6AMGKW1p/70DF/hGBdJB57B8Tspmbp5gfJ8ilhLnt7kkr2ye7hzD6NVG8GGErk2HWF34igrL2CXmNIkzKqKw==} + engines: {node: '>=18'} + tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} @@ -5548,6 +5653,11 @@ packages: peerDependencies: zod: ^3.23.3 + zod-to-json-schema@3.23.5: + resolution: {integrity: sha512-5wlSS0bXfF/BrL4jPAbz9da5hDlDptdEppYfe+x4eIJ7jioqKG9uUxOwPzqof09u/XeVdrgFu29lZi+8XNDJtA==} + peerDependencies: + zod: ^3.23.3 + zod@3.23.8: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} @@ -5565,6 +5675,12 @@ snapshots: '@ai-sdk/provider-utils': 2.0.1(zod@3.23.8) zod: 3.23.8 + '@ai-sdk/google@1.0.3(zod@3.23.8)': + dependencies: + '@ai-sdk/provider': 1.0.1 + '@ai-sdk/provider-utils': 2.0.2(zod@3.23.8) + zod: 3.23.8 + '@ai-sdk/openai@0.0.58(zod@3.23.8)': dependencies: '@ai-sdk/provider': 0.0.23 @@ -5580,6 +5696,15 @@ snapshots: optionalDependencies: zod: 3.23.8 + '@ai-sdk/provider-utils@1.0.22(zod@3.23.8)': + dependencies: + '@ai-sdk/provider': 0.0.26 + eventsource-parser: 1.1.2 + nanoid: 3.3.7 + secure-json-parse: 2.7.0 + optionalDependencies: + zod: 3.23.8 + '@ai-sdk/provider-utils@2.0.1(zod@3.23.8)': dependencies: '@ai-sdk/provider': 1.0.0 @@ -5589,14 +5714,31 @@ snapshots: optionalDependencies: zod: 3.23.8 + '@ai-sdk/provider-utils@2.0.2(zod@3.23.8)': + dependencies: + '@ai-sdk/provider': 1.0.1 + eventsource-parser: 3.0.0 + nanoid: 3.3.7 + secure-json-parse: 2.7.0 + optionalDependencies: + zod: 3.23.8 + '@ai-sdk/provider@0.0.23': dependencies: json-schema: 0.4.0 + '@ai-sdk/provider@0.0.26': + dependencies: + json-schema: 0.4.0 + '@ai-sdk/provider@1.0.0': dependencies: json-schema: 0.4.0 + '@ai-sdk/provider@1.0.1': + dependencies: + json-schema: 0.4.0 + '@ai-sdk/react@0.0.55(react@18.3.1)(zod@3.23.8)': dependencies: '@ai-sdk/provider-utils': 1.0.18(zod@3.23.8) @@ -5606,6 +5748,16 @@ snapshots: react: 18.3.1 zod: 3.23.8 + '@ai-sdk/react@0.0.70(react@18.3.1)(zod@3.23.8)': + dependencies: + '@ai-sdk/provider-utils': 1.0.22(zod@3.23.8) + '@ai-sdk/ui-utils': 0.0.50(zod@3.23.8) + swr: 2.2.5(react@18.3.1) + throttleit: 2.1.0 + optionalDependencies: + react: 18.3.1 + zod: 3.23.8 + '@ai-sdk/solid@0.0.44(zod@3.23.8)': dependencies: '@ai-sdk/provider-utils': 1.0.18(zod@3.23.8) @@ -5613,6 +5765,13 @@ snapshots: transitivePeerDependencies: - zod + '@ai-sdk/solid@0.0.54(zod@3.23.8)': + dependencies: + '@ai-sdk/provider-utils': 1.0.22(zod@3.23.8) + '@ai-sdk/ui-utils': 0.0.50(zod@3.23.8) + transitivePeerDependencies: + - zod + '@ai-sdk/svelte@0.0.46(svelte@4.2.18)(zod@3.23.8)': dependencies: '@ai-sdk/provider-utils': 1.0.18(zod@3.23.8) @@ -5623,6 +5782,16 @@ snapshots: transitivePeerDependencies: - zod + '@ai-sdk/svelte@0.0.57(svelte@4.2.18)(zod@3.23.8)': + dependencies: + '@ai-sdk/provider-utils': 1.0.22(zod@3.23.8) + '@ai-sdk/ui-utils': 0.0.50(zod@3.23.8) + sswr: 2.1.0(svelte@4.2.18) + optionalDependencies: + svelte: 4.2.18 + transitivePeerDependencies: + - zod + '@ai-sdk/ui-utils@0.0.41(zod@3.23.8)': dependencies: '@ai-sdk/provider': 0.0.23 @@ -5633,6 +5802,16 @@ snapshots: optionalDependencies: zod: 3.23.8 + '@ai-sdk/ui-utils@0.0.50(zod@3.23.8)': + dependencies: + '@ai-sdk/provider': 0.0.26 + '@ai-sdk/provider-utils': 1.0.22(zod@3.23.8) + json-schema: 0.4.0 + secure-json-parse: 2.7.0 + zod-to-json-schema: 3.23.5(zod@3.23.8) + optionalDependencies: + zod: 3.23.8 + '@ai-sdk/vue@0.0.46(vue@3.4.31(typescript@5.6.2))(zod@3.23.8)': dependencies: '@ai-sdk/provider-utils': 1.0.18(zod@3.23.8) @@ -5643,6 +5822,16 @@ snapshots: transitivePeerDependencies: - zod + '@ai-sdk/vue@0.0.59(vue@3.4.31(typescript@5.6.2))(zod@3.23.8)': + dependencies: + '@ai-sdk/provider-utils': 1.0.22(zod@3.23.8) + '@ai-sdk/ui-utils': 0.0.50(zod@3.23.8) + swrv: 1.0.4(vue@3.4.31(typescript@5.6.2)) + optionalDependencies: + vue: 3.4.31(typescript@5.6.2) + transitivePeerDependencies: + - zod + '@alloc/quick-lru@5.2.0': {} '@ampproject/remapping@2.3.0': @@ -7209,7 +7398,7 @@ snapshots: '@types/minimatch@3.0.5': {} - '@types/node-fetch@2.6.11': + '@types/node-fetch@2.6.12': dependencies: '@types/node': 22.5.4 form-data: 4.0.1 @@ -7458,8 +7647,8 @@ snapshots: '@vue/compiler-ssr': 3.4.31 '@vue/shared': 3.4.31 estree-walker: 2.0.2 - magic-string: 0.30.12 - postcss: 8.4.48 + magic-string: 0.30.13 + postcss: 8.4.49 source-map-js: 1.2.1 '@vue/compiler-sfc@3.5.4': @@ -7558,6 +7747,31 @@ snapshots: - solid-js - vue + ai@3.4.33(openai@4.52.3)(react@18.3.1)(sswr@2.1.0(svelte@4.2.18))(svelte@4.2.18)(vue@3.4.31(typescript@5.6.2))(zod@3.23.8): + dependencies: + '@ai-sdk/provider': 0.0.26 + '@ai-sdk/provider-utils': 1.0.22(zod@3.23.8) + '@ai-sdk/react': 0.0.70(react@18.3.1)(zod@3.23.8) + '@ai-sdk/solid': 0.0.54(zod@3.23.8) + '@ai-sdk/svelte': 0.0.57(svelte@4.2.18)(zod@3.23.8) + '@ai-sdk/ui-utils': 0.0.50(zod@3.23.8) + '@ai-sdk/vue': 0.0.59(vue@3.4.31(typescript@5.6.2))(zod@3.23.8) + '@opentelemetry/api': 1.9.0 + eventsource-parser: 1.1.2 + json-schema: 0.4.0 + jsondiffpatch: 0.6.0 + secure-json-parse: 2.7.0 + zod-to-json-schema: 3.23.5(zod@3.23.8) + optionalDependencies: + openai: 4.52.3 + react: 18.3.1 + sswr: 2.1.0(svelte@4.2.18) + svelte: 4.2.18 + zod: 3.23.8 + transitivePeerDependencies: + - solid-js + - vue + ajv@6.12.6: dependencies: fast-deep-equal: 3.1.3 @@ -9226,7 +9440,7 @@ snapshots: is-path-inside@3.0.3: {} - is-reference@3.0.2: + is-reference@3.0.3: dependencies: '@types/estree': 1.0.6 @@ -9439,7 +9653,7 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 - magic-string@0.30.12: + magic-string@0.30.13: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 @@ -9647,7 +9861,7 @@ snapshots: openai@4.52.3: dependencies: '@types/node': 18.19.64 - '@types/node-fetch': 2.6.11 + '@types/node-fetch': 2.6.12 abort-controller: 3.0.0 agentkeepalive: 4.5.0 form-data-encoder: 1.7.2 @@ -9748,7 +9962,7 @@ snapshots: dependencies: '@types/estree': 1.0.6 estree-walker: 3.0.3 - is-reference: 3.0.2 + is-reference: 3.0.3 picocolors@1.1.0: {} @@ -9818,7 +10032,7 @@ snapshots: picocolors: 1.1.0 source-map-js: 1.2.1 - postcss@8.4.48: + postcss@8.4.49: dependencies: nanoid: 3.3.7 picocolors: 1.1.1 @@ -10433,9 +10647,9 @@ snapshots: code-red: 1.0.4 css-tree: 2.3.1 estree-walker: 3.0.3 - is-reference: 3.0.2 + is-reference: 3.0.3 locate-character: 3.0.0 - magic-string: 0.30.12 + magic-string: 0.30.13 periscopic: 3.1.0 swr@2.2.5(react@18.3.1): @@ -10523,6 +10737,8 @@ snapshots: dependencies: any-promise: 1.3.0 + throttleit@2.1.0: {} + tinybench@2.9.0: {} tinyexec@0.3.0: {} @@ -10916,4 +11132,8 @@ snapshots: dependencies: zod: 3.23.8 + zod-to-json-schema@3.23.5(zod@3.23.8): + dependencies: + zod: 3.23.8 + zod@3.23.8: {} From fca611f6a14a18f5e3cef9292dcce5e48766020a Mon Sep 17 00:00:00 2001 From: Aakash Amod Rajput Date: Fri, 22 Nov 2024 11:29:20 +0530 Subject: [PATCH 5/5] Removed liniting issue --- packages/api/ai/config.mts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/api/ai/config.mts b/packages/api/ai/config.mts index 8638a7ae..faf25af9 100644 --- a/packages/api/ai/config.mts +++ b/packages/api/ai/config.mts @@ -35,7 +35,7 @@ export async function getModel(): Promise { if (!config.geminiKey) { throw new Error('Gemini API key is not set'); } - const google = createGoogleGenerativeAI({apiKey: config.geminiKey}) + const google = createGoogleGenerativeAI({ apiKey: config.geminiKey }); return google(model) as LanguageModel; case 'Xai':