wip
This commit is contained in:
parent
cc89f0c75c
commit
afd28d934e
26 changed files with 2103 additions and 427 deletions
30
data-pipeline/utils/llm-adapters/factory.ts
Normal file
30
data-pipeline/utils/llm-adapters/factory.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { LLM_CONFIG } from "../../config/llm.js";
|
||||
import { OpenAiCompatibleAdapter } from "./openai-compatible.js";
|
||||
import { GeminiAdapter } from "./gemini.js";
|
||||
import type { LlmAdapter } from "./types.js";
|
||||
|
||||
export function createAdapter(): LlmAdapter {
|
||||
switch (LLM_CONFIG.provider) {
|
||||
case "local":
|
||||
return new OpenAiCompatibleAdapter(LLM_CONFIG.url);
|
||||
case "openrouter":
|
||||
return new OpenAiCompatibleAdapter(
|
||||
LLM_CONFIG.url,
|
||||
process.env["OPENROUTER_API_KEY"],
|
||||
LLM_CONFIG.model,
|
||||
);
|
||||
case "deepseek":
|
||||
return new OpenAiCompatibleAdapter(
|
||||
LLM_CONFIG.url,
|
||||
process.env["DEEPSEEK_API_KEY"],
|
||||
LLM_CONFIG.model,
|
||||
);
|
||||
case "gemini": {
|
||||
const apiKey = process.env["GEMINI_API_KEY"];
|
||||
if (!apiKey) throw new Error("GEMINI_API_KEY env var not set");
|
||||
if (!LLM_CONFIG.model)
|
||||
throw new Error("LLM_CONFIG.model required for gemini");
|
||||
return new GeminiAdapter(apiKey, LLM_CONFIG.model);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue