summaryrefslogtreecommitdiff
path: root/src/types/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/types/index.ts')
-rw-r--r--src/types/index.ts18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/types/index.ts b/src/types/index.ts
index 97be443..b276457 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -1,15 +1,29 @@
import type OpenAI from "openai";
+import type { AsyncRes } from "sortug";
export type ChatMessage = {
author: string;
text: string;
sent: number;
reasoning?: string;
};
-export type Result<T> = { ok: T } | { error: string };
-export type AResult<T> = Promise<{ ok: T } | { error: string }>;
// openai
export type OChoice = OpenAI.Chat.Completions.ChatCompletion.Choice;
export type OChunk = OpenAI.Chat.Completions.ChatCompletionChunk.Choice;
export type OMessage = OpenAI.Chat.Completions.ChatCompletionMessageParam;
export type ContentType = { text: string } | { audio: Response };
+export type AIModelChoice =
+ | { name: "deepseek" | "chatgpt" | "claude" | "gemini" | "grok" }
+ | { other: { baseURL: string; apiKey: string } };
+export interface AIModelAPI {
+ setModel: (model: string) => void;
+ tokenizer: (text: string) => number;
+ maxTokens: number;
+
+ send: (systemPrompt: string, input: ChatMessage[]) => AsyncRes<string[]>;
+ stream: (
+ systemPrompt: string,
+ input: ChatMessage[],
+ handler: (data: any) => void,
+ ) => void;
+}