All files / src/chat ChatOptions.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36                                                                       
import { Message } from "./Message.js";
import { ToolResolvable } from "./Tool.js";
import { Schema } from "../schema/Schema.js";
import { ChatResponseString } from "./ChatResponse.js";
import { ToolExecutionMode } from "../constants.js";
import { ResponseFormat, ThinkingConfig } from "../providers/Provider.js";
 
export interface ChatOptions {
  systemPrompt?: string;
  messages?: Message[];
  tools?: ToolResolvable[];
  temperature?: number;
  maxTokens?: number;
  onNewMessage?: () => void;
  onEndMessage?: (message: ChatResponseString) => void;
  onToolCallStart?: (toolCall: unknown) => void;
  onToolCallEnd?: (toolCall: unknown, result: unknown) => void;
  onToolCallError?: (
    toolCall: unknown,
    error: Error
  ) => "STOP" | "CONTINUE" | "RETRY" | void | Promise<"STOP" | "CONTINUE" | "RETRY" | void>;
  headers?: Record<string, string>;
  schema?: Schema;
  responseFormat?: ResponseFormat;
  params?: Record<string, unknown>;
  assumeModelExists?: boolean;
  provider?: string;
  maxToolCalls?: number;
  requestTimeout?: number;
  thinking?: ThinkingConfig;
  toolExecution?: ToolExecutionMode;
  onConfirmToolCall?: (toolCall: unknown) => Promise<boolean> | boolean;
  onBeforeRequest?: (messages: Message[]) => Promise<Message[] | void>;
  onAfterResponse?: (response: ChatResponseString) => Promise<ChatResponseString | void>;
}