mirror of
https://github.com/willchen96/mike.git
synced 2026-06-24 21:38:06 +02:00
28 lines
895 B
TypeScript
28 lines
895 B
TypeScript
|
|
import { streamClaude, completeClaudeText } from "./claude";
|
||
|
|
import { streamGemini, completeGeminiText } from "./gemini";
|
||
|
|
import { providerForModel } from "./models";
|
||
|
|
import type { StreamChatParams, StreamChatResult, UserApiKeys } from "./types";
|
||
|
|
|
||
|
|
export * from "./types";
|
||
|
|
export * from "./models";
|
||
|
|
|
||
|
|
export async function streamChatWithTools(
|
||
|
|
params: StreamChatParams,
|
||
|
|
): Promise<StreamChatResult> {
|
||
|
|
const provider = providerForModel(params.model);
|
||
|
|
if (provider === "claude") return streamClaude(params);
|
||
|
|
return streamGemini(params);
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function completeText(params: {
|
||
|
|
model: string;
|
||
|
|
systemPrompt?: string;
|
||
|
|
user: string;
|
||
|
|
maxTokens?: number;
|
||
|
|
apiKeys?: UserApiKeys;
|
||
|
|
}): Promise<string> {
|
||
|
|
const provider = providerForModel(params.model);
|
||
|
|
if (provider === "claude") return completeClaudeText(params);
|
||
|
|
return completeGeminiText(params);
|
||
|
|
}
|