UNPKG

chat-about-video

Version:

Chat about a video clip using ChatGPT hosted in OpenAI or Azure, or Gemini provided by Google

34 lines 2.3 kB
import { AzureClientOptions, AzureOpenAI, OpenAI } from 'openai'; import type { AdditionalCompletionOptions, BuildPromptOutput, ChatApi, ChatApiOptions, ExtractVideoFramesOptions, ImageInput, StorageOptions, UsageMetadata } from '../types'; import { effectiveExtractVideoFramesOptions, effectiveStorageOptions } from '../utils'; export type ChatGptClient = AzureOpenAI | OpenAI; export type ChatGptResponse = OpenAI.ChatCompletion; export type ChatGptPrompt = OpenAI.ChatCompletionCreateParamsNonStreaming['messages']; export type ChatGptCompletionOptions = AdditionalCompletionOptions & Omit<OpenAI.ChatCompletionCreateParamsNonStreaming, 'messages' | 'stream'>; export type ChatGptOptions = { extractVideoFrames?: ExtractVideoFramesOptions; storage: StorageOptions; } & ChatApiOptions<AzureClientOptions, ChatGptCompletionOptions>; export declare class ChatGptApi implements ChatApi<ChatGptClient, ChatGptCompletionOptions, ChatGptPrompt, ChatGptResponse> { protected options: ChatGptOptions; protected client: ChatGptClient; protected storage: ReturnType<typeof effectiveStorageOptions>; protected extractVideoFrames?: ReturnType<typeof effectiveExtractVideoFramesOptions>; protected tmpDir: string; constructor(options: ChatGptOptions); getClient(): Promise<ChatGptClient>; generateContent(prompt: ChatGptPrompt, options: ChatGptCompletionOptions): Promise<ChatGptResponse>; getResponseText(result: ChatGptResponse): Promise<string | undefined>; getUsageMetadata(result: ChatGptResponse): Promise<UsageMetadata | undefined>; isThrottlingError(error: any): boolean; isServerError(error: any): boolean; isConnectivityError(error: any): boolean; isDownloadError(error: any): boolean; appendToPrompt(newPromptOrResponse: ChatGptPrompt | ChatGptResponse, prompt?: ChatGptPrompt): Promise<ChatGptPrompt>; buildTextPrompt(text: string, _conversationId?: string): Promise<{ prompt: ChatGptPrompt; }>; buildVideoPrompt(videoFile: string, conversationId?: string): Promise<BuildPromptOutput<ChatGptPrompt, ChatGptCompletionOptions>>; buildImagesPrompt(imageInputs: ImageInput[], conversationId?: string): Promise<BuildPromptOutput<ChatGptPrompt, ChatGptCompletionOptions>>; } //# sourceMappingURL=index.d.ts.map