UNPKG

@ts-dspy/openai

Version:

OpenAI ChatGPT integration for TS-DSPy - enables type-safe LLM interactions with GPT-3.5, GPT-4, and other OpenAI models for TypeScript

23 lines (22 loc) 834 B
import { ILanguageModel, LLMCallOptions, ChatMessage, UsageStats, ModelCapabilities } from '@ts-dspy/core'; export interface OpenAIConfig { apiKey: string; model?: string; organization?: string; baseURL?: string; } export declare class OpenAILM implements ILanguageModel { private config; private usage; constructor(config: OpenAIConfig); generate(prompt: string, options?: LLMCallOptions): Promise<string>; generateStructured<T>(prompt: string, schema: any, options?: LLMCallOptions): Promise<T>; chat(messages: ChatMessage[], options?: LLMCallOptions): Promise<string>; getUsage(): UsageStats; resetUsage(): void; setModel(model: string): void; getModel(): string; setBaseURL(baseURL: string): void; getModelName(): string; getCapabilities(): ModelCapabilities; }