🔍 Code Extractor

class EditingWorkflowResult

Maturity: 43

A dataclass that encapsulates the results from an editing workflow process, including detected annotations, confidence scores, recommendations, and optional rewritten content.

File:
/tf/active/vicechatdev/e-ink-llm/editing_workflow.py
Lines:
19 - 26
Complexity:
simple

Purpose

EditingWorkflowResult serves as a structured container for the output of an editing workflow. It stores metrics about detected annotations, confidence scores, actionable recommendations, and optionally the rewritten content, detailed annotation information, and a workflow summary. This class is designed to be instantiated as a return value from editing workflow operations, providing a standardized way to communicate results between components.

Source Code

class EditingWorkflowResult:
    """Result from the editing workflow process"""
    annotations_detected: int
    confidence_score: float
    recommendations: List[str]
    rewritten_content: Optional[str] = None
    annotation_details: Optional[List[Dict[str, Any]]] = None
    workflow_summary: Optional[str] = None

Parameters

Name Type Default Kind
bases - -

Parameter Details

annotations_detected: Integer count of the total number of annotations detected in the processed content. This is a required field that indicates how many editing marks, comments, or annotations were found.

confidence_score: Float value representing the confidence level of the detection and processing, typically ranging from 0.0 to 1.0. Higher values indicate greater confidence in the results. This is a required field.

recommendations: List of string recommendations generated during the workflow. These are actionable suggestions or insights derived from the editing process. This is a required field and should contain at least one recommendation.

rewritten_content: Optional string containing the rewritten or edited version of the original content. If the workflow includes content rewriting, this field will contain the modified text; otherwise, it remains None.

annotation_details: Optional list of dictionaries, where each dictionary contains detailed information about individual annotations. Each dictionary can have arbitrary keys and values (Dict[str, Any]) to store metadata like annotation type, location, severity, etc.

workflow_summary: Optional string providing a high-level summary of the entire workflow execution, including key findings, processing steps taken, or overall assessment.

Return Value

As a dataclass, instantiation returns an EditingWorkflowResult object with all specified attributes initialized. The object is immutable by default (unless frozen=False is explicitly set) and provides automatic __init__, __repr__, and __eq__ methods. The instance serves as a data transfer object containing all workflow results.

Class Interface

Methods

__init__(annotations_detected: int, confidence_score: float, recommendations: List[str], rewritten_content: Optional[str] = None, annotation_details: Optional[List[Dict[str, Any]]] = None, workflow_summary: Optional[str] = None) -> None

Purpose: Initializes a new EditingWorkflowResult instance with the provided workflow results. This method is automatically generated by the @dataclass decorator.

Parameters:

  • annotations_detected: Integer count of detected annotations
  • confidence_score: Float confidence score (typically 0.0-1.0)
  • recommendations: List of recommendation strings
  • rewritten_content: Optional rewritten text content
  • annotation_details: Optional list of dictionaries with annotation metadata
  • workflow_summary: Optional summary string of the workflow

Returns: None (constructor)

__repr__() -> str

Purpose: Returns a string representation of the EditingWorkflowResult instance showing all field values. Automatically generated by @dataclass.

Returns: String representation in the format 'EditingWorkflowResult(annotations_detected=..., confidence_score=..., ...)'

__eq__(other: object) -> bool

Purpose: Compares two EditingWorkflowResult instances for equality based on all field values. Automatically generated by @dataclass.

Parameters:

  • other: Another object to compare with

Returns: True if all fields are equal, False otherwise

Attributes

Name Type Description Scope
annotations_detected int The total number of annotations detected during the workflow process instance
confidence_score float A confidence score indicating the reliability of the workflow results, typically between 0.0 and 1.0 instance
recommendations List[str] A list of actionable recommendations generated from the editing workflow instance
rewritten_content Optional[str] The rewritten or edited content if content rewriting was performed, otherwise None instance
annotation_details Optional[List[Dict[str, Any]]] Detailed information about each annotation as a list of dictionaries, or None if not provided instance
workflow_summary Optional[str] A high-level summary of the workflow execution and results, or None if not provided instance

Dependencies

  • dataclasses
  • typing

Required Imports

from dataclasses import dataclass
from typing import Optional, List, Dict, Any

Usage Example

from dataclasses import dataclass
from typing import Optional, List, Dict, Any

@dataclass
class EditingWorkflowResult:
    annotations_detected: int
    confidence_score: float
    recommendations: List[str]
    rewritten_content: Optional[str] = None
    annotation_details: Optional[List[Dict[str, Any]]] = None
    workflow_summary: Optional[str] = None

# Basic instantiation with required fields only
result = EditingWorkflowResult(
    annotations_detected=5,
    confidence_score=0.92,
    recommendations=["Fix grammar in paragraph 2", "Clarify argument in section 3"]
)

# Full instantiation with all optional fields
detailed_result = EditingWorkflowResult(
    annotations_detected=3,
    confidence_score=0.87,
    recommendations=["Review tone", "Add citations"],
    rewritten_content="This is the revised text...",
    annotation_details=[
        {"type": "grammar", "location": "line 5", "severity": "high"},
        {"type": "style", "location": "line 12", "severity": "medium"}
    ],
    workflow_summary="Processed 3 annotations with high confidence. Major issues addressed."
)

# Accessing attributes
print(f"Detected {result.annotations_detected} annotations")
print(f"Confidence: {result.confidence_score}")
for rec in result.recommendations:
    print(f"- {rec}")

Best Practices

  • Always provide values for the three required fields (annotations_detected, confidence_score, recommendations) when instantiating.
  • Use confidence_score values between 0.0 and 1.0 for consistency with standard probability conventions.
  • Populate annotation_details when detailed tracking of individual annotations is needed for debugging or reporting.
  • Include rewritten_content only when the workflow actually performs content rewriting to avoid confusion.
  • Use workflow_summary to provide human-readable context about the processing results.
  • This is an immutable data container by default; avoid modifying attributes after instantiation unless the dataclass is explicitly made mutable.
  • When passing this result between components, all consumers should handle the optional fields gracefully (check for None before accessing).
  • Consider validating that annotations_detected matches the length of annotation_details if both are provided.
  • The recommendations list should never be empty when instantiated; always provide at least one recommendation or use an empty list explicitly.

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class AnnotationResult 69.4% similar

    A dataclass that encapsulates the results of an annotation detection process on PDF documents, containing detected annotations, processing statistics, and a summary.

    From: /tf/active/vicechatdev/e-ink-llm/annotation_detector.py
  • class AnalysisResult 66.8% similar

    A dataclass that encapsulates the results from statistical analysis operations, including metadata, file paths, and timestamps.

    From: /tf/active/vicechatdev/vice_ai/smartstat_models.py
  • class AnalysisResult_v1 65.6% similar

    A dataclass that encapsulates the results from statistical analysis operations, including metadata, file paths, and timestamps.

    From: /tf/active/vicechatdev/vice_ai/models.py
  • class AnalysisResult_v1 62.5% similar

    A dataclass that encapsulates results from statistical analysis operations, providing structured storage and serialization capabilities for analysis outputs.

    From: /tf/active/vicechatdev/vice_ai/models.py
  • class IterationResult 62.3% similar

    A dataclass that encapsulates the complete results of a single iteration in a two-pass process, including table selection, SQL generation, and execution outcomes.

    From: /tf/active/vicechatdev/full_smartstat/two_pass_sql_workflow.py
← Back to Browse