UNPKG

aiwrapper

Version:

A Universal AI Wrapper for JavaScript & TypeScript

63 lines (62 loc) 3.25 kB
import { ModelCollection } from 'aimodels'; import { OpenAILang } from "./openai/openai-lang.ts"; import { OpenAILangOptions } from "./openai/responses/openai-responses-lang.ts"; import { AnthropicLang, AnthropicLangOptions } from "./anthropic/anthropic-lang.ts"; import { OllamaLang, OllamaLangOptions } from "./ollama/ollama-lang.ts"; import { GroqLang, GroqLangOptions } from "./groq/groq-lang.ts"; import { DeepSeekLang, DeepSeekLangOptions } from "./deepseek/deepseek-lang.ts"; import { XAILang, XAILangOptions } from "./xai/xai-lang.ts"; import { GoogleLang, GoogleLangOptions } from "./google/google-lang.ts"; import { CohereLang, CohereLangOptions } from "./cohere/cohere-lang.ts"; import { OpenRouterLang, OpenRouterLangOptions } from "./openrouter/openrouter-lang.ts"; import { MistralLang, MistralLangOptions } from "./mistral/mistral-lang.ts"; import { OpenAIChatCompletionsLang } from "./openai/openai-chat-completions-lang.ts"; import { MockOpenAILikeLang, MockOpenAILikeOptions } from "./mock/mock-openai-like-lang.ts"; import { MockResponseStreamLang, MockResponseStreamOptions } from "./mock/mock-response-stream-lang.ts"; /** * Lang is a factory class for using language models from different providers. */ export declare abstract class Lang { /** Get all language models */ static get models(): ModelCollection; /** Create an OpenAI provider instance */ static openai(options: OpenAILangOptions): OpenAILang; /** Create an Anthropic provider instance */ static anthropic(options: AnthropicLangOptions): AnthropicLang; /** Create an Ollama provider instance */ static ollama(options: OllamaLangOptions): OllamaLang; /** Create a Groq provider instance */ static groq(options: GroqLangOptions): GroqLang; /** Create a DeepSeek provider instance */ static deepseek(options: DeepSeekLangOptions): DeepSeekLang; /** Create an xAI provider instance */ static xai(options: XAILangOptions): XAILang; /** Create a Google provider instance */ static google(options: GoogleLangOptions): GoogleLang; /** Create a Cohere provider instance */ static cohere(options: CohereLangOptions): CohereLang; /** Create an OpenRouter provider instance */ static openrouter(options: OpenRouterLangOptions): OpenRouterLang; /** Create a Mistral provider instance */ static mistral(options: MistralLangOptions): MistralLang; /** * Creates an instance for custom OpenAI-compatible APIs * @param options Configuration options for the custom API * @returns A new OpenAILikeLang instance */ static openaiLike(options: { apiKey?: string; model: string; baseURL: string; systemPrompt?: string; maxTokens?: number; headers?: Record<string, string>; bodyProperties?: Record<string, unknown>; }): OpenAIChatCompletionsLang; /** Create a Mock OpenAI-like provider (no network) */ static mockOpenAI(options?: MockOpenAILikeOptions): MockOpenAILikeLang; /** Create a lightweight streaming mock provider */ static mockResponseStream(options?: MockResponseStreamOptions): MockResponseStreamLang; static [Symbol.iterator](): Iterator<any>; static [key: string]: any; }