UNPKG

gaunt-sloth-assistant

Version:

[![Tests and Lint](https://github.com/Galvanized-Pukeko/gaunt-sloth-assistant/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/Galvanized-Pukeko/gaunt-sloth-assistant/actions/workflows/unit-tests.yml) [![Integration Tests](https://github.co

30 lines 1.25 kB
import { displayWarning } from '#src/utils/consoleUtils.js'; import { env } from '#src/utils/systemUtils.js'; import { writeFileIfNotExistsWithMessages } from '#src/utils/fileUtils.js'; // Function to process JSON config and create Google GenAI LLM instance export async function processJsonConfig(llmConfig) { const gemini = await import('@langchain/google-genai'); // Use config value if available, otherwise use the environment variable const googleApiKey = llmConfig.apiKey || env.GOOGLE_API_KEY; return new gemini.ChatGoogleGenerativeAI({ ...llmConfig, apiKey: googleApiKey, model: llmConfig.model || 'gemini-2.5-pro', }); } const jsonContent = `{ "llm": { "type": "google-genai", "model": "gemini-2.5-pro" } }`; export function init(configFileName) { // Determine which content to use based on file extension if (!configFileName.endsWith('.json')) { throw new Error('Only JSON config is supported.'); } writeFileIfNotExistsWithMessages(configFileName, jsonContent); displayWarning(`You need to update your ${configFileName} to add your Google GenAI API key, ` + 'or define GOOGLE_API_KEY environment variable.'); } //# sourceMappingURL=google-genai.js.map