ai-comic-factory / src /app /queries /getLLMEngineFunction.ts
jbilcke-hf's picture
jbilcke-hf HF staff
release 1.3
b022cb9
raw
history blame
801 Bytes
import { LLMEngine } from "@/types"
import { predict as predictWithHuggingFace } from "./predictWithHuggingFace"
import { predict as predictWithOpenAI } from "./predictWithOpenAI"
import { predict as predictWithGroq } from "./predictWithGroq"
import { predict as predictWithAnthropic } from "./predictWithAnthropic"
export const defaultLLMEngineName = `${process.env.LLM_ENGINE || ""}` as LLMEngine
export function getLLMEngineFunction(llmEngineName: LLMEngine = defaultLLMEngineName) {
const llmEngineFunction =
llmEngineName === "GROQ" ? predictWithGroq :
llmEngineName === "ANTHROPIC" ? predictWithAnthropic :
llmEngineName === "OPENAI" ? predictWithOpenAI :
predictWithHuggingFace
return llmEngineFunction
}
export const defaultLLMEngineFunction = getLLMEngineFunction()