UNPKG

@nomyx/assistant

Version:

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

23 lines (22 loc) 1.54 kB
import { ChatMessage, ChatOptions, ProviderResponse } from "../types/chat"; import { AIProviderMiddleware, AIProviderPlugin, ProviderCapabilities, IAIProvider } from "../types/provider"; import { GenericToolSchema, StandardizedToolCall } from "../types/tool"; export declare abstract class AIProvider implements IAIProvider { protected middleware: AIProviderMiddleware[]; protected plugins: AIProviderPlugin[]; abstract chat(messages: ChatMessage[], options: ChatOptions): Promise<ProviderResponse>; abstract streamChat(messages: ChatMessage[], options: ChatOptions): AsyncIterableIterator<ProviderResponse>; abstract convertToolSchema(schema: GenericToolSchema): unknown; abstract convertToolCall(call: unknown): StandardizedToolCall; abstract getCapabilities(): ProviderCapabilities; use(middleware: AIProviderMiddleware): void; registerPlugin(plugin: AIProviderPlugin): void; protected applyMiddleware(messages: ChatMessage[]): Promise<ChatMessage[]>; protected applyMiddlewareToResponse(response: ProviderResponse): Promise<ProviderResponse>; protected notifyPluginsBeforeChat(messages: ChatMessage[], options: ChatOptions): Promise<void>; protected notifyPluginsAfterChat(response: ProviderResponse): Promise<void>; protected notifyPluginsOnError(error: Error): Promise<void>; protected notifyPluginsOnStreamStart(): Promise<void>; protected notifyPluginsOnStreamChunk(chunk: ProviderResponse): Promise<void>; protected notifyPluginsOnStreamEnd(): Promise<void>; }