GoogleGenerativeAIAdapter
Copilot Runtime adapter for Google Generative AI (e.g. Gemini).
Example
import { CopilotRuntime, GoogleGenerativeAIAdapter } from "@copilotkit/runtime";
const { GoogleGenerativeAI } = require("@google/generative-ai");
const genAI = new GoogleGenerativeAI(process.env["GOOGLE_API_KEY"]);
const copilotKit = new CopilotRuntime();
const model = genAI.getGenerativeModel({
model: "gemini-pro"
});
const serviceAdapter = new GoogleGenerativeAIAdapter({ model });
return copilotKit.streamHttpServerResponse(req, res, serviceAdapter);
Constructor Parameters
modelGenerativeModel
A custom Google Generative AI model to use.