|
"use server" |
|
|
|
import { LLMEngine, LLMPredictionFunctionParams } from "@/types" |
|
import { defaultLLMEngineName, getLLMEngineFunction } from "./getLLMEngineFunction" |
|
|
|
export async function predict(params: LLMPredictionFunctionParams): Promise<string> { |
|
const { llmVendorConfig: { vendor } } = params |
|
|
|
|
|
const llmEngineName: LLMEngine = |
|
vendor === "ANTHROPIC" ? "ANTHROPIC" : |
|
vendor === "GROQ" ? "GROQ" : |
|
vendor === "OPENAI" ? "OPENAI" : |
|
defaultLLMEngineName |
|
|
|
const llmEngineFunction = getLLMEngineFunction(llmEngineName) |
|
|
|
|
|
const results = await llmEngineFunction(params) |
|
|
|
|
|
return results |
|
} |