mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 08:19:32 +08:00
docs: place the tool manifest comment and restore docstring accurately
The runtime-snapshot comment had drifted above TOOL_MANIFEST_SNAPSHOT instead of RUNTIME_BLOCK_NAMES. _restore_tool_manifest's docstring said a native request never carries a tools snapshot and that the next turn keeps it current; replayed history can carry one, and it is kept only while the previous turn on the same route recorded a rejection. Refs #2973
This commit is contained in:
@@ -675,11 +675,15 @@ class AgentLoop:
|
||||
def _restore_tool_manifest(self, messages: list[dict[str, Any]]) -> bool:
|
||||
"""Put the text tool manifest back after a provider rejected schemas.
|
||||
|
||||
Native requests carry no ``[Runtime context: tools]`` snapshot, so the
|
||||
schema-less retry would show the model no tools at all, and DSML tool
|
||||
calls could never be written. Added to the canonical ``messages`` it is
|
||||
persisted with the turn like any snapshot; the next turn replays it and
|
||||
keeps it current (see ``_tool_schemas_rejected_last_turn``).
|
||||
A native request adds no ``[Runtime context: tools]`` snapshot of its
|
||||
own (one may still be in replayed history, possibly retracted), so the
|
||||
schema-less retry could show the model no current tool list, and DSML
|
||||
tool calls could never be written. Nothing is added when the latest
|
||||
``tools`` snapshot already matches. Added to the canonical ``messages``
|
||||
it is persisted with the turn like any snapshot. The next turn replays
|
||||
it; it stays current only while the previous turn on the same route
|
||||
recorded a rejection (``_tool_schemas_rejected_last_turn``), otherwise
|
||||
``_build_loop_messages`` retracts it.
|
||||
|
||||
Placement: on the first round the learner's message is still the last
|
||||
message and the provider has not accepted it yet, so the snapshot goes
|
||||
|
||||
@@ -21,12 +21,12 @@ from deeptutor.core.context import UnifiedContext
|
||||
from deeptutor.runtime.agentic.tool_dispatch import MAX_PARALLEL_TOOL_CALLS
|
||||
from deeptutor.services.prompt.language import append_language_directive
|
||||
|
||||
# These facts can change between turns without changing the tutor's rules.
|
||||
# They are replayed at their original history position, with a new snapshot
|
||||
# appended only when their rendered value changes.
|
||||
# The text tool list. Native requests omit it; a schema rejection restores it.
|
||||
TOOL_MANIFEST_SNAPSHOT = "tools"
|
||||
|
||||
# These facts can change between turns without changing the tutor's rules.
|
||||
# They are replayed at their original history position, with a new snapshot
|
||||
# appended only when their rendered value changes.
|
||||
RUNTIME_BLOCK_NAMES = frozenset(
|
||||
{
|
||||
"runtime_context",
|
||||
|
||||
Reference in New Issue
Block a user