UNPKG

@aige/core

Version:
23 lines (22 loc) 834 B
import OpenAI from 'openai'; import Game from './game'; import { Tool } from './tools'; import { GameClientOptions, GameClientImageOptions } from './types'; import { ChatCompletionCreateParams, ChatCompletionToolChoiceOption } from 'openai/resources'; export type CallParameters = { messages?: ChatCompletionCreateParams['messages']; tool_choice?: ChatCompletionToolChoiceOption; debug?: boolean; }; export default class Client { client: OpenAI; game: Game; model: string; imageModel: string; contextWindow: number; tokens: number; limit: number; constructor(options: GameClientOptions | undefined, game: Game); call(tool: Tool | Tool[], parameters: CallParameters): Promise<any>; image(prompt: string, options?: GameClientImageOptions): Promise<OpenAI.Images.Image | undefined>; }