blob: 83545f01bd378e7f7d19e72ec160a181040a7f16 (
plain)
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 Openai from "./src/openai";
import Claude from "./src/claude";
import Gemini from "./src/gemini";
import Generic from "./src/generic";
import type { AIModelAPI, AIModelChoice } from "./src/types";
export type * from "./src/types";
export * as NLP from "./src/nlp";
export default function (choice: AIModelChoice): AIModelAPI {
const api =
"other" in choice
? new Generic(choice.other)
: choice.name === "deepseek"
? new Generic({
baseURL: "https://api.deepseek.com",
apiKey: Bun.env.DEEPSEEK_API_KEY!,
model: "deepseek-chat",
})
: choice.name === "grok"
? new Generic({
baseURL: "https://api.x.ai/v1",
apiKey: Bun.env.GROK_API_KEY!,
model: "grok-2-latest",
})
: choice.name === "chatgpt"
? new Generic({
baseURL: "https://api.openai.com/v1",
apiKey: Bun.env.OPENAI_API_KEY!,
model: "gpt-4o",
})
: choice.name === "claude"
? new Claude()
: new Gemini();
return api;
}
|