main
1import { TSchema } from "@sinclair/typebox";
2
3export interface Message {
4 role: "user" | "assistant" | "system";
5 content: string;
6}
7
8export interface ToolDefinition {
9 name: string;
10 description: string;
11 parameters: TSchema;
12}
13
14export interface ToolCallRequest {
15 id: string;
16 name: string;
17 arguments: Record<string, unknown>;
18}
19
20export interface LLMResponse {
21 content: string | null;
22 toolCalls: ToolCallRequest[];
23 stopReason: "end_turn" | "tool_use" | "max_tokens" | "error";
24}
25
26export interface ToolResultMessage {
27 role: "user";
28 content: Array<{
29 type: "tool_result";
30 tool_use_id: string;
31 content: string;
32 is_error?: boolean;
33 }>;
34}
35
36export interface LLMProvider {
37 name: string;
38 chat(
39 messages: Message[],
40 options: {
41 systemPrompt?: string;
42 tools?: ToolDefinition[];
43 maxTokens?: number;
44 }
45 ): Promise<LLMResponse>;
46}