29 lines
896 B
Python
29 lines
896 B
Python
import pytest
|
|
from webapp.models import LLMProfile, ProfileApplyRequest, ProfileApplyResponse
|
|
|
|
def test_llm_profile_defaults():
|
|
p = LLMProfile(
|
|
profile_id="abc",
|
|
name="Test",
|
|
model="gpt-4",
|
|
base_url="http://localhost/v1",
|
|
api_key="sk-test",
|
|
)
|
|
assert p.timeout_seconds == 30
|
|
assert p.created_at != ""
|
|
assert p.updated_at != ""
|
|
|
|
def test_profile_apply_request_fields():
|
|
req = ProfileApplyRequest(
|
|
scenario_path="scenarios/offline/sample.yaml",
|
|
judge_profile_id="id1",
|
|
answer_profile_id="id2",
|
|
dataset_profile_id=None,
|
|
)
|
|
assert req.judge_profile_id == "id1"
|
|
assert req.dataset_profile_id is None
|
|
|
|
def test_profile_apply_response():
|
|
resp = ProfileApplyResponse(scenario_path="scenarios/offline/sample.yaml", patched_fields=["judge_model"])
|
|
assert "judge_model" in resp.patched_fields
|