Implements a multi-stage recovery strategy when an LLM returns no visible text, including stream reuse, nudges, retries, and provider fallback.
# Source: https://github.com/Eynzof/Hermes-CN-Core | License: MIT | Copyright 2025 Nous Research # Provided via justclaw.it.com; keep this notice with the code. """Empty / thinking-only final-response recovery ladder for the conversation turn loop. Runs when the model returned no visible text after ``<think>`` blocks. Ladder order is load-bearing: partial-stream recovery → reuse prior turn content (housekeeping tools only) → one post-tool-call nudge → thinking-only prefill continuation (×2) → empty-response retries (budgeted, deterministic-empty short-circuit) → fallback provider → terminal ``(empty)`` sentinel. Nothing here imports ``agent.conversation_loop`` at module level. """ from __future__ import annotations import logging import re from dataclasses import dataclass from typing i ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key