mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-14 19:02:22 +02:00
fix(teacher): import _TEACHER_SYSTEM_PROMPT from its current module (#5756)
* fix(teacher): import teacher prompt from current module * test(teacher): make prompt monkeypatch import-order independent --------- Co-authored-by: Alexandre Teixeira <alexandremagteixeira@gmail.com>
This commit is contained in:
co-authored by
Alexandre Teixeira
parent
e7eddbae13
commit
17ee856d1c
@@ -233,7 +233,8 @@ async def _call_teacher(teacher_model_spec: str, prompt: str,
|
|||||||
owner: Optional[str] = None) -> Optional[str]:
|
owner: Optional[str] = None) -> Optional[str]:
|
||||||
"""Call the configured teacher endpoint with the escalation prompt."""
|
"""Call the configured teacher endpoint with the escalation prompt."""
|
||||||
from src.llm_core import llm_call_async
|
from src.llm_core import llm_call_async
|
||||||
from src.ai_interaction import _resolve_model, _TEACHER_SYSTEM_PROMPT
|
from src.ai_interaction import _resolve_model
|
||||||
|
from src.agent_tools.model_interaction_tools import _TEACHER_SYSTEM_PROMPT
|
||||||
try:
|
try:
|
||||||
url, model, headers = await asyncio.to_thread(_resolve_model, teacher_model_spec, owner=owner)
|
url, model, headers = await asyncio.to_thread(_resolve_model, teacher_model_spec, owner=owner)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -21,10 +21,17 @@ def test_call_teacher_scopes_model_resolution_to_owner(monkeypatch):
|
|||||||
return ("http://endpoint.local/v1", "teacher-model", {})
|
return ("http://endpoint.local/v1", "teacher-model", {})
|
||||||
|
|
||||||
async def fake_llm_call_async(url, model, messages, **kwargs):
|
async def fake_llm_call_async(url, model, messages, **kwargs):
|
||||||
|
seen["messages"] = messages
|
||||||
return "teacher reply"
|
return "teacher reply"
|
||||||
|
|
||||||
|
from src.agent_tools import model_interaction_tools
|
||||||
|
|
||||||
monkeypatch.setattr("src.ai_interaction._resolve_model", fake_resolve_model)
|
monkeypatch.setattr("src.ai_interaction._resolve_model", fake_resolve_model)
|
||||||
monkeypatch.setattr("src.ai_interaction._TEACHER_SYSTEM_PROMPT", "sys", raising=False)
|
monkeypatch.setattr(
|
||||||
|
model_interaction_tools,
|
||||||
|
"_TEACHER_SYSTEM_PROMPT",
|
||||||
|
"sys",
|
||||||
|
)
|
||||||
monkeypatch.setattr("src.llm_core.llm_call_async", fake_llm_call_async)
|
monkeypatch.setattr("src.llm_core.llm_call_async", fake_llm_call_async)
|
||||||
|
|
||||||
result = asyncio.run(
|
result = asyncio.run(
|
||||||
@@ -34,6 +41,7 @@ def test_call_teacher_scopes_model_resolution_to_owner(monkeypatch):
|
|||||||
assert result == "teacher reply"
|
assert result == "teacher reply"
|
||||||
assert seen["owner"] == "alice"
|
assert seen["owner"] == "alice"
|
||||||
assert seen["spec"] == "teacher-model"
|
assert seen["spec"] == "teacher-model"
|
||||||
|
assert seen["messages"][0] == {"role": "system", "content": "sys"}
|
||||||
|
|
||||||
|
|
||||||
def test_audit_teacher_resolution_scoped_to_owner(monkeypatch):
|
def test_audit_teacher_resolution_scoped_to_owner(monkeypatch):
|
||||||
|
|||||||
Reference in New Issue
Block a user