Skip to content

feat: add flag to disable tools from running concurrently #332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions pkg/cli/gptscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/gptscript-ai/gptscript/pkg/monitor"
"github.com/gptscript-ai/gptscript/pkg/mvl"
"github.com/gptscript-ai/gptscript/pkg/openai"
"github.com/gptscript-ai/gptscript/pkg/runner"
"github.com/gptscript-ai/gptscript/pkg/server"
"github.com/gptscript-ai/gptscript/pkg/types"
"github.com/gptscript-ai/gptscript/pkg/version"
Expand Down Expand Up @@ -61,6 +62,7 @@ type GPTScript struct {
CredentialOverride string `usage:"Credentials to override (ex: --credential-override github.com/example/cred-tool:API_TOKEN=1234)"`
ChatState string `usage:"The chat state to continue, or null to start a new chat and return the state"`
ForceChat bool `usage:"Force an interactive chat session if even the top level tool is not a chat tool"`
ForceSequential bool `usage:"Force parallel calls to run sequentially"`
Workspace string `usage:"Directory to use for the workspace, if specified it will not be deleted on exit"`

readData []byte
Expand Down Expand Up @@ -124,9 +126,13 @@ func (r *GPTScript) NewRunContext(cmd *cobra.Command) context.Context {

func (r *GPTScript) NewGPTScriptOpts() (gptscript.Options, error) {
opts := gptscript.Options{
Cache: cache.Options(r.CacheOptions),
OpenAI: openai.Options(r.OpenAIOptions),
Monitor: monitor.Options(r.DisplayOptions),
Cache: cache.Options(r.CacheOptions),
OpenAI: openai.Options(r.OpenAIOptions),
Monitor: monitor.Options(r.DisplayOptions),
Runner: runner.Options{
CredentialOverride: r.CredentialOverride,
Sequential: r.ForceSequential,
},
Quiet: r.Quiet,
Env: os.Environ(),
CredentialContext: r.CredentialContext,
Expand All @@ -150,8 +156,6 @@ func (r *GPTScript) NewGPTScriptOpts() (gptscript.Options, error) {
opts.Runner.EndPort = endNum
}

opts.Runner.CredentialOverride = r.CredentialOverride

if r.EventsStreamTo != "" {
mf, err := monitor.NewFileFactory(r.EventsStreamTo)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/loader/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func Load(ctx context.Context, _ *cache.Client, urlName string) (string, *types.

if path == "" || path == "/" {
path = "tool.gpt"
} else if !strings.HasSuffix(path, system.Suffix) {
} else if !strings.HasSuffix(path, system.Suffix) && !strings.Contains(parts[len(parts)-1], ".") {
path += "/tool.gpt"
}

Expand Down