Skip to content

to_dict

autogen.beta.eval.results.store.to_dict #

to_dict(result)

Serialize a :class:RunResult to a schema-0.1 JSON-safe dict.

The result is composed of plain JSON types (dict, list, str, int, float, bool, None). Pass it through :mod:json for the wire form.

Source code in autogen/beta/eval/results/store.py
def to_dict(result: "RunResult") -> dict[str, Any]:
    """Serialize a :class:`RunResult` to a schema-0.1 JSON-safe dict.

    The result is composed of plain JSON types (dict, list, str, int,
    float, bool, None). Pass it through :mod:`json` for the wire form.
    """
    return {
        "schema_version": result.schema_version,
        "run_id": result.run_id,
        "label": result.label,
        "created_at": result.created_at,
        "duration_ms": result.duration_ms,
        "suite": {
            "name": result.suite.name,
            "size": len(result.suite),
            "source": result.suite.source,
        },
        "target": result.target_path,
        "concurrency": result.concurrency,
        "tasks": [_task_to_dict(tr) for tr in result.tasks],
        "aggregates": _aggregates_to_dict(result.aggregates),
    }