import type OpenAILLM from "openai"; import type { ClientOptions, ClientOptions as OpenAIClientOptions } from "openai"; import { OpenAI as OrigOpenAI } from "openai"; import type { ChatCompletionRole, ChatCompletionTool } from "openai/resources/chat/completions"; import type { ChatCompletionMessageParam } from "openai/resources/index.js"; import type { BaseTool } from "../types.js"; import type { AzureOpenAIConfig } from "./azure.js"; import { ToolCallLLM } from "./base.js"; import type { ChatMessage, ChatResponse, ChatResponseChunk, LLM, LLMChatParamsNonStreaming, LLMChatParamsStreaming, LLMMetadata, MessageType, ToolCallLLMMessageOptions } from "./types.js"; export declare class OpenAISession { openai: Pick; constructor(options?: ClientOptions & { azure?: boolean; }); } /** * Get a session for the OpenAI API. If one already exists with the same options, * it will be returned. Otherwise, a new session will be created. * @param options * @returns */ export declare function getOpenAISession(options?: ClientOptions & { azure?: boolean; }): OpenAISession; export declare const GPT4_MODELS: { "gpt-4": { contextWindow: number; }; "gpt-4-32k": { contextWindow: number; }; "gpt-4-32k-0613": { contextWindow: number; }; "gpt-4-turbo": { contextWindow: number; }; "gpt-4-turbo-preview": { contextWindow: number; }; "gpt-4-1106-preview": { contextWindow: number; }; "gpt-4-0125-preview": { contextWindow: number; }; "gpt-4-vision-preview": { contextWindow: number; }; "gpt-4o": { contextWindow: number; }; "gpt-4o-2024-05-13": { contextWindow: number; }; }; export declare const GPT35_MODELS: { "gpt-3.5-turbo": { contextWindow: number; }; "gpt-3.5-turbo-0613": { contextWindow: number; }; "gpt-3.5-turbo-16k": { contextWindow: number; }; "gpt-3.5-turbo-16k-0613": { contextWindow: number; }; "gpt-3.5-turbo-1106": { contextWindow: number; }; "gpt-3.5-turbo-0125": { contextWindow: number; }; }; /** * We currently support GPT-3.5 and GPT-4 models */ export declare const ALL_AVAILABLE_OPENAI_MODELS: { "gpt-3.5-turbo": { contextWindow: number; }; "gpt-3.5-turbo-0613": { contextWindow: number; }; "gpt-3.5-turbo-16k": { contextWindow: number; }; "gpt-3.5-turbo-16k-0613": { contextWindow: number; }; "gpt-3.5-turbo-1106": { contextWindow: number; }; "gpt-3.5-turbo-0125": { contextWindow: number; }; "gpt-4": { contextWindow: number; }; "gpt-4-32k": { contextWindow: number; }; "gpt-4-32k-0613": { contextWindow: number; }; "gpt-4-turbo": { contextWindow: number; }; "gpt-4-turbo-preview": { contextWindow: number; }; "gpt-4-1106-preview": { contextWindow: number; }; "gpt-4-0125-preview": { contextWindow: number; }; "gpt-4-vision-preview": { contextWindow: number; }; "gpt-4o": { contextWindow: number; }; "gpt-4o-2024-05-13": { contextWindow: number; }; }; export declare function isFunctionCallingModel(llm: LLM): llm is OpenAI; export type OpenAIAdditionalMetadata = {}; export type OpenAIAdditionalChatOptions = Omit, "max_tokens" | "messages" | "model" | "temperature" | "top_p" | "stream" | "tools" | "toolChoice">; export declare class OpenAI extends ToolCallLLM { model: keyof typeof ALL_AVAILABLE_OPENAI_MODELS | string; temperature: number; topP: number; maxTokens?: number; additionalChatOptions?: OpenAIAdditionalChatOptions; apiKey?: string; maxRetries: number; timeout?: number; session: OpenAISession; additionalSessionOptions?: Omit, "apiKey" | "maxRetries" | "timeout">; constructor(init?: Partial & { azure?: AzureOpenAIConfig; }); get supportToolCall(): boolean; get metadata(): LLMMetadata & OpenAIAdditionalMetadata; static toOpenAIRole(messageType: MessageType): ChatCompletionRole; static toOpenAIMessage(messages: ChatMessage[]): ChatCompletionMessageParam[]; chat(params: LLMChatParamsStreaming): Promise>>; chat(params: LLMChatParamsNonStreaming): Promise>; protected streamChat(baseRequestParams: OpenAILLM.Chat.ChatCompletionCreateParams): AsyncIterable>; static toTool(tool: BaseTool): ChatCompletionTool; }