generated from coulomb/repo-seed
53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
import httpx
|
|
|
|
from activity_core.llm_client import LLMConnectClient
|
|
|
|
|
|
def test_llm_connect_client_forwards_run_config(monkeypatch) -> None:
|
|
captured: dict = {}
|
|
|
|
class Response:
|
|
def raise_for_status(self) -> None:
|
|
pass
|
|
|
|
def json(self) -> dict:
|
|
return {"content": '{"summary":"ok","recommendations":[]}'}
|
|
|
|
def fake_post(url: str, json: dict, timeout: float) -> Response:
|
|
captured["url"] = url
|
|
captured["json"] = json
|
|
captured["timeout"] = timeout
|
|
return Response()
|
|
|
|
monkeypatch.setattr(httpx, "post", fake_post)
|
|
|
|
client = LLMConnectClient("http://llm-connect.local/", timeout_seconds=42)
|
|
result = client.complete(
|
|
"Prompt",
|
|
model="fallback-model",
|
|
config={
|
|
"model_name": "custodian-triage-balanced",
|
|
"temperature": 0.2,
|
|
"max_tokens": 1200,
|
|
"max_depth": 2,
|
|
"model_params": {"reasoning_effort": "medium"},
|
|
},
|
|
)
|
|
|
|
assert result == '{"summary":"ok","recommendations":[]}'
|
|
assert captured["url"] == "http://llm-connect.local/execute"
|
|
assert captured["timeout"] == 42
|
|
assert captured["json"] == {
|
|
"prompt": "Prompt",
|
|
"config": {
|
|
"model_name": "custodian-triage-balanced",
|
|
"temperature": 0.2,
|
|
"max_tokens": 1200,
|
|
"max_depth": 2,
|
|
"model_params": {"reasoning_effort": "medium"},
|
|
"timeout_seconds": 42,
|
|
},
|
|
}
|