From 0ec49d9df04627afe4518f4689dc212c0d03cdd6 Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Wed, 21 Aug 2024 18:18:24 -0400 Subject: [PATCH 1/9] fix: use correct field name toolID Signed-off-by: Donnie Adams --- src/gptscript.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gptscript.ts b/src/gptscript.ts index c47e56a..b18c152 100644 --- a/src/gptscript.ts +++ b/src/gptscript.ts @@ -421,7 +421,7 @@ export class Run { if (out.done === undefined || !out.done) { this.chatState = JSON.stringify(out.state) this.state = RunState.Continue - this.respondingToolId = out.toolId + this.respondingToolId = out.toolID } else { this.state = RunState.Finished this.chatState = undefined @@ -704,7 +704,7 @@ interface ChatState { state: string done: boolean content: string - toolId: string + toolID: string } export type Arguments = string | Record From 02462fa3f9c08bf11cbdef99d8f28db132d6b359 Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Thu, 22 Aug 2024 11:59:29 -0400 Subject: [PATCH 2/9] fix: add entryToolId to program Signed-off-by: Donnie Adams --- src/gptscript.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gptscript.ts b/src/gptscript.ts index b18c152..3694b41 100644 --- a/src/gptscript.ts +++ b/src/gptscript.ts @@ -719,6 +719,7 @@ export interface ArgumentSchema { export interface Program { name: string + entryToolId: string toolSet: Record openAPICache: Record } From 5c4094546790ec408b64f27234865be9d9bef065 Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Mon, 26 Aug 2024 13:42:01 -0400 Subject: [PATCH 3/9] chore: add NODE_ENV to environment when exec-ing SDK server Signed-off-by: Donnie Adams --- src/gptscript.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gptscript.ts b/src/gptscript.ts index 3694b41..fa12911 100644 --- a/src/gptscript.ts +++ b/src/gptscript.ts @@ -85,7 +85,9 @@ export class GPTScript { if (GPTScript.instanceCount === 1 && process.env.GPTSCRIPT_DISABLE_SERVER !== "true") { let env = process.env if (this.opts.Env) { - env = {} + env = { + "NODE_ENV": process.env.NODE_ENV + } for (const v of this.opts.Env) { const equalIndex = v.indexOf("=") if (equalIndex === -1) { From a95a432af16f28dd203eb1543e0eb9df50837bf3 Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Fri, 30 Aug 2024 00:39:15 -0400 Subject: [PATCH 4/9] fix: adjust some types and ensure errors are thrown with tests Signed-off-by: Donnie Adams --- package-lock.json | 60 ++++++++++----------------- src/gptscript.ts | 20 ++++----- tests/fixtures/acorn-labs-context.gpt | 2 +- tests/fixtures/test-with-context.gpt | 12 ++++++ tests/gptscript.test.ts | 60 +++++++++++++++++++++------ 5 files changed, 91 insertions(+), 63 deletions(-) create mode 100644 tests/fixtures/test-with-context.gpt diff --git a/package-lock.json b/package-lock.json index af8c116..341b7d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2938,33 +2938,12 @@ "@types/responselike": "^1.0.0" } }, - "node_modules/@types/eslint": { - "version": "8.56.10", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.10.tgz", - "integrity": "sha512-Shavhk87gCtY2fhXDctcfS3e6FdxWkCx1iUZ9eEUbh7rTqlZT0/IzOkCOVt0fCjcFuZ9FPYfuezTBImfHCDBGQ==", - "dev": true, - "peer": true, - "dependencies": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, - "node_modules/@types/eslint-scope": { - "version": "3.7.7", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", - "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", - "dev": true, - "peer": true, - "dependencies": { - "@types/eslint": "*", - "@types/estree": "*" - } - }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true, + "license": "MIT", "peer": true }, "node_modules/@types/graceful-fs": { @@ -3274,11 +3253,12 @@ "node": ">=0.4.0" } }, - "node_modules/acorn-import-assertions": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz", - "integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==", + "node_modules/acorn-import-attributes": { + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", + "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", "dev": true, + "license": "MIT", "peer": true, "peerDependencies": { "acorn": "^8" @@ -4646,10 +4626,11 @@ } }, "node_modules/enhanced-resolve": { - "version": "5.16.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.16.1.tgz", - "integrity": "sha512-4U5pNsuDl0EhuZpq46M5xPslstkviJuhrdobaRDBk2Jy2KO37FDAJl4lb2KlNabxT0m4MTK2UHNrsAcphE8nyw==", + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", + "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", "dev": true, + "license": "MIT", "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -8018,12 +7999,13 @@ } }, "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { - "braces": "^3.0.2", + "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { @@ -10514,22 +10496,22 @@ } }, "node_modules/webpack": { - "version": "5.91.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.91.0.tgz", - "integrity": "sha512-rzVwlLeBWHJbmgTC/8TvAcu5vpJNII+MelQpylD4jNERPwpBJOE2lEcko1zJX3QJeLjTTAnQxn/OJ8bjDzVQaw==", + "version": "5.94.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz", + "integrity": "sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==", "dev": true, + "license": "MIT", "peer": true, "dependencies": { - "@types/eslint-scope": "^3.7.3", "@types/estree": "^1.0.5", "@webassemblyjs/ast": "^1.12.1", "@webassemblyjs/wasm-edit": "^1.12.1", "@webassemblyjs/wasm-parser": "^1.12.1", "acorn": "^8.7.1", - "acorn-import-assertions": "^1.9.0", + "acorn-import-attributes": "^1.9.5", "browserslist": "^4.21.10", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.16.0", + "enhanced-resolve": "^5.17.1", "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", diff --git a/src/gptscript.ts b/src/gptscript.ts index fa12911..a73ec2e 100644 --- a/src/gptscript.ts +++ b/src/gptscript.ts @@ -186,7 +186,7 @@ export class GPTScript { * @param {RunOpts} [opts={}] - Optional options for the evaluation. * @return {Run} The Run object representing the evaluation. */ - async evaluate(tool: ToolDef | ToolDef[], opts: RunOpts = {}): Promise { + async evaluate(tool: Tool | ToolDef | ToolDef[], opts: RunOpts = {}): Promise { if (!this.ready) { this.ready = await this.testGPTScriptURL(20) } @@ -482,10 +482,10 @@ export class Run { resolve(this.stdout) } else { this.state = RunState.Error - reject(this.stderr) + reject(new Error(this.stderr)) } } else if (this.state === RunState.Error) { - reject(this.err) + reject(new Error(this.err)) } }) @@ -493,7 +493,7 @@ export class Run { if (this.state !== RunState.Finished && this.state !== RunState.Error) { this.state = RunState.Error this.err = "Run has been aborted" - reject(this.err) + reject(new Error(this.err)) } }) @@ -502,7 +502,7 @@ export class Run { this.state = RunState.Error this.err = error.message || "" } - reject(this.err) + reject(new Error(this.err)) }) }) @@ -511,7 +511,7 @@ export class Run { this.state = RunState.Error this.err = error.message || "" } - reject(this.err) + reject(new Error(this.err)) }) this.req.write(JSON.stringify({...tool, ...this.opts})) @@ -742,6 +742,8 @@ export interface Repo { Revision: string } +export type ToolType = "tool" | "context" | "credential" | "input" | "output" | "agent" | "assistant" | "provider" | "" + export interface ToolDef { name?: string description?: string @@ -763,7 +765,7 @@ export interface ToolDef { agents?: string[] credentials?: string[] instructions?: string - type?: string + type?: ToolType metaData?: Record } @@ -774,11 +776,9 @@ export interface ToolReference { toolID: string } -export const ToolType = "tool" as const export interface Tool extends ToolDef { id: string - type: typeof ToolType toolMapping?: Record localTools?: Record source?: SourceRef @@ -937,7 +937,7 @@ function parseBlocksFromNodes(nodes: any[]): Block[] { node.toolNode.tool.id = randomId("tool-") } blocks.push({ - type: "tool", + type: node.toolNode.tool.type || "tool", ...node.toolNode.tool, } as Tool) } diff --git a/tests/fixtures/acorn-labs-context.gpt b/tests/fixtures/acorn-labs-context.gpt index 148059c..a814d65 100644 --- a/tests/fixtures/acorn-labs-context.gpt +++ b/tests/fixtures/acorn-labs-context.gpt @@ -1,4 +1,4 @@ Type: context #!sys.echo -"Ignore what the user says, and answer every query with 'Acorn Labs'" \ No newline at end of file +"Always respond with 'Acorn Labs' and nothing else" \ No newline at end of file diff --git a/tests/fixtures/test-with-context.gpt b/tests/fixtures/test-with-context.gpt new file mode 100644 index 0000000..88b2aeb --- /dev/null +++ b/tests/fixtures/test-with-context.gpt @@ -0,0 +1,12 @@ +Name: main +Tools: acorn + +Just wait. + +--- + +Name: acorn +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 1352840..77709b7 100644 --- a/tests/gptscript.test.ts +++ b/tests/gptscript.test.ts @@ -1,5 +1,5 @@ import * as gptscript from "../src/gptscript" -import {ArgumentSchemaType, getEnv, PropertyType, RunEventType, ToolType} from "../src/gptscript" +import {ArgumentSchemaType, getEnv, PropertyType, RunEventType, TextType, ToolType} from "../src/gptscript" import path from "path" import {fileURLToPath} from "url" @@ -124,6 +124,7 @@ describe("gptscript module", () => { let out = "" let err = undefined const t = { + type: "tool" as ToolType, instructions: "who was the president of the united states in 1928?", tools: [path.join(__dirname, "fixtures", "acorn-labs-context.gpt")] } @@ -213,7 +214,7 @@ describe("gptscript module", () => { await run.text() err = run.err } catch (error: any) { - errMessage = error + errMessage = error.toString() } expect(errMessage).toContain("aborted") @@ -285,6 +286,35 @@ describe("gptscript module", () => { expect(response).toHaveLength(0) }, 30000) + test("parse non-existent file", async () => { + try { + await g.parse(path.join(__dirname, "fixtures", "non-existent.gpt")) + } catch (e) { + expect(e).toBeDefined() + return + } + expect(false).toBeTruthy() + }, 30000) + + test("parse non-existent url", async () => { + try { + await g.parse("github.com/thedadams/dne") + } catch (e) { + expect(e).toBeDefined() + return + } + expect(false).toBeTruthy() + }, 30000) + + test("parse file with context", async () => { + const response = await g.parse(path.join(__dirname, "fixtures", "test-with-context.gpt")) + expect(response).toBeDefined() + expect(response).toHaveLength(2) + expect((response[0] as gptscript.Tool).instructions).toEqual("Just wait.") + expect((response[0] as gptscript.Tool).type).toEqual("tool") + expect((response[1] as gptscript.Tool).type).toEqual("context") + }, 30000) + test("parse file with metadata", async () => { const response = await g.parse(path.join(__dirname, "fixtures", "parse-with-metadata.gpt")) expect(response).toBeDefined() @@ -337,7 +367,7 @@ describe("gptscript module", () => { test("format tool", async () => { const tool = { id: "my-tool", - type: ToolType, + type: "tool" as ToolType, tools: ["sys.write", "sys.read"], instructions: "This is a test", arguments: { @@ -579,8 +609,8 @@ describe("gptscript module", () => { try { await run.text() - } catch (e) { - expect(e).toContain("prompt occurred") + } catch (e: any) { + expect(e.toString()).toContain("prompt occurred") } expect(run.err).toContain("prompt occurred") expect(promptFound).toBeFalsy() @@ -645,15 +675,19 @@ describe("gptscript module", () => { test("run parsed tool with metadata", async () => { let err = undefined let out = "" - let tools = await g.parse(path.join(__dirname, "fixtures", "parse-with-metadata.gpt")) - - let run = await g.evaluate(tools[0]) - - try { - out = await run.text() - } catch (e) { - err = e + const tools = await g.parse(path.join(__dirname, "fixtures", "parse-with-metadata.gpt")) + + for (const t of tools) { + if (t.type && t.type !== TextType) { + const run = await g.evaluate(t) + try { + out = await run.text() + } catch (e) { + err = e + } + } } + expect(err).toEqual(undefined) expect(out).toEqual("200") }, 20000) From ad748d9766e96f3eb10e1e3e20ac30393af7e5b9 Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Fri, 30 Aug 2024 10:56:12 -0400 Subject: [PATCH 5/9] chore: remove listTools Signed-off-by: Donnie Adams --- README.md | 17 ----------------- src/gptscript.ts | 4 ---- tests/gptscript.test.ts | 5 ----- 3 files changed, 26 deletions(-) diff --git a/README.md b/README.md index 74b8227..c17a4c4 100644 --- a/README.md +++ b/README.md @@ -66,23 +66,6 @@ As noted above, the Global Options are also available to specify here. These opt ## Functions -### listTools - -Lists all the available built-in tools. - -**Usage:** - -```javascript -const gptscript = require('@gptscript-ai/gptscript'); - -async function listTools() { - const g = new gptscript.GPTScript(); - const tools = await g.listTools(); - console.log(tools); - g.close(); -} -``` - ### listModels Lists all the available models, returns a list. diff --git a/src/gptscript.ts b/src/gptscript.ts index a73ec2e..cfb8cfe 100644 --- a/src/gptscript.ts +++ b/src/gptscript.ts @@ -133,10 +133,6 @@ export class GPTScript { } } - listTools(): Promise { - return this.runBasicCommand("list-tools") - } - listModels(providers?: string[], credentialOverrides?: string[]): Promise { if (this.opts.DefaultModelProvider) { if (!providers) { diff --git a/tests/gptscript.test.ts b/tests/gptscript.test.ts index 77709b7..42b4398 100644 --- a/tests/gptscript.test.ts +++ b/tests/gptscript.test.ts @@ -29,11 +29,6 @@ describe("gptscript module", () => { other.close() }) - test("listTools returns available tools", async () => { - const tools = await g.listTools() - expect(tools).toBeDefined() - }) - test("listModels returns a list of models", async () => { // Similar structure to listTools let models = await g.listModels() From 7a327070ede4a4d0fbbdad9977fbe10e0fcaa4ae Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Fri, 30 Aug 2024 12:34:44 -0400 Subject: [PATCH 6/9] fix: stringify non-tool tools Signed-off-by: Donnie Adams --- src/gptscript.ts | 12 ++++++------ tests/gptscript.test.ts | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/gptscript.ts b/src/gptscript.ts index cfb8cfe..099c5bc 100644 --- a/src/gptscript.ts +++ b/src/gptscript.ts @@ -215,16 +215,16 @@ export class GPTScript { const nodes: any[] = [] for (const block of blocks) { - if (block.type === "tool") { + if (block.type === "text") { nodes.push({ - toolNode: { - tool: block + textNode: { + text: "!" + (block.format || "text") + "\n" + block.content } }) - } else if (block.type === "text") { + } else { nodes.push({ - textNode: { - text: "!" + (block.format || "text") + "\n" + block.content + toolNode: { + tool: block } }) } diff --git a/tests/gptscript.test.ts b/tests/gptscript.test.ts index 42b4398..ca86083 100644 --- a/tests/gptscript.test.ts +++ b/tests/gptscript.test.ts @@ -383,6 +383,31 @@ describe("gptscript module", () => { expect(response).toContain("Parameter: text: The text to write") }) + test("format context tool", async () => { + const tool = { + id: "my-tool", + type: "context" as ToolType, + tools: ["sys.write", "sys.read"], + instructions: "This is a test", + arguments: { + type: ArgumentSchemaType, + properties: { + text: { + type: PropertyType, + description: "The text to write" + } + } + } + } + + const response = await g.stringify([tool]) + expect(response).toBeDefined() + expect(response).toContain("Tools: sys.write, sys.read") + expect(response).toContain("This is a test") + expect(response).toContain("Parameter: text: The text to write") + expect(response).toContain("Type: Context") + }) + test("exec tool with chat", async () => { let err = undefined const t = { From fae5ed7976e8e88f354a20b4b38f01578f0e69a5 Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Fri, 30 Aug 2024 13:33:17 -0400 Subject: [PATCH 7/9] fix: change one more reject to be an Error Signed-off-by: Donnie Adams --- src/gptscript.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gptscript.ts b/src/gptscript.ts index 099c5bc..896b4f2 100644 --- a/src/gptscript.ts +++ b/src/gptscript.ts @@ -532,7 +532,7 @@ export class Run { }).then(res => { resolve(res.stdout) }).catch(e => { - reject(e) + reject(new Error(e)) }) }) } From 0be229fe5fe9a26663e53037e20d48bbe3d2d66d Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Fri, 30 Aug 2024 14:43:27 -0400 Subject: [PATCH 8/9] chore: add load tests Signed-off-by: Donnie Adams --- src/gptscript.ts | 8 ++++++ tests/gptscript.test.ts | 56 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/src/gptscript.ts b/src/gptscript.ts index 896b4f2..d7ed6d0 100644 --- a/src/gptscript.ts +++ b/src/gptscript.ts @@ -172,6 +172,10 @@ export class GPTScript { this.ready = await this.testGPTScriptURL(20) } + if (this.opts.Env) { + opts.env = this.opts.Env.concat(opts.env || []) + } + return (new Run("run", toolName, {...this.opts, ...opts}, GPTScript.serverURL)).nextChat(opts.input) } @@ -187,6 +191,10 @@ export class GPTScript { this.ready = await this.testGPTScriptURL(20) } + if (this.opts.Env) { + opts.env = this.opts.Env.concat(opts.env || []) + } + return (new Run("evaluate", tool, {...this.opts, ...opts}, GPTScript.serverURL)).nextChat(opts.input) } diff --git a/tests/gptscript.test.ts b/tests/gptscript.test.ts index ca86083..e22dfae 100644 --- a/tests/gptscript.test.ts +++ b/tests/gptscript.test.ts @@ -2,6 +2,7 @@ import * as gptscript from "../src/gptscript" import {ArgumentSchemaType, getEnv, PropertyType, RunEventType, TextType, ToolType} from "../src/gptscript" import path from "path" import {fileURLToPath} from "url" +import * as fs from "node:fs" let gFirst: gptscript.GPTScript let g: gptscript.GPTScript @@ -286,6 +287,7 @@ describe("gptscript module", () => { await g.parse(path.join(__dirname, "fixtures", "non-existent.gpt")) } catch (e) { expect(e).toBeDefined() + expect(typeof e !== "string").toBeTruthy() return } expect(false).toBeTruthy() @@ -296,6 +298,7 @@ describe("gptscript module", () => { await g.parse("github.com/thedadams/dne") } catch (e) { expect(e).toBeDefined() + expect(typeof e !== "string").toBeTruthy() return } expect(false).toBeTruthy() @@ -408,6 +411,59 @@ describe("gptscript module", () => { expect(response).toContain("Type: Context") }) + test("load simple file", async () => { + const response = await g.load(path.join(__dirname, "fixtures", "test.gpt")) + expect(response.program).toBeDefined() + expect(response.program.name).toBeTruthy() + expect(response.program.entryToolId).toBeTruthy() + expect(response.program.toolSet).toBeDefined() + }, 30000) + + test("load remote tool", async () => { + const response = await g.load("github.com/gptscript-ai/context/workspace") + expect(response.program).toBeDefined() + expect(response.program.name).toBeTruthy() + expect(response.program.entryToolId).toBeTruthy() + expect(response.program.toolSet).toBeDefined() + }, 30000) + + test("load content", async () => { + const content = fs.readFileSync(path.join(__dirname, "fixtures", "test.gpt"), {encoding: "utf8"}) + const response = await g.loadContent(content) + expect(response.program).toBeDefined() + // Name will not be defined in this case. + expect(response.program.name).toBeFalsy() + expect(response.program.entryToolId).toBeTruthy() + expect(response.program.toolSet).toBeDefined() + }, 30000) + + test("load tools", async () => { + const tools = [{ + tools: ["ask"], + instructions: "Only use the ask tool to ask who was the president of the united states in 1928?" + }, + { + name: "other", + instructions: "Who was the president of the united states in 1986?" + }, + { + name: "ask", + description: "This tool is used to ask a question", + arguments: { + type: "object", + question: "The question to ask" + }, + instructions: "${question}" + }, + ] as gptscript.ToolDef[] + const response = await g.loadTools(tools) + expect(response.program).toBeDefined() + // Name will not be defined in this case. + expect(response.program.name).toBeFalsy() + expect(response.program.entryToolId).toBeTruthy() + expect(response.program.toolSet).toBeDefined() + }, 30000) + test("exec tool with chat", async () => { let err = undefined const t = { From 220bd4f7366f9821a07ef48f3cf533dc0671d4ee Mon Sep 17 00:00:00 2001 From: acorn-io-bot Date: Fri, 30 Aug 2024 20:21:48 +0000 Subject: [PATCH 9/9] Automated GPTScript Version Update --- package-lock.json | 4 ++-- package.json | 2 +- scripts/install-binary.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 341b7d6..99cbf37 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gptscript-ai/gptscript", - "version": "v0.9.5-rc4", + "version": "v0.9.5-rc5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@gptscript-ai/gptscript", - "version": "v0.9.5-rc4", + "version": "v0.9.5-rc5", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 300cf69..efd171c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gptscript-ai/gptscript", - "version": "v0.9.5-rc4", + "version": "v0.9.5-rc5", "description": "Run gptscript in node.js", "source": "src/gptscript.ts", "main": "dist/gptscript.js", diff --git a/scripts/install-binary.js b/scripts/install-binary.js index 9e04cfd..bad5677 100644 --- a/scripts/install-binary.js +++ b/scripts/install-binary.js @@ -72,7 +72,7 @@ if (process.platform === 'win32') { const gptscript_info = { name: "gptscript", url: "https://github.com/gptscript-ai/gptscript/releases/download/", - version: "v0.9.5-rc4" + version: "v0.9.5-rc5" } const pltfm = {