import express from "express";
import { RaijinLabsLucidAi } from "raijin-labs-lucid-ai";
const app = express();
const lucid = new RaijinLabsLucidAi({
serverURL: process.env.LUCID_API_URL || "https://api.lucid.foundation",
security: { bearerAuth: process.env.LUCID_API_KEY },
});
// Add your custom logic
app.post('/run', async (req, res) => {
// Custom preprocessing
const enrichedPrompt = await myPreprocessor(req.body.prompt);
// Inference with automatic receipt
const result = await lucid.run.chatCompletions({
body: {
model: process.env.LUCID_MODEL || "openai/gpt-4o",
messages: [{ role: "user", content: enrichedPrompt }],
},
});
// Custom postprocessing
const finalResult = await myPostprocessor(result);
res.json(finalResult);
});
app.listen(3100);