AI Provider Plugins
AI provider plugins connect the Ever Works platform to large language model APIs for content generation, structured output, embeddings, and conversational AI. All AI providers implement the IAiProviderPlugin interface and extend the BaseAiProvider abstract class.
Architecture
Every AI provider plugin follows the same pattern:
- Extends
BaseAiProviderfrom@ever-works/plugin/abstract - Uses
AiOperationsfrom@ever-works/plugin/ai(wraps LangChain for all providers) - Declares the
ai-providercapability - Defines settings via JSON Schema with
x-secret,x-widget, andx-scopeextensions
import { BaseAiProvider } from '@ever-works/plugin/abstract';
import { AiOperations } from '@ever-works/plugin/ai';
export class MyProviderPlugin extends BaseAiProvider {
readonly id = 'my-provider';
readonly name = 'My Provider';
readonly version = '1.0.0';
readonly providerType = 'my-provider';
readonly providerName = 'My Provider';
async onLoad(context: PluginContext): Promise<void> {
await super.onLoad(context);
this.aiOps = new AiOperations({
apiKey: '',
model: 'default-model',
temperature: 0.7,
providerType: 'my-provider'
});
}
async createChatCompletion(options: ChatCompletionOptions) {
return this.aiOps!.createChatCompletion(options, this.resolveConfig(options.settings));
}
async listModels(settings?: PluginSettings) {
return this.aiOps!.listModels(this.resolveConfig(settings));
}
protected getDefaultModelId(): string {
return 'default-model';
}
}