getEmptyOutputLlmRetryLimit (llm/empty-output-retry.ts)

gitingest_danielwpz_pokoclaw · src/agent/llm/empty-output-retry.ts · typescript · Apache-2.0
ai

Module exposing: getEmptyOutputLlmRetryLimit, getNextEmptyOutputLlmAttempt, shouldRetrySuccessfulEmptyAssistantOutput, getRetryableLlmFailureWithoutVisibleOutput

// Source: https://github.com/danielwpz/pokoclaw | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { type AgentLlmError, isAgentLlmError } from "@/src/agent/llm/errors.js";

export function getEmptyOutputLlmRetryLimit(maxAttempts: number): number {
  return Math.max(0, maxAttempts - 1);
}

export function getNextEmptyOutputLlmAttempt(input: { retryCount: number }): number {
  return input.retryCount + 1;
}

export function shouldRetrySuccessfulEmptyAssistantOutput(input: {
  assistantText: string;
  reasoningText: string;
  toolCallsRequested: number;
  sawStreamedText: boolean;
  sawStreamedReasoning: boolean;
  retryCount: number;
  maxAttempts: number;
}): boolean {
  if (

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key