Spaces:
Runtime error
Runtime error
Download src/app/queries/predict.ts from WaledRashed24/comics: direct link, hf CLI and curl.
- Browser
- Download file 863 Bytes
-
https://huggingface.co/spaces/WaledRashed24/comics/resolve/main/src/app/queries/predict.ts
- Command line
-
hf download hf://spaces/WaledRashed24/comics/src/app/queries/predict.ts
-
curl -L -o predict.ts https://huggingface.co/spaces/WaledRashed24/comics/resolve/main/src/app/queries/predict.ts
863 Bytes
| "use server" | |
| import { LLMEngine, LLMPredictionFunctionParams } from "@/types" | |
| import { defaultLLMEngineName, getLLMEngineFunction } from "./getLLMEngineFunction" | |
| export async function predict(params: LLMPredictionFunctionParams): Promise<string> { | |
| const { llmVendorConfig: { vendor } } = params | |
| // LLMVendor = what the user configure in the UI (eg. a dropdown item called default server) | |
| // LLMEngine = the actual engine to use (eg. hugging face) | |
| const llmEngineName: LLMEngine = | |
| vendor === "ANTHROPIC" ? "ANTHROPIC" : | |
| vendor === "GROQ" ? "GROQ" : | |
| vendor === "OPENAI" ? "OPENAI" : | |
| defaultLLMEngineName | |
| const llmEngineFunction = getLLMEngineFunction(llmEngineName) | |
| // console.log("predict: using " + llmEngineName) | |
| const results = await llmEngineFunction(params) | |
| // console.log("predict: result: " + results) | |
| return results | |
| } |