Skip to content

Commit 498ccd9

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

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

gptscript/gptscript.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import json
2-
import platform
32
import os
4-
from socket import socket
3+
import platform
54
from subprocess import Popen, PIPE
65
from sys import executable
76
from time import sleep
@@ -95,8 +94,8 @@ def run(
9594
"" if opts is None else opts.input
9695
)
9796

98-
async def parse(self, file_path: str) -> list[Text | Tool]:
99-
out = await self._run_basic_command("parse", {"file": file_path})
97+
async def parse(self, file_path: str, disable_cache: bool = False) -> list[Text | Tool]:
98+
out = await self._run_basic_command("parse", {"file": file_path, "disableCache": disable_cache})
10099
parsed_nodes = json.loads(out)
101100
return [Text(**node["textNode"]) if "textNode" in node else Tool(**node.get("toolNode", {}).get("tool", {})) for
102101
node in parsed_nodes.get("nodes", [])]

tests/test_gptscript.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ async def collect_events(run: Run, e: CallFrame | RunFrame | PromptFrame):
187187
assert "Ronald Reagan" in await run.text(), "Expect streaming file to have correct output"
188188
assert "Ronald Reagan" in stream_output, "Expect stream_output to have correct output when streaming from file"
189189

190+
190191
@pytest.mark.asyncio
191192
async def test_credential_override(gptscript):
192193
gptscriptFile = "credential-override.gpt"
@@ -201,6 +202,7 @@ async def test_credential_override(gptscript):
201202
)
202203
assert "foo" in await run.text(), "Expect credential override to have correct output"
203204

205+
204206
@pytest.mark.asyncio
205207
async def test_eval_with_context(gptscript):
206208
wd = os.getcwd()

0 commit comments

Comments
 (0)