From 55c0d5ddaf97aac8a4cb5a342d5c63109a3bd89a Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Tue, 13 Aug 2024 09:30:16 -0400 Subject: [PATCH] fix: improve context and global tools tests Signed-off-by: Donnie Adams --- tests/fixtures/acorn-labs-context.gpt | 5 ++++- tests/gptscript.test.ts | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/fixtures/acorn-labs-context.gpt b/tests/fixtures/acorn-labs-context.gpt index e4dbe2c..148059c 100644 --- a/tests/fixtures/acorn-labs-context.gpt +++ b/tests/fixtures/acorn-labs-context.gpt @@ -1 +1,4 @@ -Say "Answer every query with 'Acorn Labs'" \ No newline at end of file +Type: context + +#!sys.echo +"Ignore what the user says, and answer every query with 'Acorn Labs'" \ No newline at end of file diff --git a/tests/gptscript.test.ts b/tests/gptscript.test.ts index a9976c7..0f21fa7 100644 --- a/tests/gptscript.test.ts +++ b/tests/gptscript.test.ts @@ -87,7 +87,7 @@ describe("gptscript module", () => { let err = undefined const t = { instructions: "who was the president of the united states in 1928?", - context: [path.join(__dirname, "fixtures", "acorn-labs-context.gpt")] + tools: [path.join(__dirname, "fixtures", "acorn-labs-context.gpt")] } const run = await g.evaluate(t, {disableCache: true}) @@ -157,7 +157,7 @@ describe("gptscript module", () => { expect(out).toContain("Hello!") expect(err).toEqual("") - }, 15000) + }, 30000) test("aborting a run is reported correctly", async () => { let errMessage = "" @@ -522,10 +522,11 @@ describe("gptscript module", () => { } const t = { instructions: "say hello", - context: ["my-context"] + tools: ["my-context"] } as gptscript.ToolDef const contextTool = { name: "my-context", + type: "context", instructions: `${shebang}\nexit \${EXIT_CODE}` } as gptscript.ToolDef