import { PropertyReference, LinkToCopilotCloud } from "@/components";
import { Tabs } from "nextra/components";
import { Callout } from "nextra/components";
Copilot Runtime adapter for the OpenAI Assistant API.
import { CopilotRuntime, OpenAIAssistantAdapter } from "@copilotkit/runtime";
import OpenAI from "openai";
const copilotKit = new CopilotRuntime();
const openai = new OpenAI({
organization: "<your-organization-id>",
apiKey: "<your-api-key>",
});
const llmAdapter = new OpenAIAssistantAdapter({
openai,
assistantId: "<your-assistant-id>",
codeInterpreterEnabled: true,
fileSearchEnabled: true,
});
return copilotKit.streamHttpServerResponse(req, res, llmAdapter);