plexus.cli.feedback.feedback_service module

Shared service for feedback item operations. This service provides a consistent interface for fetching feedback items that can be used by both CLI commands and MCP tools.

class plexus.cli.feedback.feedback_service.FeedbackItemSummary(item_id: str, external_id: str | None, initial_value: str | None, final_value: str | None, initial_explanation: str | None, final_explanation: str | None, edit_comment: str | None, item_text: str | None = None, item_metadata: Dict[str, Any] | None = None, item_description: str | None = None, item_identifiers: Dict[str, Any] | None = None)

Bases: object

Token-efficient summary of a feedback item for alignment work.

__init__(item_id: str, external_id: str | None, initial_value: str | None, final_value: str | None, initial_explanation: str | None, final_explanation: str | None, edit_comment: str | None, item_text: str | None = None, item_metadata: Dict[str, Any] | None = None, item_description: str | None = None, item_identifiers: Dict[str, Any] | None = None) None
edit_comment: str | None
external_id: str | None
final_explanation: str | None
final_value: str | None
initial_explanation: str | None
initial_value: str | None
item_description: str | None = None
item_id: str
item_identifiers: Dict[str, Any] | None = None
item_metadata: Dict[str, Any] | None = None
item_text: str | None = None
class plexus.cli.feedback.feedback_service.FeedbackSearchContext(scorecard_name: str, score_name: str, scorecard_id: str, score_id: str, account_id: str, filters: Dict[str, Any], total_found: int)

Bases: object

Context information for feedback search results.

__init__(scorecard_name: str, score_name: str, scorecard_id: str, score_id: str, account_id: str, filters: Dict[str, Any], total_found: int) None
account_id: str
filters: Dict[str, Any]
score_id: str
score_name: str
scorecard_id: str
scorecard_name: str
total_found: int
class plexus.cli.feedback.feedback_service.FeedbackSearchResult(context: FeedbackSearchContext, feedback_items: List[FeedbackItemSummary])

Bases: object

Complete feedback search result with context and items.

__init__(context: FeedbackSearchContext, feedback_items: List[FeedbackItemSummary]) None
context: FeedbackSearchContext
feedback_items: List[FeedbackItemSummary]
class plexus.cli.feedback.feedback_service.FeedbackService

Bases: object

Service class for feedback item operations. Provides consistent querying logic that can be shared between CLI and MCP tools.

async static find_feedback_items(client, scorecard_id: str, score_id: str, account_id: str, days: int | None, initial_value: str | None = None, final_value: str | None = None, limit: int | None = None, offset: int | None = None, prioritize_edit_comments: bool = True) List[FeedbackItem]

Find feedback items using the efficient GSI approach.

Args:

client: The GraphQL client instance scorecard_id: The scorecard ID to filter by score_id: The score ID to filter by account_id: The account ID to filter by days: Number of days back to search (None = all time) initial_value: Optional filter for initial answer value final_value: Optional filter for final answer value limit: Optional limit on number of items to return offset: Optional offset for pagination (number of items to skip) prioritize_edit_comments: Whether to prioritize items with edit comments when limiting

Returns:

List of FeedbackItem objects matching the criteria

static format_search_result_as_dict(result: FeedbackSearchResult) Dict[str, Any]

Convert a FeedbackSearchResult to a dictionary for JSON/YAML serialization.

Args:

result: The FeedbackSearchResult to convert

Returns:

Dictionary representation suitable for JSON/YAML output

static format_summary_result_as_dict(result: FeedbackSummaryResult) Dict[str, Any]

Convert a FeedbackSummaryResult to a dictionary for JSON/YAML serialization.

Args:

result: The FeedbackSummaryResult to convert

Returns:

Dictionary representation suitable for JSON/YAML output

static prioritize_feedback_with_edit_comments(feedback_items: List[FeedbackItem], limit: int | None = None, prioritize_edit_comments: bool = True) List[FeedbackItem]

Prioritize feedback items that have edit comments when applying a limit.

Args:

feedback_items: List of FeedbackItem objects limit: Maximum number of items to return (None for no limit) prioritize_edit_comments: Whether to prioritize items with edit comments

Returns:

List of prioritized and optionally limited feedback items

async static search_feedback(client, scorecard_name: str, score_name: str, scorecard_id: str, score_id: str, account_id: str, days: int | None, initial_value: str | None = None, final_value: str | None = None, limit: int | None = None, offset: int | None = None, prioritize_edit_comments: bool = True) FeedbackSearchResult

High-level search method that returns a structured result with context.

Args:

client: The GraphQL client instance scorecard_name: Human-readable scorecard name score_name: Human-readable score name scorecard_id: The scorecard ID to filter by score_id: The score ID to filter by account_id: The account ID to filter by days: Number of days back to search (None = all time) initial_value: Optional filter for initial answer value final_value: Optional filter for final answer value limit: Optional limit on number of items to return offset: Optional offset for pagination (number of items to skip) prioritize_edit_comments: Whether to prioritize items with edit comments when limiting

Returns:

FeedbackSearchResult with context and token-efficient summaries

async static summarize_feedback(client, scorecard_name: str, score_name: str, scorecard_id: str, score_id: str, account_id: str, days: int | None) FeedbackSummaryResult

Generate a comprehensive feedback summary including confusion matrix, accuracy, AC1 agreement, and actionable recommendations.

Args:

client: The GraphQL client instance scorecard_name: Human-readable scorecard name score_name: Human-readable score name scorecard_id: The scorecard ID to filter by score_id: The score ID to filter by account_id: The account ID to filter by days: Number of days back to search (None = all time)

Returns:

FeedbackSummaryResult with context, analysis, and recommendations

class plexus.cli.feedback.feedback_service.FeedbackSummaryResult(context: FeedbackSearchContext, analysis: Dict[str, Any], recommendation: str)

Bases: object

Complete feedback summary with context and analysis.

__init__(context: FeedbackSearchContext, analysis: Dict[str, Any], recommendation: str) None
analysis: Dict[str, Any]
context: FeedbackSearchContext
recommendation: str