Skip to content

feat: add disable cache option to parse #52

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
Aug 7, 2024
Merged
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
13 changes: 11 additions & 2 deletions gptscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,18 @@ func (g *GPTScript) Run(ctx context.Context, toolPath string, opts Options) (*Ru
}).NextChat(ctx, opts.Input)
}

type ParseOptions struct {
DisableCache bool
}

// Parse will parse the given file into an array of Nodes.
func (g *GPTScript) Parse(ctx context.Context, fileName string) ([]Node, error) {
out, err := g.runBasicCommand(ctx, "parse", map[string]any{"file": fileName})
func (g *GPTScript) Parse(ctx context.Context, fileName string, opts ...ParseOptions) ([]Node, error) {
var disableCache bool
for _, opt := range opts {
disableCache = disableCache || opt.DisableCache
}

out, err := g.runBasicCommand(ctx, "parse", map[string]any{"file": fileName, "disableCache": disableCache})
if err != nil {
return nil, err
}
Expand Down