mirror of
https://github.com/hoshikawa2/agent_platform_oci.git
synced 2026-11-06 03:14:12 +00:00
new feature: JEV Integration. Now there are a current (native) LLM decision model and a JEV decision model
This commit is contained in:
28
tests/test_jev_choice_fix.py
Normal file
28
tests/test_jev_choice_fix.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import pytest
|
||||
from agent_framework.decisions.adapters.typesafe import build_request, normalize_answers, TypeSafeContractError
|
||||
from agent_framework.decisions import client
|
||||
|
||||
|
||||
def test_choice_wire_uses_verified_noul():
|
||||
questions = [client.choice('decision', ['CONTINUE','ROUTE','END_SESSION'])]
|
||||
body = build_request('state', questions)
|
||||
assert len(body['questions']) == 3
|
||||
assert all(x['type'] == 'noul' for x in body['questions'].values())
|
||||
answer = {'answers': {'__jev_q0_o0': {'noul': .12}, '__jev_q0_o1': {'noul': .94}, '__jev_q0_o2': {'noul': .07}}}
|
||||
assert normalize_answers(answer, questions) == [{'name': 'decision', 'type': 'choice', 'choice': 'ROUTE', 'confidence': .94}]
|
||||
|
||||
|
||||
def test_ambiguous_choice_fails_closed():
|
||||
questions = [client.choice('decision', ['CONTINUE','ROUTE'])]
|
||||
with pytest.raises(TypeSafeContractError, match='AMBIGUOUS_DIRECT_CHOICE'):
|
||||
normalize_answers({'answers': {'__jev_q0_o0': {'noul': .81}, '__jev_q0_o1': {'noul': .78}}}, questions)
|
||||
|
||||
|
||||
def test_predicate_wire():
|
||||
questions = [client.predicate('allowed')]
|
||||
assert normalize_answers({'answers': {'__jev_q0': {'noul': .9}}}, questions)[0]['probability'] == .9
|
||||
|
||||
|
||||
def test_score_fails_closed():
|
||||
with pytest.raises(TypeSafeContractError, match='UNSUPPORTED_DIRECT_SCORE'):
|
||||
build_request('state', [client.score('score')])
|
||||
Reference in New Issue
Block a user