UNPKG

retort-js

Version:

Intuitive, production-ready prompt chaining in Javascript

33 lines (32 loc) 2.16 kB
import { RetortConversation } from "./conversation"; import { RetortExtendableFunction } from "./extendable-function"; import { RetortMessage, RetortValue, RetortValueArray } from "./message"; export interface RetortAgent { (content: string): RetortMessage; <T extends any[]>(templateStrings: TemplateStringsArray, ...values: RetortValueArray<T>): RetortMessage; } export declare class RetortAgent extends RetortExtendableFunction { conversation: RetortConversation; role: RetortRole; protected __wrappedFunction(value0: string | TemplateStringsArray, ...values: RetortValue[]): RetortMessage<string>; constructor(conversation: RetortConversation, role: RetortRole); get input(): (inputSettings?: Partial<RetortInputSettings> | undefined) => Promise<string>; get generation(): <T extends import("src/tooling").RetortObjectSchema | undefined = undefined>(generationSettings?: Partial<RetortSettings> | (Partial<RetortSettings> & import("./define-generation").RetortParamaterization<T>) | undefined) => import("./message").RetortMessagePromise<T extends import("src/tooling").RetortObjectSchema ? import("src/tooling").RetortSchemaToType<T> : string>; private get prompt(); } export declare function agent(conversation: RetortConversation, role: RetortRole): RetortAgent; export type RetortRole = "user" | "assistant" | "system"; export interface RetortSettings { model: RetortModel; temperature: number; topP: number; maxTokens?: number; stream?: boolean; } export interface RetortInputSettings extends RetortSettings { query?: string; } type ClaudeModel = 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | 'claude-2.1' | 'claude-2.0' | 'claude-instant-1.2'; type OpenAIModel = 'gpt-4-0125-preview' | 'gpt-4-turbo-preview' | 'gpt-4-1106-preview' | 'gpt-4-vision-preview' | 'gpt-4-1106-vision-preview' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4-32k' | 'gpt-4-32k-0613' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-3.5-turbo-0613' | 'gpt-3.5-turbo-16k-0613'; export type RetortModel = ClaudeModel | OpenAIModel | String; export {};