UNPKG

@nomyx/assistant

Version:

A powerful assistant library and cli for your AI projects. works with Vertex AI (Claude and Gemini)

32 lines (27 loc) 1.11 kB
import { AIProviderMiddleware, AIProviderPlugin } from '../../../types/provider'; import { OpenAIConfig } from './config'; export class MiddlewareManager { private middleware: AIProviderMiddleware[] = []; private plugins: AIProviderPlugin[] = []; use(middleware: AIProviderMiddleware): void { this.middleware.push(middleware); } registerPlugin(plugin: AIProviderPlugin, config: OpenAIConfig): void { this.plugins.push(plugin); plugin.initialize({ chat: async () => { throw new Error('Not implemented'); }, streamChat: async function* () { throw new Error('Not implemented'); }, getCapabilities: () => { throw new Error('Not implemented'); }, use: () => { throw new Error('Not implemented'); }, registerPlugin: () => { throw new Error('Not implemented'); }, convertToolSchema: () => { throw new Error('Not implemented'); }, convertToolCall: () => { throw new Error('Not implemented'); }, }); } getMiddleware(): AIProviderMiddleware[] { return this.middleware; } getPlugins(): AIProviderPlugin[] { return this.plugins; } }