UNPKG

@nomyx/assistant

Version:

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

21 lines (20 loc) 1.35 kB
import { ChatMessage, ChatOptions, ProviderResponse } from '../../types/chat'; import { ProviderCapabilities, IAIProvider, AIProviderMiddleware, AIProviderPlugin } from '../../types/provider'; import { Tool, GenericToolSchema, StandardizedToolCall } from '../../types/tool'; import { ILogger } from '../../types/common'; export declare abstract class BaseProvider implements IAIProvider { protected logger: ILogger; protected middleware: AIProviderMiddleware[]; protected plugins: AIProviderPlugin[]; constructor(logger: ILogger); abstract chat(messages: ChatMessage[], options: ChatOptions, tools?: Tool[]): Promise<ProviderResponse>; abstract streamChat(messages: ChatMessage[], options: ChatOptions, tools?: Tool[]): AsyncIterableIterator<ProviderResponse>; abstract getCapabilities(): ProviderCapabilities; abstract convertToolSchema(schema: GenericToolSchema): any; abstract convertToolCall(call: any): StandardizedToolCall; use(middleware: AIProviderMiddleware): void; registerPlugin(plugin: AIProviderPlugin): void; protected applyMiddleware(messages: ChatMessage[]): Promise<ChatMessage[]>; protected applyMiddlewareToResponse(response: ProviderResponse): Promise<ProviderResponse>; protected applyMiddlewareToToolCalls(toolCalls: StandardizedToolCall[]): Promise<StandardizedToolCall[]>; }