WeLe Agentic AI: LangGraph multi-agent CRM assistant with voice
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/* Can Claude actually serve a request right now? */
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
|
||||
const key = process.env.ANTHROPIC_API_KEY;
|
||||
if (!key) { console.log('❌ ANTHROPIC_API_KEY is not set.'); process.exit(1); }
|
||||
|
||||
const chains = [process.env.LLM_CHAIN_SUPERVISOR, process.env.LLM_CHAIN_AGENT].join(',');
|
||||
const models = [...new Set(chains.split(',').map((s) => s.replace(/^anthropic:/, '').trim()).filter(Boolean))];
|
||||
|
||||
const rows = [];
|
||||
for (const model of models) {
|
||||
try {
|
||||
const res = await fetch('https://api.anthropic.com/v1/messages', {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json', 'x-api-key': key, 'anthropic-version': '2023-06-01' },
|
||||
body: JSON.stringify({ model, max_tokens: 16, messages: [{ role: 'user', content: 'Say OK' }] }),
|
||||
signal: AbortSignal.timeout(30000),
|
||||
});
|
||||
const j = await res.json();
|
||||
rows.push(res.ok
|
||||
? [model, 'OK', JSON.stringify(j.content?.[0]?.text)]
|
||||
: [model, `HTTP ${res.status}`, String(j.error?.message || '').slice(0, 110)]);
|
||||
} catch (e) { rows.push([model, 'ERR', e.message.slice(0, 110)]); }
|
||||
}
|
||||
|
||||
console.log('model'.padEnd(24), 'status'.padEnd(10), 'detail');
|
||||
console.log('-'.repeat(100));
|
||||
for (const [m, s, d] of rows) console.log(m.padEnd(24), String(s).padEnd(10), d || '');
|
||||
|
||||
const ok = rows.filter(([, s]) => s === 'OK');
|
||||
console.log(`
|
||||
${ok.length ? `✅ ${ok.length}/${rows.length} model(s) usable: ${ok.map((r) => r[0]).join(', ')}` : '❌ Claude cannot serve a request right now.'}`);
|
||||
process.exit(0);
|
||||
Reference in New Issue
Block a user