45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
export interface ChatMessage {
|
|
role: "user" | "assistant" | "tool";
|
|
content: string;
|
|
toolCalls?: ToolCall[];
|
|
toolCallId?: string;
|
|
toolName?: string;
|
|
thoughtSignature?: string;
|
|
}
|
|
export interface ToolCall {
|
|
id: string;
|
|
name: string;
|
|
args: Record<string, unknown>;
|
|
thoughtSignature?: string;
|
|
}
|
|
export interface ToolDefinition {
|
|
name: string;
|
|
description: string;
|
|
parameters: Record<string, unknown>;
|
|
}
|
|
export interface ChatChunk {
|
|
type: "text" | "thinking" | "tool_call" | "done" | "error";
|
|
text?: string;
|
|
toolCall?: ToolCall;
|
|
error?: string;
|
|
}
|
|
export declare function callGeminiChat(opts: {
|
|
systemPrompt: string;
|
|
messages: ChatMessage[];
|
|
tools?: ToolDefinition[];
|
|
temperature?: number;
|
|
includeThoughts?: boolean;
|
|
}): Promise<{
|
|
text: string;
|
|
thoughts: string;
|
|
toolCalls: ToolCall[];
|
|
finishReason?: string;
|
|
error?: string;
|
|
}>;
|
|
export declare function streamGeminiChat(opts: {
|
|
systemPrompt: string;
|
|
messages: ChatMessage[];
|
|
tools?: ToolDefinition[];
|
|
temperature?: number;
|
|
}): AsyncGenerator<ChatChunk>;
|