Skip to content

Conversation

@TigranTigranTigran
Copy link
Collaborator

Changed DAGMetric type to Any in risk output schema to avoid JSON schema conversion error

Summary 📝

@NISH1001 As discussed yesterday, new output schema is:

class RiskAgentOutputSchema(OutputSchema):
    """
    Output schema for Risk Agent.
    """

    criteria_by_risk: Dict[str, List[Criterion]] = Field(
        ...,
        description="A mapping of risk IDs to sructured evaluation criteria.",
    )
    dag_metric: Optional[Any] = Field(
        ...,
        description="A DeepEval DAG metric constructed from the risk criteria.",
    )
    model_config = ConfigDict(arbitrary_types_allowed=True)

Details

  1. Changed dag_metric type from DAGMetric to Optional[Any]

Bugfixes 🐛

  • Fixed following failing unit tests:
FAILED tests/agents/risk/test_risk_agent.py::test_risk_agent_dag_generation - pydantic.errors.PydanticInvalidForJsonSchema: Cannot generate a JsonSchema for core_schema.IsInstanceSchema (<class 'deepeval.metrics.dag.dag.DAGMetric'>)
FAILED tests/agents/risk/test_risk_agent.py::test_build_dag_structure - pydantic.errors.PydanticInvalidForJsonSchema: Cannot generate a JsonSchema for core_schema.IsInstanceSchema (<class 'deepeval.metrics.dag.dag.DAGMetric'>)

Checks

  • Closed #798
  • Tested Changes
  • Stakeholder Approval

@github-actions
Copy link

❌ Tests failed (exit code: 1)

📊 Test Results

  • Passed: 546
  • Failed: 2
  • Skipped: 7
  • Warnings: 214
  • Coverage: 82%

Branch: bugfix/risks-output-schema
PR: #262
Commit: de6ed41

📋 Full coverage report and logs are available in the workflow run.

@TigranTigranTigran TigranTigranTigran deleted the bugfix/risks-output-schema branch October 24, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant