mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-16 19:04:08 +03:00
71fa6e176a
With delegation.model blank (children inherit the parent model), the completion header read creds["model"] (None) and printed "Model: ?". Fall back to the model the built children actually run on.
25 lines
1.0 KiB
Python
25 lines
1.0 KiB
Python
"""The async completion header names the model the children actually run on."""
|
|
|
|
from dataclasses import fields
|
|
from types import SimpleNamespace
|
|
|
|
from tools import async_delegation
|
|
from tools.delegate_tool_dispatch import _Batch, _dispatch_unit
|
|
|
|
|
|
def _unit(configured_model):
|
|
batch = _Batch(**{field.name: None for field in fields(_Batch)})
|
|
task = {"goal": "probe"}
|
|
batch.task_list, batch.live_writers, batch.top_role = [task], [], "leaf"
|
|
batch.children = [(0, task, SimpleNamespace(model="inherited/model"))]
|
|
batch.creds = {"model": configured_model}
|
|
return batch
|
|
|
|
|
|
def test_completion_model_falls_back_to_inherited_child_model(monkeypatch):
|
|
seen = []
|
|
monkeypatch.setattr(async_delegation, "dispatch_async_delegation_batch", lambda **kw: seen.append(kw["model"]))
|
|
_dispatch_unit(_unit(None), None, None, {}) # delegation.model blank: children inherit the parent's model
|
|
_dispatch_unit(_unit("configured/model"), None, None, {})
|
|
assert seen == ["inherited/model", "configured/model"]
|