Represents a file in the CodeBox environment:
class RemoteFile:
path: str # File path in CodeBox
remote: CodeBox # Associated CodeBox instanceget_content():Get file contentsaget_content():Async get contentssave(path):Save to local pathasave(path):Async save to local path
Represents an execution output chunk:
class ExecChunk:
type: Literal["txt", "img", "err"] # Output type
content: str # Chunk contenttxt:Text outputimg:Base64 encoded imageerr:Error message
Complete execution result:
class ExecResult:
chunks: List[ExecChunk] # List of output chunkstext:Combined text outputimages:List of image outputserrors:List of error messages
# File handling
codebox = CodeBox()
# Upload and get file
file = codebox.upload("test.txt", "content")
content = file.get_content()
# Execute code and handle result
result = codebox.exec("print('hello')")
print(result.text) # Text output
print(result.errors) # Any errors