Skip to content

Commit 0fe6d6f

Browse files
update requiest payload contract to use steps.children
1 parent e255845 commit 0fe6d6f

7 files changed

Lines changed: 716 additions & 519 deletions

File tree

‎evaluators/contrib/galileo/src/agent_control_evaluator_galileo/__init__.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
UnsupportedStepTypeError,
3838
build_galileo_record,
3939
build_record,
40-
record_from_scorer_invoke_record,
4140
record_from_step,
4241
)
4342

@@ -57,6 +56,5 @@
5756
"UnsupportedStepTypeError",
5857
"build_galileo_record",
5958
"build_record",
60-
"record_from_scorer_invoke_record",
6159
"record_from_step",
6260
]

‎evaluators/contrib/galileo/src/agent_control_evaluator_galileo/luna/client.py‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
from hmac import new as hmac_new
1212
from json import dumps
1313
from time import time
14-
from typing import Literal, cast, get_args
14+
from typing import Literal, get_args
1515
from urllib.parse import urlsplit
1616

1717
import httpx
1818
from agent_control_models import JSONObject, JSONValue, Step
1919
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr, model_validator
2020

21+
from ..records import UnsupportedStepTypeError, record_from_step
2122
from .config import ScorerInvokeConfig
2223

2324
logger = logging.getLogger(__name__)
@@ -274,7 +275,7 @@ def to_dict(self) -> JSONObject:
274275
return request
275276

276277

277-
def _orbit_record_from_step(
278+
def _scorer_invoke_record_from_step(
278279
step: Step | None,
279280
*,
280281
selected_input: JSONValue,
@@ -299,21 +300,20 @@ def _orbit_record_from_step(
299300
Returns:
300301
An Orbit-compatible record, or ``None`` for absent/unsupported steps.
301302
"""
302-
if step is None or step.type not in SUPPORTED_SCORER_INVOKE_RECORD_TYPES:
303+
if step is None:
303304
return None
304-
305-
# The membership check above narrows the runtime value to Orbit's known
306-
# discriminator set, but static type checkers cannot infer that relationship.
307-
record_type = cast(ScorerInvokeRecordType, step.type)
308-
return ScorerInvokeRecord(
309-
type=record_type,
310-
name=step.name,
311-
input=selected_input if selected_input is not None else step.input,
312-
output=selected_output if selected_output is not None else step.output,
313-
context=step.context,
314-
tools=step.tools,
315-
dataset_output=step.ground_truth,
316-
)
305+
try:
306+
record = record_from_step(
307+
step,
308+
selected_input=selected_input,
309+
selected_output=selected_output,
310+
)
311+
except UnsupportedStepTypeError:
312+
return None
313+
canonical_record = record.model_dump(mode="json", exclude_none=True)
314+
if canonical_record.get("type") not in SUPPORTED_SCORER_INVOKE_RECORD_TYPES:
315+
return None
316+
return ScorerInvokeRecord.model_validate(canonical_record)
317317

318318

319319
class ScorerInvokeResponse(BaseModel):
@@ -543,7 +543,7 @@ async def invoke(
543543
ground_truth=step.ground_truth if step is not None else None,
544544
tools=step.tools if step is not None else None,
545545
),
546-
record=_orbit_record_from_step(
546+
record=_scorer_invoke_record_from_step(
547547
step,
548548
selected_input=input,
549549
selected_output=output,

‎evaluators/contrib/galileo/src/agent_control_evaluator_galileo/records/__init__.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
UnsupportedStepTypeError,
77
build_galileo_record,
88
build_record,
9-
record_from_scorer_invoke_record,
109
record_from_step,
1110
)
1211
from .normalization import GalileoRecordNormalizer
@@ -18,6 +17,5 @@
1817
"UnsupportedStepTypeError",
1918
"build_galileo_record",
2019
"build_record",
21-
"record_from_scorer_invoke_record",
2220
"record_from_step",
2321
]

0 commit comments

Comments
 (0)