Skip to content

Commit 22c1258

Browse files
authored
Merge pull request #52 from thedadams/add-disable-cache-parse
feat: add disable cache option to parse
2 parents 0e3b99f + 69b98b9 commit 22c1258

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

gptscript.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,18 @@ func (g *GPTScript) Run(ctx context.Context, toolPath string, opts Options) (*Ru
153153
}).NextChat(ctx, opts.Input)
154154
}
155155

156+
type ParseOptions struct {
157+
DisableCache bool
158+
}
159+
156160
// Parse will parse the given file into an array of Nodes.
157-
func (g *GPTScript) Parse(ctx context.Context, fileName string) ([]Node, error) {
158-
out, err := g.runBasicCommand(ctx, "parse", map[string]any{"file": fileName})
161+
func (g *GPTScript) Parse(ctx context.Context, fileName string, opts ...ParseOptions) ([]Node, error) {
162+
var disableCache bool
163+
for _, opt := range opts {
164+
disableCache = disableCache || opt.DisableCache
165+
}
166+
167+
out, err := g.runBasicCommand(ctx, "parse", map[string]any{"file": fileName, "disableCache": disableCache})
159168
if err != nil {
160169
return nil, err
161170
}

0 commit comments

Comments
 (0)