plexus.cli.shared.universal_code module
Universal Code generator for task outputs.
Converts command outputs to Universal Code YAML format with contextual comments for use with AI tools, documentation, and sharing.
- plexus.cli.shared.universal_code.detect_task_type_from_command(command: str) → str
Detect the task type based on the command.
- Args:
command: The command string
- Returns:
str: The detected task type
- plexus.cli.shared.universal_code.extract_score_from_command(command: str) → str | None
Extract score name from command arguments.
- Args:
command: The command string
- Returns:
Optional[str]: The score name if found
- plexus.cli.shared.universal_code.extract_scorecard_from_command(command: str) → str | None
Extract scorecard name from command arguments.
- Args:
command: The command string
- Returns:
Optional[str]: The scorecard name if found
- plexus.cli.shared.universal_code.generate_evaluation_universal_code(command: str, output_data: Any, scorecard_name: str | None = None) → str
Generate Universal Code specifically for evaluation tasks.
- Args:
command: The evaluation command that was executed output_data: Output data from the evaluation scorecard_name: Name of the scorecard evaluated
- Returns:
str: Universal Code YAML for the evaluation
- plexus.cli.shared.universal_code.generate_prediction_universal_code(command: str, json_output: str, scorecard_name: str | None = None, score_name: str | None = None) → str
Generate Universal Code specifically for prediction tasks.
- Args:
command: The prediction command that was executed json_output: JSON output from the prediction scorecard_name: Name of the scorecard used score_name: Name of the score predicted
- Returns:
str: Universal Code YAML for the prediction
- plexus.cli.shared.universal_code.generate_universal_code_yaml(command: str, output_data: Any, task_type: str, task_description: str | None = None, scorecard_name: str | None = None, score_name: str | None = None) → str
Generate Universal Code YAML from command output.
- Args:
command: The command that was executed output_data: The parsed output data (dict, list, or string) task_type: Type of task (e.g., “Prediction”, “Evaluation”, “Analysis”) task_description: Optional description of what the task does scorecard_name: Optional scorecard name for context score_name: Optional score name for context
- Returns:
str: YAML formatted Universal Code with contextual comments