gptscript-ai / gptscript

Build AI assistants that interact with your systems
https://gptscript.ai
Apache License 2.0
3.07k stars 270 forks source link

Getting a panic error when attempting to use the runner as a library #56

Closed hectorj2f closed 8 months ago

hectorj2f commented 8 months ago

I am not sure if this is intentional but I've tried to use gptscript as a library to run my scripts and I always get the following error:

panic: runtime error: slice bounds out of range [:-1]

goroutine 1 [running]:
github.com/gptscript-ai/gptscript/pkg/mvl.Package()
    /Users/hectorfernandez/go/pkg/mod/github.com/gptscript-ai/gptscript@v0.1.1/pkg/mvl/log.go:51 +0x108
github.com/gptscript-ai/gptscript/pkg/builtin.init()
    /Users/hectorfernandez/go/pkg/mod/github.com/gptscript-ai/gptscript@v0.1.1/pkg/builtin/log.go:5 +0x24
FAIL    github.com/chainguard-dev/infra-images/wolfi-bump/pkg/gptscript/gptscript   0.287s
njhale commented 8 months ago

@hectorj2f thanks for reporting the issue!

It looks like this panic was fixed in main with #6126d27, which is also in v0.1.4 (currently the latest release tag).

Bumping the module version should resolve the issue. If it doesn't, or you run into any other issues trying to use the gptscript's packages directly, please let us know.

hectorj2f commented 8 months ago

Thanks @njhale!