tess-core-engine
Version:
Tess Core: framework cognitivo modular con API Fluent
15 lines (14 loc) • 479 B
JavaScript
const { GoogleGenerativeAI } = require('@google/generative-ai');
module.exports = function createGeminiAdapter({ apiKey, model='gemini-pro' }) {
const ai = new GoogleGenerativeAI(apiKey);
return {
name: 'gemini',
match: () => true,
execute: async ctx => {
const m = ai.getGenerativeModel({ model });
const r = await m.generateContent(ctx.message);
const resp = await r.response;
return { output: resp.text() };
}
};
};