seraph-agent
Version:
An extremely lightweight, SRE autonomous AI agent for seamless integration with common observability tasks.
31 lines (30 loc) • 1.05 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AnthropicProvider = void 0;
const sdk_1 = __importDefault(require("@anthropic-ai/sdk"));
class AnthropicProvider {
anthropic;
model;
constructor(config) {
if (!config.apiKey) {
throw new Error('Anthropic API key not found in config.');
}
this.anthropic = new sdk_1.default({ apiKey: config.apiKey });
this.model = config.llm?.model || 'claude-3-opus-20240229';
}
async generate(prompt) {
const response = await this.anthropic.messages.create({
model: this.model,
max_tokens: 1024,
messages: [{ role: 'user', content: prompt }],
});
if (response.content[0].type === 'text') {
return response.content[0].text;
}
return '';
}
}
exports.AnthropicProvider = AnthropicProvider;