Skip to content

Commit 69b98b9

Browse files
committed
feat: add disable cache option to parse
Signed-off-by: Donnie Adams <[email protected]>
1 parent ecc199e commit 69b98b9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

gptscript.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,18 @@ func (g *GPTScript) Run(ctx context.Context, toolPath string, opts Options) (*Ru
150150
}).NextChat(ctx, opts.Input)
151151
}
152152

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

0 commit comments

Comments
 (0)