UNPKG

local-agent

Version:

A CLI agentic system for orchestrating tools and memory with per-folder scoping

40 lines 1.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * OpenAI provider implementation. */ class OpenAIProvider { apiKey = null; /** * Creates and returns an OpenAI model instance. * @param modelName The OpenAI model name (e.g., "gpt-4o") * @returns An OpenAI model instance */ getModel(modelName) { // Dynamic import to avoid loading the module until needed const { openai } = require('@ai-sdk/openai'); return openai(modelName); } /** * Indicates if this provider requires an API key. * For OpenAI, an API key is required but can come from environment variables. */ requiresApiKey() { return false; // OpenAI can read from OPENAI_API_KEY env var } /** * Initializes the provider with an API key. * @param keys Object containing API keys */ initialize(keys) { if (keys.openai) { this.apiKey = keys.openai; // Set environment variable if not already set if (!process.env.OPENAI_API_KEY) { process.env.OPENAI_API_KEY = this.apiKey; } } } } exports.default = OpenAIProvider; //# sourceMappingURL=openai-provider.js.map