Initial clean commit - unified Lyra stack
This commit is contained in:
39
core/relay/test-llm.js
Normal file
39
core/relay/test-llm.js
Normal file
@@ -0,0 +1,39 @@
|
||||
// test-llm.js
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import dotenv from "dotenv";
|
||||
import { callSpeechLLM } from "./lib/llm.js";
|
||||
|
||||
// ───────────────────────────────────────────────
|
||||
// 🔧 Load environment
|
||||
// ───────────────────────────────────────────────
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const envPath = path.join(__dirname, "../.env");
|
||||
dotenv.config({ path: envPath });
|
||||
|
||||
console.log("🔧 Using .env from:", envPath);
|
||||
console.log("🔧 LLM_FORCE_BACKEND =", process.env.LLM_FORCE_BACKEND);
|
||||
console.log("🔧 LLM_PRIMARY_URL =", process.env.LLM_PRIMARY_URL);
|
||||
|
||||
// ───────────────────────────────────────────────
|
||||
// 🧪 Run a simple test message
|
||||
// ───────────────────────────────────────────────
|
||||
async function testLLM() {
|
||||
console.log("🧪 Testing LLM helper...");
|
||||
|
||||
const messages = [
|
||||
{ role: "user", content: "Say hello in five words or less." }
|
||||
];
|
||||
|
||||
try {
|
||||
const { reply, backend } = await callSpeechLLM(messages);
|
||||
|
||||
console.log(`✅ Reply: ${reply || "[no reply]"}`);
|
||||
console.log(`Backend used: ${backend || "[unknown]"}`);
|
||||
} catch (err) {
|
||||
console.error("💥 Test failed:", err.message);
|
||||
}
|
||||
}
|
||||
|
||||
testLLM();
|
||||
Reference in New Issue
Block a user