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.21 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 Groq LLM instance export async function processJsonConfig(llmConfig) { const groq = await import('@langchain/groq'); // Use config value if available, otherwise use the environment variable const groqApiKey = llmConfig.apiKey || env.GROQ_API_KEY; return new groq.ChatGroq({ ...llmConfig, apiKey: groqApiKey, model: llmConfig.model || 'deepseek-r1-distill-llama-70b', }); } const jsonContent = `{ "llm": { "type": "groq", "model": "deepseek-r1-distill-llama-70b" } }`; 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 edit your ${configFileName} to configure model, ` + 'or define GROQ_API_KEY environment variable.'); } //# sourceMappingURL=groq.js.map