The Code Execution Models define data structures for code execution results, logs, and errors. These models provide enhanced support for multi-format outputs and detailed execution information.
Code module data models.
@dataclass
class ExecutionResult()Single execution result supporting multiple formats
def formats() -> List[str]Returns all available formats
@dataclass
class ExecutionLogs()Execution logs
stdout = field(default_factory=list)stderr = field(default_factory=list)@dataclass
class ExecutionError()Detailed error information
name = Nonevalue = Nonetraceback = None@dataclass
class EnhancedCodeExecutionResult(ApiResponse)Enhanced code execution result
@property
def result() -> strBackward compatible text result
class CodeExecutionResult(ApiResponse)Result of code execution operations. Kept for backward compatibility but users should transition to EnhancedCodeExecutionResult.
def __init__(self, request_id: str = "",
success: bool = False,
result: str = "",
error_message: str = "")Initialize a CodeExecutionResult.
Arguments:
request_idstr, optional - Unique identifier for the API request.successbool, optional - Whether the operation was successful.resultstr, optional - The execution result.error_messagestr, optional - Error message if the operation failed.
Related APIs:
Documentation generated automatically from source code using pydoc-markdown.