UNPKG

@naktibalda/jorel

Version:

The easiest way to use LLMs, including streams, images, documents, tools and various agent scenarios.

29 lines (28 loc) 1.49 kB
import { Content, HarmBlockThreshold, HarmCategory, VertexAI } from "@google-cloud/vertexai"; import { LlmCoreProvider, LlmGenerationConfig, LlmMessage, LlmResponse, LlmStreamResponse, LlmStreamResponseChunk, LlmStreamResponseWithToolCalls } from "../../providers"; export { HarmBlockThreshold as VertexAiHarmBlockThreshold, HarmCategory as VertexAiHarmCategory }; export interface GoogleVertexAiConfig { project?: string; location?: string; keyFilename?: string; safetySettings?: { category: HarmCategory; threshold: HarmBlockThreshold; }[]; name?: string; } /** Provides access to GoogleVertexAi and other compatible services */ export declare class GoogleVertexAiProvider implements LlmCoreProvider { readonly name: string; readonly client: VertexAI; constructor({ project, location, keyFilename, safetySettings, name }?: GoogleVertexAiConfig); generateResponse(model: string, messages: LlmMessage[], config?: LlmGenerationConfig): Promise<LlmResponse>; generateResponseStream(model: string, messages: LlmMessage[], config?: LlmGenerationConfig): AsyncGenerator<LlmStreamResponseChunk | LlmStreamResponse | LlmStreamResponseWithToolCalls, void, unknown>; getAvailableModels(): Promise<string[]>; countTokens(model: string, contents: Content[]): Promise<{ model: string; inputTokens: number; characterCount: number; }>; createEmbedding(model: string, text: string): Promise<number[]>; }