aboutsummaryrefslogtreecommitdiff
path: root/llm/codeinterpreter/python
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2024-08-27 17:54:42 -0400
committerXe Iaso <me@xeiaso.net>2024-08-27 17:54:42 -0400
commit57284a25058002911ee571a576740888b6086313 (patch)
treeae863c83e4feb3ba406a75fe4681097510c5e924 /llm/codeinterpreter/python
parent374d545192421c08bff8283550525b5fd6600425 (diff)
downloadx-57284a25058002911ee571a576740888b6086313.tar.xz
x-57284a25058002911ee571a576740888b6086313.zip
cmd/mimi: fix tool use
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'llm/codeinterpreter/python')
-rw-r--r--llm/codeinterpreter/python/python.go20
1 files changed, 14 insertions, 6 deletions
diff --git a/llm/codeinterpreter/python/python.go b/llm/codeinterpreter/python/python.go
index 5f2ac6f..c90d9f6 100644
--- a/llm/codeinterpreter/python/python.go
+++ b/llm/codeinterpreter/python/python.go
@@ -32,8 +32,11 @@ func init() {
}
type Result struct {
- Stdout string
- Stderr string
+ UserCode string
+ Stdout string
+ Stderr string
+ PlatformError string
+ Instruction string
}
func Run(ctx context.Context, tmpDir, userCode string) (*Result, error) {
@@ -63,8 +66,11 @@ func Run(ctx context.Context, tmpDir, userCode string) (*Result, error) {
mod, err := r.InstantiateModule(ctx, code, config)
if err != nil {
result := &Result{
- Stdout: fout.String(),
- Stderr: ferr.String(),
+ UserCode: userCode,
+ Stdout: fout.String(),
+ Stderr: ferr.String(),
+ PlatformError: err.Error(),
+ Instruction: "Include the user code and any stderr or platform errors in code fences.",
}
return result, err
}
@@ -72,7 +78,9 @@ func Run(ctx context.Context, tmpDir, userCode string) (*Result, error) {
defer mod.Close(ctx)
return &Result{
- Stdout: fout.String(),
- Stderr: ferr.String(),
+ UserCode: userCode,
+ Stdout: fout.String(),
+ Stderr: ferr.String(),
+ Instruction: "Include the user code, output, and any stderr or platform errors in code fences.",
}, nil
}