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.24 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 DeepSeek LLM instance export async function processJsonConfig(llmConfig) { const deepseek = await import('@langchain/deepseek'); // Use config apiKey if available, otherwise use the environment variable const deepseekApiKey = llmConfig.apiKey || env.DEEPSEEK_API_KEY; return new deepseek.ChatDeepSeek({ ...llmConfig, apiKey: deepseekApiKey, model: llmConfig.model || 'deepseek-reasoner', }); } const jsonContent = `{ "llm": { "type": "deepseek", "model": "deepseek-reasoner" } }`; 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 DeepSeek API key, ` + 'or define DEEPSEEK_API_KEY environment variable.'); } //# sourceMappingURL=deepseek.js.map