CoolFace
Apppublic

WaledRashed24/comics

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
getLLMEngineFunction.ts19 linesDownload Raw Back to queries
1import { LLMEngine } from "@/types"2import { predict as predictWithHuggingFace } from "./predictWithHuggingFace"3import { predict as predictWithOpenAI } from "./predictWithOpenAI"4import { predict as predictWithGroq } from "./predictWithGroq"5import { predict as predictWithAnthropic } from "./predictWithAnthropic"6 7export const defaultLLMEngineName = `${process.env.LLM_ENGINE || ""}` as LLMEngine8 9export function getLLMEngineFunction(llmEngineName: LLMEngine = defaultLLMEngineName) {10  const llmEngineFunction = 11    llmEngineName === "GROQ" ? predictWithGroq :12    llmEngineName === "ANTHROPIC" ? predictWithAnthropic :13    llmEngineName === "OPENAI" ? predictWithOpenAI :14    predictWithHuggingFace15  16  return llmEngineFunction17}18 19export const defaultLLMEngineFunction = getLLMEngineFunction()