import { ZodSchema } from "zod"; export { OpenAILanguageProgramProcessor } from "./openAI"; export { AnthropicProcessor } from "./Anthropic"; export { FunctionlessLLM } from "./FunctionlessLLM"; export { FunctionToContentConverter } from "./FunctionToContentConverter"; export interface LanguageModelProgramExecutorExecuteOptions { stop?: string; functionCall?: "none" | "auto" | { name: string; }; model?: string; } export interface ExecutorResponse { content?: string | null; functionCall?: FunctionCall; parsedArguments?: FunctionCallArgumentsType; } export type Headers = Record; export interface RequestOptions { signal?: AbortSignal | null; headers?: Headers; stream?: boolean; timeout?: number; } export interface RequestOptionsStreaming extends RequestOptions { stream: true; } export interface RequestOptionsNonStreaming extends RequestOptions { stream?: false; } export type NonStreamingExecuteResponse = ExecutorResponse; export type StreamingExecuteResponse = { response: Promise>; stream: AsyncIterable; }; /** * Execute a language model program and get the results as a string (non-streaming) */ export interface LanguageModelProgramExecutor { execute(records: ChatMessage[], chatCompletionParams?: LanguageModelProgramExecutorExecuteOptions, functions?: FunctionSpecification[], requestOptions?: RequestOptionsNonStreaming): Promise>; execute(records: ChatMessage[], chatCompletionParams?: LanguageModelProgramExecutorExecuteOptions, functions?: FunctionSpecification[], requestOptions?: RequestOptionsStreaming): Promise>; } /** * The below is mostly taken directly from the OpenAI types, but the idea is to keep these * stable between different LLMs and between different OpenAI versions. */ export declare enum ChatMessageRoleEnum { System = "system", User = "user", Assistant = "assistant", Function = "function" } export type ContentText = { type: "text"; text: string; }; export type ContentImage = { type: "image_url"; image_url: string; }; export type ChatMessageContent = string | (ContentText | ContentImage)[]; export interface ChatMessage { role: ChatMessageRoleEnum; content: ChatMessageContent; name?: string; function_call?: FunctionCall; } export interface FunctionSpecification { /** * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain * underscores and dashes, with a maximum length of 64. */ name: string; /** * The description of what the function does. */ description?: string; /** . * The parameters the function takes, these are specified in zod format so that the output can be validated by the language program executor. */ parameters: ZodSchema; } export interface FunctionCall { /** * The arguments to call the function with, as generated by the model in JSON * format. Note that the model does not always generate valid JSON, and may * hallucinate parameters not defined by your function schema. Validate the * arguments in your code before calling your function. */ arguments: string; /** * The name of the function to call. */ name: string; }