add more debug logs for llm-events

This commit is contained in:
Ramnique Singh 2026-02-18 22:07:24 +05:30
parent dee38a615f
commit d7b423404c

View file

@ -827,10 +827,6 @@ export async function* streamAgent({
tools,
signal,
)) {
// Only log significant events (not text-delta to reduce noise)
if (event.type !== 'text-delta') {
loopLogger.log('got llm-stream-event:', event.type);
}
messageBuilder.ingest(event);
yield* processEvent({
runId,
@ -924,9 +920,11 @@ async function* streamLlm(
tools: ToolSet,
signal?: AbortSignal,
): AsyncGenerator<z.infer<typeof LlmStepStreamEvent>, void, unknown> {
const converted = convertFromMessages(messages);
console.log(`! SENDING payload to model: `, JSON.stringify(converted))
const { fullStream } = streamText({
model,
messages: convertFromMessages(messages),
messages: converted,
system: instructions,
tools,
stopWhen: stepCountIs(1),
@ -935,7 +933,7 @@ async function* streamLlm(
for await (const event of fullStream) {
// Check abort on every chunk for responsiveness
signal?.throwIfAborted();
// console.log("\n\n\t>>>>\t\tstream event", JSON.stringify(event));
console.log("-> \t\tstream event", JSON.stringify(event));
switch (event.type) {
case "error":
yield {