auto-gpt-ts
Version:
my take of Auto-GPT in typescript
34 lines (32 loc) • 1.56 kB
TypeScript
import { Message } from "./base";
export declare function RetryOpenaiApi(numRetries?: number, backoffBase?: number, warnUser?: boolean): <T>(target: T, propertyKey: any) => void;
export declare function callAiFunction(fnName: string, args: any[], description: string, model?: string): Promise<string>;
/**
Create a chat completion using the OpenAI API
@param {Message[]} messages - The messages to send to the chat completion.
@param {string} [model] - The model to use. Defaults to null.
@param {number} [temperature] - The temperature to use. Defaults to 0.9.
@param {number} [maxTokens] - The max tokens to use. Defaults to null.
@returns {string} - The response from the chat completion.
*/
export declare function createChatCompletion(messages: Message[], model?: string, temperature?: number, maxTokens?: number): Promise<string>;
/**
* Get an embedding from the ada model.
*
* @param {string} text - The text to embed.
* @returns {number[]} - The embedding.
*/
export declare function getAdaEmbedding(text: string): Promise<number[]>;
declare class LlmUtils {
/** warped in class for decorating
*/
static createEmbedding(text: string, ..._: any[]): Promise<import("openai").CreateEmbeddingResponse>;
}
/**
* Creates an embedding using the OpenAI API
* @param {string} text - The text to embed.
* @param {...any} _ - Additional arguments to pass to the OpenAI API embedding creation call.
* @returns {openai.Embedding} - The embedding object.
*/
export declare const createEmbedding: typeof LlmUtils.createEmbedding;
export {};