UNPKG

@copilotkit/runtime

Version:

<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />

55 lines (54 loc) 1.88 kB
import "reflect-metadata"; import { CopilotRuntimeChatCompletionRequest, CopilotRuntimeChatCompletionResponse, CopilotServiceAdapter } from "../service-adapter.mjs"; import Openai from "openai"; import { LanguageModel } from "ai"; //#region src/service-adapters/openai/openai-adapter.d.ts interface OpenAIAdapterParams { /** * An optional OpenAI instance to use. If not provided, a new instance will be * created. */ openai?: Openai; /** * The model to use. */ model?: string; /** * Whether to disable parallel tool calls. * You can disable parallel tool calls to force the model to execute tool calls sequentially. * This is useful if you want to execute tool calls in a specific order so that the state changes * introduced by one tool call are visible to the next tool call. (i.e. new actions or readables) * * @default false */ disableParallelToolCalls?: boolean; /** * Whether to keep the role in system messages as "System". * By default, it is converted to "developer", which is used by newer OpenAI models * * @default false */ keepSystemRole?: boolean; /** * Optional maximum input token limit. Overrides the default model-based limit * used when trimming messages to fit the context window. */ maxInputTokens?: number; } declare class OpenAIAdapter implements CopilotServiceAdapter { model: string; provider: string; private disableParallelToolCalls; private _openai; private keepSystemRole; private maxInputTokens?; get openai(): Openai; get name(): string; constructor(params?: OpenAIAdapterParams); getLanguageModel(): LanguageModel; private ensureOpenAI; process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>; } //#endregion export { OpenAIAdapter, OpenAIAdapterParams }; //# sourceMappingURL=openai-adapter.d.mts.map