log llm call body

This commit is contained in:
itsrubberduck
2025-09-18 18:21:01 +02:00
parent 03b86ae637
commit 8ea2ae28d2

View File

@@ -179,14 +179,18 @@ export async function routeDecision(input: LLMDecisionInput): Promise<LLMDecisio
try {
const client = ensureOpenAI()
const model = getModel()
const r = await client.chat.completions.create({
const body = {
model,
response_format: { type: 'json_object' },
messages: [
{ role: 'system', content: system },
{ role: 'user', content: user }
]
})
}
console.log("calling LLM with body:", body)
const r = await client.chat.completions.create(body)
const raw = r.choices?.[0]?.message?.content || '{}'
const parsed = JSON.parse(raw)
@@ -196,6 +200,8 @@ export async function routeDecision(input: LLMDecisionInput): Promise<LLMDecisio
throw new Error('Invalid next_state')
}
console.log("LLM decision:", parsed)
return parsed as LLMDecision
} catch (e) {