Skip to content

Commit

Permalink
feat: add disable cache option to parse
Browse files Browse the repository at this point in the history
Signed-off-by: Donnie Adams <[email protected]>
  • Loading branch information
thedadams committed Aug 7, 2024
1 parent ecc199e commit 69b98b9
Showing 1 changed file with 11 additions and 2 deletions.
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

0 comments on commit 69b98b9

Please sign in to comment.