Coverage for aipyapp/cli/command/result.py: 0%

1#!/usr/bin/env python3

2# -*- coding: utf-8 -*-

3

4 from typing import Any

5 from pydantic import BaseModel, model_validator

6

7

8 class CommandResult(BaseModel):

9 command: str

10 subcommand: str | None

11 args: dict[str, Any]

12 result: Any

13

14 class TaskModeResult(BaseModel):

15 task: Any | None = None

16 instruction: str | None = None

17 title: str | None = None

18

19 @model_validator(mode='after')

20 def validate_task_or_instruction(self):

21 if self.task is None and self.instruction is None:

22 raise ValueError("task or instruction must be provided")

23 return self

24

25