llmProvider
Variable: llmProvider
const llmProvider: {
onCompletionRequest: (callback: (req: LlmCompletionRequest) => void) => void;
onLoginRequest: (callback: (req: LlmLoginRequest) => void) => void;
onStreamRequest: (callback: (req: LlmStreamRequest) => void) => void;
register: (manifest: LlmProviderManifest) => Promise<LlmProviderRegisterResponse>;
sendChunk: (requestId: string, chunk: any) => void;
sendError: (requestId: string, error: string) => void;
sendReply: (requestId: string, response: any, success: boolean) => void;
unregister: (providerId: string) => Promise<LlmProviderResponse>;
};
Defined in: CodeBolt/packages/pluginSdk/src/modules/llmProvider.ts:166
Type Declaration
| Name | Type | Description | Defined in |
|---|---|---|---|
onCompletionRequest() | (callback: (req: LlmCompletionRequest) => void) => void | Subscribe to incoming non-streaming completion requests. Reply with sendReply(requestId, response) or sendError(requestId, error). | CodeBolt/packages/pluginSdk/src/modules/llmProvider.ts:195 |
onLoginRequest() | (callback: (req: LlmLoginRequest) => void) => void | Subscribe to incoming login requests (triggered by the UI login button). The plugin should run its authentication flow (e.g. OAuth) and then call sendReply(requestId, { authenticated: true }) or sendError(). | CodeBolt/packages/pluginSdk/src/modules/llmProvider.ts:215 |
onStreamRequest() | (callback: (req: LlmStreamRequest) => void) => void | Subscribe to incoming streaming completion requests. Stream tokens with sendChunk(requestId, chunk), then finalize with sendReply(requestId, finalResponse) or sendError(requestId, error). | CodeBolt/packages/pluginSdk/src/modules/llmProvider.ts:205 |
register() | (manifest: LlmProviderManifest) => Promise<LlmProviderRegisterResponse> | Register this plugin as a custom LLM provider on the server. After registration, the provider appears in the provider list and can be selected by users like any built-in provider. | CodeBolt/packages/pluginSdk/src/modules/llmProvider.ts:172 |
sendChunk() | (requestId: string, chunk: any) => void | Send a streaming chunk for an in-flight stream request. The chunk shape should match multillm StreamChunk (id, model, choices: [{delta: {content, ...}}]). | CodeBolt/packages/pluginSdk/src/modules/llmProvider.ts:225 |
sendError() | (requestId: string, error: string) => void | Send an error for a completion or stream request. | CodeBolt/packages/pluginSdk/src/modules/llmProvider.ts:252 |
sendReply() | (requestId: string, response: any, success: boolean) => void | Send the final reply for a completion or stream request. For non-streaming: this is the only message you send. For streaming: send after all chunks have been emitted. | CodeBolt/packages/pluginSdk/src/modules/llmProvider.ts:239 |
unregister() | (providerId: string) => Promise<LlmProviderResponse> | Unregister this plugin's provider. | CodeBolt/packages/pluginSdk/src/modules/llmProvider.ts:183 |