feat: Revision third-party eval metrics adapter (DeepEval + Autoevals)#568
Open
stone-coding wants to merge 14 commits into
Open
feat: Revision third-party eval metrics adapter (DeepEval + Autoevals)#568stone-coding wants to merge 14 commits into
stone-coding wants to merge 14 commits into
Conversation
Introduces a new integrations/deepeval/ module that adapts AgentCore Lambda evaluation events into DeepEval LLMTestCase objects, runs any BaseMetric, and returns structured score/label/explanation responses.
…leTurnParams deprecation
…d EvaluatorInput support
… layer, simplify per TJ/Irene feedback
…ion, add validate_fields to DeepEvalAdapter
…xpected_response_text property
- Rename span_parsers → span_mappers, simplify to Strands-only - Rename field_mapper → customer_mapper across all adapters - customer_mapper now returns native types directly: - DeepEval: EvaluatorInput → LLMTestCase - Autoevals: EvaluatorInput → Dict[str, Any] (eval kwargs) - Refactor BaseAdapter: remove intermediate execute(), add _run() pattern - 83 unit tests passing
chianhw
reviewed
Jul 8, 2026
Comment on lines
+27
to
+31
| customer_mapper=lambda ev: { | ||
| "input": ev.session_spans[0]["attributes"]["question"], | ||
| "output": ev.session_spans[0]["attributes"]["answer"], | ||
| "expected": "the expected answer", | ||
| }, |
chianhw
reviewed
Jul 8, 2026
| def __init__( | ||
| self, | ||
| scorer: Any, | ||
| customer_mapper: Optional[Callable[[EvaluatorInput], Dict[str, Any]]] = None, |
There was a problem hiding this comment.
- We have not updated this type Dict[str, Any]?
- Regarding naming, "Custom mapper" would be a better choice for describing an arbitrary mapper provided by a customer?
chianhw
reviewed
Jul 8, 2026
| self, | ||
| scorer: Any, | ||
| customer_mapper: Optional[Callable[[EvaluatorInput], Dict[str, Any]]] = None, | ||
| threshold: float = 0.5, |
There was a problem hiding this comment.
label: Optional[str] = None label in EvaluatorOutput is optional.
We don't need to have a default value to generate a label when a metric doesn't have a label and the user doesn't provide any threshold. Can we set default as None?
chianhw
reviewed
Jul 8, 2026
| mapping when provided. Expected keys: input, output, expected (optional). | ||
| threshold: Score threshold for Pass/Fail determination. Defaults to 0.5. | ||
| """ | ||
| self.scorer = scorer |
There was a problem hiding this comment.
this naming is not aligned with DeepEval adaptor. Looks like you haven't updated AutoevalsAdapter.
If you haven't completed end to end tests for AutoevalsAdapter, you should not include it in your PR.
chianhw
reviewed
Jul 8, 2026
| customer_mapper=lambda ev: LLMTestCase( | ||
| input=ev.session_spans[0]["attributes"]["user_query"], | ||
| actual_output=ev.session_spans[0]["attributes"]["response"], | ||
| ), |
chianhw
reviewed
Jul 8, 2026
| def __init__( | ||
| self, | ||
| metric: BaseMetric, | ||
| customer_mapper: Optional[Callable[[EvaluatorInput], LLMTestCase]] = None, |
chianhw
reviewed
Jul 8, 2026
| self.metric = metric | ||
| self.customer_mapper = customer_mapper | ||
| if model is not None: | ||
| self.metric.model = model |
chianhw
reviewed
Jul 8, 2026
| Raises: | ||
| ValueError: If no mapper can extract data from the spans. | ||
| """ | ||
| result = _strands_mapper.map(session_spans) |
There was a problem hiding this comment.
We can check the span scope name and then decide which mapper to use.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AgentCore's code-based evaluator framework
OTel spans — supports both inline events (unified ADOT) and span body (CloudWatch ADOT) formats
library's native type directly:
retrieval_context, system_prompt, expected_output)
method when building the test case
structured errorCode/errorMessage
Test plan