From 0ee119a6184d46b13b95a89d635ba38ae53c44c3 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Mon, 5 Aug 2024 12:04:33 -0700 Subject: [PATCH] chore: drop internal prompt Also seed and stream_options.include_usage will be set in all requests --- .../gptscript_eval.md | 1 - pkg/cli/eval.go | 26 ++++---- pkg/engine/cmd_test.go | 59 +++++++++++++++++++ pkg/engine/engine.go | 17 ++---- pkg/gptscript/gptscript.go | 3 +- pkg/loader/loader_test.go | 6 -- pkg/openai/client.go | 20 ++----- pkg/parser/parser.go | 6 +- pkg/system/prompt.go | 18 ------ pkg/tests/runner_test.go | 7 --- pkg/tests/testdata/TestAgentOnly/call1.golden | 1 - pkg/tests/testdata/TestAgentOnly/call2.golden | 1 - pkg/tests/testdata/TestAgentOnly/step1.golden | 2 - pkg/tests/testdata/TestAgents/call1.golden | 1 - pkg/tests/testdata/TestAgents/call2.golden | 1 - pkg/tests/testdata/TestAgents/call3.golden | 1 - pkg/tests/testdata/TestAgents/call4.golden | 1 - pkg/tests/testdata/TestAgents/step1.golden | 4 -- pkg/tests/testdata/TestChat/call1.golden | 1 - pkg/tests/testdata/TestChat/call2.golden | 1 - .../testdata/TestChatRunNoError/call1.golden | 1 - .../testdata/TestContextSubChat/call10.golden | 1 - .../testdata/TestContextSubChat/call2.golden | 1 - .../testdata/TestContextSubChat/call3.golden | 1 - .../testdata/TestContextSubChat/call5.golden | 1 - .../testdata/TestContextSubChat/call7.golden | 1 - .../testdata/TestContextSubChat/call8.golden | 1 - .../testdata/TestContextSubChat/step1.golden | 1 - .../testdata/TestContextSubChat/step2.golden | 1 - .../testdata/TestContextSubChat/step3.golden | 2 - .../testdata/TestContextSubChat/step4.golden | 1 - .../testdata/TestDualSubChat/call2.golden | 1 - .../testdata/TestDualSubChat/call3.golden | 1 - .../testdata/TestDualSubChat/call4.golden | 1 - .../testdata/TestDualSubChat/call5.golden | 1 - .../testdata/TestDualSubChat/call6.golden | 1 - .../testdata/TestDualSubChat/step1.golden | 2 - .../testdata/TestDualSubChat/step2.golden | 1 - .../testdata/TestDualSubChat/step3.golden | 1 - pkg/tests/testdata/TestInput/call1.golden | 1 - pkg/tests/testdata/TestInput/call2.golden | 1 - pkg/tests/testdata/TestInput/step1.golden | 1 - pkg/tests/testdata/TestInput/step2.golden | 1 - pkg/tests/testdata/TestOutput/call1.golden | 1 - pkg/tests/testdata/TestOutput/call2.golden | 1 - pkg/tests/testdata/TestOutput/call3.golden | 1 - pkg/tests/testdata/TestOutput/step1.golden | 1 - pkg/tests/testdata/TestOutput/step2.golden | 1 - pkg/tests/testdata/TestSubChat/call2.golden | 1 - pkg/tests/testdata/TestSubChat/call3.golden | 1 - .../testdata/TestSysContext/call1.golden | 3 +- .../testdata/TestSysContext/context.json | 2 +- .../testdata/TestSysContext/step1.golden | 3 +- pkg/types/completion.go | 17 +++--- pkg/types/tool.go | 4 -- pkg/types/tool_test.go | 2 - 56 files changed, 95 insertions(+), 145 deletions(-) create mode 100644 pkg/engine/cmd_test.go diff --git a/docs/docs/04-command-line-reference/gptscript_eval.md b/docs/docs/04-command-line-reference/gptscript_eval.md index ff9e6446..2648b202 100644 --- a/docs/docs/04-command-line-reference/gptscript_eval.md +++ b/docs/docs/04-command-line-reference/gptscript_eval.md @@ -14,7 +14,6 @@ gptscript eval [flags] ``` --chat Enable chat ($GPTSCRIPT_EVAL_CHAT) -h, --help help for eval - --internal-prompt ($GPTSCRIPT_EVAL_INTERNAL_PROMPT) --json Output JSON ($GPTSCRIPT_EVAL_JSON) --max-tokens int Maximum number of tokens to output ($GPTSCRIPT_EVAL_MAX_TOKENS) --model string The model to use ($GPTSCRIPT_EVAL_MODEL) diff --git a/pkg/cli/eval.go b/pkg/cli/eval.go index 2cd4b1b5..a5b8a8f7 100644 --- a/pkg/cli/eval.go +++ b/pkg/cli/eval.go @@ -15,13 +15,12 @@ import ( ) type Eval struct { - Tools []string `usage:"Tools available to call"` - Chat bool `usage:"Enable chat"` - MaxTokens int `usage:"Maximum number of tokens to output"` - Model string `usage:"The model to use"` - JSON bool `usage:"Output JSON"` - Temperature string `usage:"Set the temperature, \"creativity\""` - InternalPrompt *bool `Usage:"Set to false to disable the internal prompt"` + Tools []string `usage:"Tools available to call"` + Chat bool `usage:"Enable chat"` + MaxTokens int `usage:"Maximum number of tokens to output"` + Model string `usage:"The model to use"` + JSON bool `usage:"Output JSON"` + Temperature string `usage:"Set the temperature, \"creativity\""` gptscript *GPTScript } @@ -30,13 +29,12 @@ func (e *Eval) Run(cmd *cobra.Command, args []string) error { tool := types.Tool{ ToolDef: types.ToolDef{ Parameters: types.Parameters{ - Description: "inline script", - Tools: e.Tools, - MaxTokens: e.MaxTokens, - ModelName: e.Model, - JSONResponse: e.JSON, - InternalPrompt: e.InternalPrompt, - Chat: e.Chat, + Description: "inline script", + Tools: e.Tools, + MaxTokens: e.MaxTokens, + ModelName: e.Model, + JSONResponse: e.JSON, + Chat: e.Chat, }, Instructions: strings.Join(args, " "), }, diff --git a/pkg/engine/cmd_test.go b/pkg/engine/cmd_test.go new file mode 100644 index 00000000..006d0f11 --- /dev/null +++ b/pkg/engine/cmd_test.go @@ -0,0 +1,59 @@ +package engine + +import ( + "strings" + "testing" + + "github.com/hexops/autogold/v2" +) + +func TestCompressEnv(t *testing.T) { + cases := []struct { + name string + envs []string + expect autogold.Value + }{ + { + name: "EmptyEnv", + envs: []string{}, + expect: autogold.Expect([]string{}), + }, + { + name: "SmallValue", + envs: []string{"ENV=12345"}, + expect: autogold.Expect([]string{"ENV=12345"}), + }, + { + name: "LargeValue", + envs: []string{"ENV=" + strings.Repeat("1", 40001)}, + expect: autogold.Expect([]string{`ENV={"_gz":"H4sIAAAAAAAA/+zAwQAAAAACMab85XqexDYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAPAAD//2wBriFBnAAA"}`}), + }, + { + name: "LargeValue1", + envs: []string{"ENV=" + strings.Repeat("1", 40000)}, + expect: autogold.Expect([]string{`ENV={"_gz":"H4sIAAAAAAAA/+zAwQAAAAACMab85fodxTYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAPAAD//yOpnxVAnAAA"}`}), + }, + { + name: "LargeValue2", + envs: []string{"ENV=" + strings.Repeat("1", 39999)}, + expect: autogold.Expect([]string{"ENV=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"}), + }, + { + name: "MultipleValues", + envs: []string{"A=1", "B=2"}, + expect: autogold.Expect([]string{"A=1", "B=2"}), + }, + { + name: "MultipleValuesWithLarge", + envs: []string{"A=1", "B=2", "C=" + strings.Repeat("3", 40001)}, + expect: autogold.Expect([]string{"A=1", "B=2", `C={"_gz":"H4sIAAAAAAAA/+zAwQAAAAACMaj83XqexDYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAPAAD//1gf9UpBnAAA"}`}), + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + result := compressEnv(tc.envs) + tc.expect.Equal(t, result) + }) + } +} diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index d3daa674..89a63b1a 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -287,17 +287,12 @@ func (e *Engine) Start(ctx Context, input string) (ret *Return, _ error) { } completion := types.CompletionRequest{ - Model: tool.Parameters.ModelName, - MaxTokens: tool.Parameters.MaxTokens, - JSONResponse: tool.Parameters.JSONResponse, - Cache: tool.Parameters.Cache, - Chat: tool.Parameters.Chat, - Temperature: tool.Parameters.Temperature, - InternalSystemPrompt: tool.Parameters.InternalPrompt, - } - - if tool.Chat && completion.InternalSystemPrompt == nil { - completion.InternalSystemPrompt = new(bool) + Model: tool.Parameters.ModelName, + MaxTokens: tool.Parameters.MaxTokens, + JSONResponse: tool.Parameters.JSONResponse, + Cache: tool.Parameters.Cache, + Chat: tool.Parameters.Chat, + Temperature: tool.Parameters.Temperature, } var err error diff --git a/pkg/gptscript/gptscript.go b/pkg/gptscript/gptscript.go index 43f429fc..8a6ea86d 100644 --- a/pkg/gptscript/gptscript.go +++ b/pkg/gptscript/gptscript.go @@ -110,8 +110,7 @@ func New(ctx context.Context, o ...Options) (*GPTScript, error) { if opts.DefaultModelProvider == "" { oaiClient, err := openai.NewClient(ctx, credStore, opts.OpenAI, openai.Options{ - Cache: cacheClient, - SetSeed: true, + Cache: cacheClient, }) if err != nil { return nil, err diff --git a/pkg/loader/loader_test.go b/pkg/loader/loader_test.go index 7c480034..3d0db0f2 100644 --- a/pkg/loader/loader_test.go +++ b/pkg/loader/loader_test.go @@ -79,7 +79,6 @@ func TestHelloWorld(t *testing.T) { "toolSet": { "https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/bob.gpt:": { "modelName": "gpt-4o", - "internalPrompt": null, "instructions": "Say hello world", "id": "https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/bob.gpt:", "localTools": { @@ -93,7 +92,6 @@ func TestHelloWorld(t *testing.T) { }, "https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/sub/tool.gpt:": { "modelName": "gpt-4o", - "internalPrompt": null, "tools": [ "../bob.gpt" ], @@ -129,7 +127,6 @@ func TestHelloWorld(t *testing.T) { "https://get.gptscript.ai/echo.gpt:": { "description": "Returns back the input of the script", "modelName": "gpt-4o", - "internalPrompt": null, "arguments": { "properties": { "input": { @@ -164,7 +161,6 @@ func TestDefault(t *testing.T) { "testdata/tool/tool.gpt:tool": { "name": "tool", "modelName": "gpt-4o", - "internalPrompt": null, "instructions": "a tool", "id": "testdata/tool/tool.gpt:tool", "localTools": { @@ -188,7 +184,6 @@ func TestDefault(t *testing.T) { "testdata/agent/agent.gpt:agent": { "name": "agent", "modelName": "gpt-4o", - "internalPrompt": null, "instructions": "an agent", "id": "testdata/agent/agent.gpt:agent", "localTools": { @@ -212,7 +207,6 @@ func TestDefault(t *testing.T) { "testdata/bothtoolagent/agent.gpt:agent": { "name": "agent", "modelName": "gpt-4o", - "internalPrompt": null, "instructions": "an agent", "id": "testdata/bothtoolagent/agent.gpt:agent", "localTools": { diff --git a/pkg/openai/client.go b/pkg/openai/client.go index 53252895..8c600903 100644 --- a/pkg/openai/client.go +++ b/pkg/openai/client.go @@ -44,7 +44,6 @@ type Client struct { cache *cache.Client invalidAuth bool cacheKeyBase string - setSeed bool credStore credentials.CredentialStore } @@ -54,7 +53,6 @@ type Options struct { OrgID string `usage:"OpenAI organization ID" name:"openai-org-id" env:"OPENAI_ORG_ID"` DefaultModel string `usage:"Default LLM model to use" default:"gpt-4o"` ConfigFile string `usage:"Path to GPTScript config file" name:"config"` - SetSeed bool `usage:"-"` CacheKey string `usage:"-"` Cache *cache.Client } @@ -66,7 +64,6 @@ func Complete(opts ...Options) (result Options) { result.OrgID = types.FirstSet(opt.OrgID, result.OrgID) result.Cache = types.FirstSet(opt.Cache, result.Cache) result.DefaultModel = types.FirstSet(opt.DefaultModel, result.DefaultModel) - result.SetSeed = types.FirstSet(opt.SetSeed, result.SetSeed) result.CacheKey = types.FirstSet(opt.CacheKey, result.CacheKey) } @@ -125,7 +122,6 @@ func NewClient(ctx context.Context, credStore credentials.CredentialStore, opts defaultModel: opt.DefaultModel, cacheKeyBase: cacheKeyBase, invalidAuth: opt.APIKey == "" && opt.BaseURL == "", - setSeed: opt.SetSeed, credStore: credStore, }, nil } @@ -227,16 +223,12 @@ func toToolCall(call types.CompletionToolCall) openai.ToolCall { } } -func toMessages(request types.CompletionRequest, compat bool) (result []openai.ChatCompletionMessage, err error) { +func toMessages(request types.CompletionRequest) (result []openai.ChatCompletionMessage, err error) { var ( systemPrompts []string msgs []types.CompletionMessage ) - if !compat && (request.InternalSystemPrompt == nil || *request.InternalSystemPrompt) { - systemPrompts = append(systemPrompts, system.InternalSystemPrompt) - } - for _, message := range request.Messages { if message.Role == types.CompletionMessageRoleTypeSystem { systemPrompts = append(systemPrompts, message.Content[0].Text) @@ -304,7 +296,7 @@ func (c *Client) Call(ctx context.Context, messageRequest types.CompletionReques messageRequest.Model = c.defaultModel } - msgs, err := toMessages(messageRequest, !c.setSeed) + msgs, err := toMessages(messageRequest) if err != nil { return nil, err } @@ -365,11 +357,9 @@ func (c *Client) Call(ctx context.Context, messageRequest types.CompletionReques } var cacheResponse bool - if c.setSeed { - request.Seed = ptr(c.seed(request)) - request.StreamOptions = &openai.StreamOptions{ - IncludeUsage: true, - } + request.Seed = ptr(c.seed(request)) + request.StreamOptions = &openai.StreamOptions{ + IncludeUsage: true, } response, ok, err := c.fromCache(ctx, messageRequest, request) if err != nil { diff --git a/pkg/parser/parser.go b/pkg/parser/parser.go index ff5d1374..e87f64c6 100644 --- a/pkg/parser/parser.go +++ b/pkg/parser/parser.go @@ -90,11 +90,7 @@ func isParam(line string, tool *types.Tool) (_ bool, err error) { case "description": tool.Parameters.Description = value case "internalprompt": - v, err := toBool(value) - if err != nil { - return false, err - } - tool.Parameters.InternalPrompt = &v + // deprecated and ignored case "chat": v, err := toBool(value) if err != nil { diff --git a/pkg/system/prompt.go b/pkg/system/prompt.go index 6b1815fd..9f3de5ec 100644 --- a/pkg/system/prompt.go +++ b/pkg/system/prompt.go @@ -2,7 +2,6 @@ package system import ( "encoding/json" - "os" "strings" "github.com/getkin/kin-openapi/openapi3" @@ -11,17 +10,6 @@ import ( // Suffix is default suffix of gptscript files const Suffix = ".gpt" -// InternalSystemPrompt is added to all threads. Changing this is very dangerous as it has a -// terrible global effect and changes the behavior of all scripts. -var InternalSystemPrompt = ` -You are task oriented system. -You receive input from a user, process the input from the given instructions, and then output the result. -Your objective is to provide consistent and correct results. -You do not need to explain the steps taken, only provide the result to the given instructions. -You are referred to as a tool. -You don't move to the next step until you have a result. -` - // DefaultPromptParameter is used as the key in a json map to indication that we really wanted // to just send pure text but the interface required JSON (as that is the fundamental interface of tools in OpenAI) var DefaultPromptParameter = "defaultPromptParameter" @@ -50,12 +38,6 @@ var DefaultChatSchema = openapi3.Schema{ }, } -func init() { - if p := os.Getenv("GPTSCRIPT_INTERNAL_SYSTEM_PROMPT"); p != "" { - InternalSystemPrompt = p - } -} - // IsDefaultPrompt Checks if the content is a json blob that has the defaultPromptParameter in it. If so // it will extract out the value and return it. If not it will return the original content as is and false. func IsDefaultPrompt(content string) (string, bool) { diff --git a/pkg/tests/runner_test.go b/pkg/tests/runner_test.go index 12eff23a..1c37ead7 100644 --- a/pkg/tests/runner_test.go +++ b/pkg/tests/runner_test.go @@ -36,7 +36,6 @@ func TestAsterick(t *testing.T) { "testdata/TestAsterick/other.gpt:a": { "name": "a", "modelName": "gpt-4o", - "internalPrompt": null, "instructions": "a", "id": "testdata/TestAsterick/other.gpt:a", "localTools": { @@ -55,7 +54,6 @@ func TestAsterick(t *testing.T) { "testdata/TestAsterick/other.gpt:afoo": { "name": "afoo", "modelName": "gpt-4o", - "internalPrompt": null, "instructions": "afoo", "id": "testdata/TestAsterick/other.gpt:afoo", "localTools": { @@ -73,7 +71,6 @@ func TestAsterick(t *testing.T) { }, "testdata/TestAsterick/test.gpt:": { "modelName": "gpt-4o", - "internalPrompt": null, "tools": [ "a* from ./other.gpt" ], @@ -396,7 +393,6 @@ func TestSubChat(t *testing.T) { "state": { "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", @@ -521,7 +517,6 @@ func TestSubChat(t *testing.T) { "state": { "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", @@ -598,7 +593,6 @@ func TestChat(t *testing.T) { "input": "Hello", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", @@ -650,7 +644,6 @@ func TestChat(t *testing.T) { "input": "Hello", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestAgentOnly/call1.golden b/pkg/tests/testdata/TestAgentOnly/call1.golden index b63c6fd3..27562698 100644 --- a/pkg/tests/testdata/TestAgentOnly/call1.golden +++ b/pkg/tests/testdata/TestAgentOnly/call1.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestAgentOnly/call2.golden b/pkg/tests/testdata/TestAgentOnly/call2.golden index 82f95523..82cd17e4 100644 --- a/pkg/tests/testdata/TestAgentOnly/call2.golden +++ b/pkg/tests/testdata/TestAgentOnly/call2.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestAgentOnly/step1.golden b/pkg/tests/testdata/TestAgentOnly/step1.golden index 662dbf04..bfa1515e 100644 --- a/pkg/tests/testdata/TestAgentOnly/step1.golden +++ b/pkg/tests/testdata/TestAgentOnly/step1.golden @@ -8,7 +8,6 @@ "input": "Input 1", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { @@ -92,7 +91,6 @@ "input": "Agent 2 input", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestAgents/call1.golden b/pkg/tests/testdata/TestAgents/call1.golden index d3c4a86d..8725d3c6 100644 --- a/pkg/tests/testdata/TestAgents/call1.golden +++ b/pkg/tests/testdata/TestAgents/call1.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestAgents/call2.golden b/pkg/tests/testdata/TestAgents/call2.golden index 950ad2ea..6ea732b6 100644 --- a/pkg/tests/testdata/TestAgents/call2.golden +++ b/pkg/tests/testdata/TestAgents/call2.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestAgents/call3.golden b/pkg/tests/testdata/TestAgents/call3.golden index f9b45a1b..8ce8cd43 100644 --- a/pkg/tests/testdata/TestAgents/call3.golden +++ b/pkg/tests/testdata/TestAgents/call3.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestAgents/call4.golden b/pkg/tests/testdata/TestAgents/call4.golden index d43474ca..137fc9a2 100644 --- a/pkg/tests/testdata/TestAgents/call4.golden +++ b/pkg/tests/testdata/TestAgents/call4.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestAgents/step1.golden b/pkg/tests/testdata/TestAgents/step1.golden index 3047e695..9f9a84df 100644 --- a/pkg/tests/testdata/TestAgents/step1.golden +++ b/pkg/tests/testdata/TestAgents/step1.golden @@ -8,7 +8,6 @@ "input": "Input 1", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { @@ -103,7 +102,6 @@ "state": { "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { @@ -174,7 +172,6 @@ "state": { "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { @@ -260,7 +257,6 @@ "state": { "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestChat/call1.golden b/pkg/tests/testdata/TestChat/call1.golden index 34bb12cf..24ba1a70 100644 --- a/pkg/tests/testdata/TestChat/call1.golden +++ b/pkg/tests/testdata/TestChat/call1.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestChat/call2.golden b/pkg/tests/testdata/TestChat/call2.golden index e67862cb..c57cee2f 100644 --- a/pkg/tests/testdata/TestChat/call2.golden +++ b/pkg/tests/testdata/TestChat/call2.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestChatRunNoError/call1.golden b/pkg/tests/testdata/TestChatRunNoError/call1.golden index ac6d5325..effc25eb 100644 --- a/pkg/tests/testdata/TestChatRunNoError/call1.golden +++ b/pkg/tests/testdata/TestChatRunNoError/call1.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestContextSubChat/call10.golden b/pkg/tests/testdata/TestContextSubChat/call10.golden index c8c98651..967b073d 100644 --- a/pkg/tests/testdata/TestContextSubChat/call10.golden +++ b/pkg/tests/testdata/TestContextSubChat/call10.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestContextSubChat/call2.golden b/pkg/tests/testdata/TestContextSubChat/call2.golden index a6cf25c6..a5e98c91 100644 --- a/pkg/tests/testdata/TestContextSubChat/call2.golden +++ b/pkg/tests/testdata/TestContextSubChat/call2.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestContextSubChat/call3.golden b/pkg/tests/testdata/TestContextSubChat/call3.golden index 55ad402f..f6c17110 100644 --- a/pkg/tests/testdata/TestContextSubChat/call3.golden +++ b/pkg/tests/testdata/TestContextSubChat/call3.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestContextSubChat/call5.golden b/pkg/tests/testdata/TestContextSubChat/call5.golden index 2b8cf41e..a4bd5be2 100644 --- a/pkg/tests/testdata/TestContextSubChat/call5.golden +++ b/pkg/tests/testdata/TestContextSubChat/call5.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestContextSubChat/call7.golden b/pkg/tests/testdata/TestContextSubChat/call7.golden index b0ef4e39..5e59a4e7 100644 --- a/pkg/tests/testdata/TestContextSubChat/call7.golden +++ b/pkg/tests/testdata/TestContextSubChat/call7.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestContextSubChat/call8.golden b/pkg/tests/testdata/TestContextSubChat/call8.golden index 3d0db61b..45e1738a 100644 --- a/pkg/tests/testdata/TestContextSubChat/call8.golden +++ b/pkg/tests/testdata/TestContextSubChat/call8.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestContextSubChat/step1.golden b/pkg/tests/testdata/TestContextSubChat/step1.golden index 2ffb138e..41219640 100644 --- a/pkg/tests/testdata/TestContextSubChat/step1.golden +++ b/pkg/tests/testdata/TestContextSubChat/step1.golden @@ -81,7 +81,6 @@ "input": "Input to chatbot1", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestContextSubChat/step2.golden b/pkg/tests/testdata/TestContextSubChat/step2.golden index dfcb2b96..458999e3 100644 --- a/pkg/tests/testdata/TestContextSubChat/step2.golden +++ b/pkg/tests/testdata/TestContextSubChat/step2.golden @@ -8,7 +8,6 @@ "input": "User 1", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestContextSubChat/step3.golden b/pkg/tests/testdata/TestContextSubChat/step3.golden index 0ccb188b..91e94013 100644 --- a/pkg/tests/testdata/TestContextSubChat/step3.golden +++ b/pkg/tests/testdata/TestContextSubChat/step3.golden @@ -8,7 +8,6 @@ "input": "User 1", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", @@ -123,7 +122,6 @@ "input": "Input to chatbot1 on resume", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestContextSubChat/step4.golden b/pkg/tests/testdata/TestContextSubChat/step4.golden index 5e95d626..36d24727 100644 --- a/pkg/tests/testdata/TestContextSubChat/step4.golden +++ b/pkg/tests/testdata/TestContextSubChat/step4.golden @@ -8,7 +8,6 @@ "input": "User 1", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestDualSubChat/call2.golden b/pkg/tests/testdata/TestDualSubChat/call2.golden index a6cf25c6..a5e98c91 100644 --- a/pkg/tests/testdata/TestDualSubChat/call2.golden +++ b/pkg/tests/testdata/TestDualSubChat/call2.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestDualSubChat/call3.golden b/pkg/tests/testdata/TestDualSubChat/call3.golden index ddcc81c9..2693d3c3 100644 --- a/pkg/tests/testdata/TestDualSubChat/call3.golden +++ b/pkg/tests/testdata/TestDualSubChat/call3.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestDualSubChat/call4.golden b/pkg/tests/testdata/TestDualSubChat/call4.golden index 600e3ba5..19312cc9 100644 --- a/pkg/tests/testdata/TestDualSubChat/call4.golden +++ b/pkg/tests/testdata/TestDualSubChat/call4.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestDualSubChat/call5.golden b/pkg/tests/testdata/TestDualSubChat/call5.golden index 54823934..46407f58 100644 --- a/pkg/tests/testdata/TestDualSubChat/call5.golden +++ b/pkg/tests/testdata/TestDualSubChat/call5.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestDualSubChat/call6.golden b/pkg/tests/testdata/TestDualSubChat/call6.golden index a9a8a1c4..04d08d47 100644 --- a/pkg/tests/testdata/TestDualSubChat/call6.golden +++ b/pkg/tests/testdata/TestDualSubChat/call6.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestDualSubChat/step1.golden b/pkg/tests/testdata/TestDualSubChat/step1.golden index f29dfd60..32e20e51 100644 --- a/pkg/tests/testdata/TestDualSubChat/step1.golden +++ b/pkg/tests/testdata/TestDualSubChat/step1.golden @@ -127,7 +127,6 @@ "input": "Input to chatbot1", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { @@ -192,7 +191,6 @@ "input": "Input to chatbot2", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestDualSubChat/step2.golden b/pkg/tests/testdata/TestDualSubChat/step2.golden index 830a8e7c..193d5283 100644 --- a/pkg/tests/testdata/TestDualSubChat/step2.golden +++ b/pkg/tests/testdata/TestDualSubChat/step2.golden @@ -134,7 +134,6 @@ "input": "Input to chatbot2", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestDualSubChat/step3.golden b/pkg/tests/testdata/TestDualSubChat/step3.golden index 4f3b415a..f3fddfef 100644 --- a/pkg/tests/testdata/TestDualSubChat/step3.golden +++ b/pkg/tests/testdata/TestDualSubChat/step3.golden @@ -134,7 +134,6 @@ "input": "Input to chatbot2", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { diff --git a/pkg/tests/testdata/TestInput/call1.golden b/pkg/tests/testdata/TestInput/call1.golden index a3b78c42..fd4eea90 100644 --- a/pkg/tests/testdata/TestInput/call1.golden +++ b/pkg/tests/testdata/TestInput/call1.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestInput/call2.golden b/pkg/tests/testdata/TestInput/call2.golden index 63c469f4..28139358 100644 --- a/pkg/tests/testdata/TestInput/call2.golden +++ b/pkg/tests/testdata/TestInput/call2.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestInput/step1.golden b/pkg/tests/testdata/TestInput/step1.golden index 72e36ecb..eef6f287 100644 --- a/pkg/tests/testdata/TestInput/step1.golden +++ b/pkg/tests/testdata/TestInput/step1.golden @@ -8,7 +8,6 @@ "input": "No, You're stupid!\n ha ha ha\n", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestInput/step2.golden b/pkg/tests/testdata/TestInput/step2.golden index 73b89d76..d2a8831d 100644 --- a/pkg/tests/testdata/TestInput/step2.golden +++ b/pkg/tests/testdata/TestInput/step2.golden @@ -8,7 +8,6 @@ "input": "No, You're stupid!\n ha ha ha\n", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestOutput/call1.golden b/pkg/tests/testdata/TestOutput/call1.golden index 6b1e1362..30b61d49 100644 --- a/pkg/tests/testdata/TestOutput/call1.golden +++ b/pkg/tests/testdata/TestOutput/call1.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestOutput/call2.golden b/pkg/tests/testdata/TestOutput/call2.golden index e7e17359..303f2660 100644 --- a/pkg/tests/testdata/TestOutput/call2.golden +++ b/pkg/tests/testdata/TestOutput/call2.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestOutput/call3.golden b/pkg/tests/testdata/TestOutput/call3.golden index b81d2d26..cd2ddd45 100644 --- a/pkg/tests/testdata/TestOutput/call3.golden +++ b/pkg/tests/testdata/TestOutput/call3.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestOutput/step1.golden b/pkg/tests/testdata/TestOutput/step1.golden index 3d77ecec..5a42b8d9 100644 --- a/pkg/tests/testdata/TestOutput/step1.golden +++ b/pkg/tests/testdata/TestOutput/step1.golden @@ -8,7 +8,6 @@ "input": "Input 1", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestOutput/step2.golden b/pkg/tests/testdata/TestOutput/step2.golden index 80baf7e4..37277b12 100644 --- a/pkg/tests/testdata/TestOutput/step2.golden +++ b/pkg/tests/testdata/TestOutput/step2.golden @@ -8,7 +8,6 @@ "input": "Input 1", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestSubChat/call2.golden b/pkg/tests/testdata/TestSubChat/call2.golden index ac6d5325..effc25eb 100644 --- a/pkg/tests/testdata/TestSubChat/call2.golden +++ b/pkg/tests/testdata/TestSubChat/call2.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestSubChat/call3.golden b/pkg/tests/testdata/TestSubChat/call3.golden index 0bf5dbab..df066cc5 100644 --- a/pkg/tests/testdata/TestSubChat/call3.golden +++ b/pkg/tests/testdata/TestSubChat/call3.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "messages": [ { "role": "system", diff --git a/pkg/tests/testdata/TestSysContext/call1.golden b/pkg/tests/testdata/TestSysContext/call1.golden index 4c9c51d0..5aace42c 100644 --- a/pkg/tests/testdata/TestSysContext/call1.golden +++ b/pkg/tests/testdata/TestSysContext/call1.golden @@ -1,6 +1,5 @@ `{ "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { @@ -23,7 +22,7 @@ "role": "system", "content": [ { - "text": "{\"call\":{\"id\":\"\",\"tool\":{\"name\":\"sys.context\",\"description\":\"Retrieves the current internal GPTScript tool call context information\",\"modelName\":\"gpt-4o\",\"internalPrompt\":null,\"arguments\":{\"type\":\"object\"},\"instructions\":\"#!sys.context\",\"id\":\"sys.context\",\"source\":{}},\"currentAgent\":{},\"agentGroup\":[{\"named\":\"iAmSuperman\",\"reference\":\"./file.gpt\",\"toolID\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\"}],\"inputContext\":null,\"toolCategory\":\"context\",\"toolName\":\"sys.context\"},\"program\":{\"name\":\"testdata/TestSysContext/test.gpt\",\"entryToolId\":\"testdata/TestSysContext/test.gpt:\",\"toolSet\":{\"sys.context\":{\"name\":\"sys.context\",\"description\":\"Retrieves the current internal GPTScript tool call context information\",\"modelName\":\"gpt-4o\",\"internalPrompt\":null,\"arguments\":{\"type\":\"object\"},\"instructions\":\"#!sys.context\",\"id\":\"sys.context\",\"source\":{}},\"testdata/TestSysContext/file.gpt:I am Superman Agent\":{\"name\":\"I am Superman Agent\",\"modelName\":\"gpt-4o\",\"internalPrompt\":null,\"instructions\":\"I'm super\",\"id\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\",\"localTools\":{\"i am superman agent\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\"},\"source\":{\"location\":\"testdata/TestSysContext/file.gpt\",\"lineNo\":1},\"workingDir\":\"testdata/TestSysContext\"},\"testdata/TestSysContext/test.gpt:\":{\"modelName\":\"gpt-4o\",\"chat\":true,\"internalPrompt\":null,\"context\":[\"agents\"],\"agents\":[\"./file.gpt\"],\"instructions\":\"Tool body\",\"id\":\"testdata/TestSysContext/test.gpt:\",\"toolMapping\":{\"./file.gpt\":[{\"reference\":\"./file.gpt\",\"toolID\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\"}],\"agents\":[{\"reference\":\"agents\",\"toolID\":\"testdata/TestSysContext/test.gpt:agents\"}]},\"localTools\":{\"\":\"testdata/TestSysContext/test.gpt:\",\"agents\":\"testdata/TestSysContext/test.gpt:agents\"},\"source\":{\"location\":\"testdata/TestSysContext/test.gpt\",\"lineNo\":1},\"workingDir\":\"testdata/TestSysContext\"},\"testdata/TestSysContext/test.gpt:agents\":{\"name\":\"agents\",\"modelName\":\"gpt-4o\",\"internalPrompt\":null,\"context\":[\"sys.context\"],\"instructions\":\"#!/bin/bash\\n\\necho \\\"${GPTSCRIPT_CONTEXT}\\\"\\necho \\\"${GPTSCRIPT_CONTEXT}\\\" \\u003e ${GPTSCRIPT_TOOL_DIR}/context.json\",\"id\":\"testdata/TestSysContext/test.gpt:agents\",\"toolMapping\":{\"sys.context\":[{\"reference\":\"sys.context\",\"toolID\":\"sys.context\"}]},\"localTools\":{\"\":\"testdata/TestSysContext/test.gpt:\",\"agents\":\"testdata/TestSysContext/test.gpt:agents\"},\"source\":{\"location\":\"testdata/TestSysContext/test.gpt\",\"lineNo\":8},\"workingDir\":\"testdata/TestSysContext\"}}}}\n\nTool body" + "text": "{\"call\":{\"id\":\"\",\"tool\":{\"name\":\"sys.context\",\"description\":\"Retrieves the current internal GPTScript tool call context information\",\"modelName\":\"gpt-4o\",\"arguments\":{\"type\":\"object\"},\"instructions\":\"#!sys.context\",\"id\":\"sys.context\",\"source\":{}},\"currentAgent\":{},\"agentGroup\":[{\"named\":\"iAmSuperman\",\"reference\":\"./file.gpt\",\"toolID\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\"}],\"inputContext\":null,\"toolCategory\":\"context\",\"toolName\":\"sys.context\"},\"program\":{\"name\":\"testdata/TestSysContext/test.gpt\",\"entryToolId\":\"testdata/TestSysContext/test.gpt:\",\"toolSet\":{\"sys.context\":{\"name\":\"sys.context\",\"description\":\"Retrieves the current internal GPTScript tool call context information\",\"modelName\":\"gpt-4o\",\"arguments\":{\"type\":\"object\"},\"instructions\":\"#!sys.context\",\"id\":\"sys.context\",\"source\":{}},\"testdata/TestSysContext/file.gpt:I am Superman Agent\":{\"name\":\"I am Superman Agent\",\"modelName\":\"gpt-4o\",\"instructions\":\"I'm super\",\"id\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\",\"localTools\":{\"i am superman agent\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\"},\"source\":{\"location\":\"testdata/TestSysContext/file.gpt\",\"lineNo\":1},\"workingDir\":\"testdata/TestSysContext\"},\"testdata/TestSysContext/test.gpt:\":{\"modelName\":\"gpt-4o\",\"chat\":true,\"context\":[\"agents\"],\"agents\":[\"./file.gpt\"],\"instructions\":\"Tool body\",\"id\":\"testdata/TestSysContext/test.gpt:\",\"toolMapping\":{\"./file.gpt\":[{\"reference\":\"./file.gpt\",\"toolID\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\"}],\"agents\":[{\"reference\":\"agents\",\"toolID\":\"testdata/TestSysContext/test.gpt:agents\"}]},\"localTools\":{\"\":\"testdata/TestSysContext/test.gpt:\",\"agents\":\"testdata/TestSysContext/test.gpt:agents\"},\"source\":{\"location\":\"testdata/TestSysContext/test.gpt\",\"lineNo\":1},\"workingDir\":\"testdata/TestSysContext\"},\"testdata/TestSysContext/test.gpt:agents\":{\"name\":\"agents\",\"modelName\":\"gpt-4o\",\"context\":[\"sys.context\"],\"instructions\":\"#!/bin/bash\\n\\necho \\\"${GPTSCRIPT_CONTEXT}\\\"\\necho \\\"${GPTSCRIPT_CONTEXT}\\\" \\u003e ${GPTSCRIPT_TOOL_DIR}/context.json\",\"id\":\"testdata/TestSysContext/test.gpt:agents\",\"toolMapping\":{\"sys.context\":[{\"reference\":\"sys.context\",\"toolID\":\"sys.context\"}]},\"localTools\":{\"\":\"testdata/TestSysContext/test.gpt:\",\"agents\":\"testdata/TestSysContext/test.gpt:agents\"},\"source\":{\"location\":\"testdata/TestSysContext/test.gpt\",\"lineNo\":8},\"workingDir\":\"testdata/TestSysContext\"}}}}\n\nTool body" } ], "usage": {} diff --git a/pkg/tests/testdata/TestSysContext/context.json b/pkg/tests/testdata/TestSysContext/context.json index b6d62218..5902be68 100644 --- a/pkg/tests/testdata/TestSysContext/context.json +++ b/pkg/tests/testdata/TestSysContext/context.json @@ -1 +1 @@ -{"call":{"id":"","tool":{"name":"sys.context","description":"Retrieves the current internal GPTScript tool call context information","modelName":"gpt-4o","internalPrompt":null,"arguments":{"type":"object"},"instructions":"#!sys.context","id":"sys.context","source":{}},"currentAgent":{},"agentGroup":[{"named":"iAmSuperman","reference":"./file.gpt","toolID":"testdata/TestSysContext/file.gpt:I am Superman Agent"}],"inputContext":null,"toolCategory":"context","toolName":"sys.context"},"program":{"name":"testdata/TestSysContext/test.gpt","entryToolId":"testdata/TestSysContext/test.gpt:","toolSet":{"sys.context":{"name":"sys.context","description":"Retrieves the current internal GPTScript tool call context information","modelName":"gpt-4o","internalPrompt":null,"arguments":{"type":"object"},"instructions":"#!sys.context","id":"sys.context","source":{}},"testdata/TestSysContext/file.gpt:I am Superman Agent":{"name":"I am Superman Agent","modelName":"gpt-4o","internalPrompt":null,"instructions":"I'm super","id":"testdata/TestSysContext/file.gpt:I am Superman Agent","localTools":{"i am superman agent":"testdata/TestSysContext/file.gpt:I am Superman Agent"},"source":{"location":"testdata/TestSysContext/file.gpt","lineNo":1},"workingDir":"testdata/TestSysContext"},"testdata/TestSysContext/test.gpt:":{"modelName":"gpt-4o","chat":true,"internalPrompt":null,"context":["agents"],"agents":["./file.gpt"],"instructions":"Tool body","id":"testdata/TestSysContext/test.gpt:","toolMapping":{"./file.gpt":[{"reference":"./file.gpt","toolID":"testdata/TestSysContext/file.gpt:I am Superman Agent"}],"agents":[{"reference":"agents","toolID":"testdata/TestSysContext/test.gpt:agents"}]},"localTools":{"":"testdata/TestSysContext/test.gpt:","agents":"testdata/TestSysContext/test.gpt:agents"},"source":{"location":"testdata/TestSysContext/test.gpt","lineNo":1},"workingDir":"testdata/TestSysContext"},"testdata/TestSysContext/test.gpt:agents":{"name":"agents","modelName":"gpt-4o","internalPrompt":null,"context":["sys.context"],"instructions":"#!/bin/bash\n\necho \"${GPTSCRIPT_CONTEXT}\"\necho \"${GPTSCRIPT_CONTEXT}\" \u003e ${GPTSCRIPT_TOOL_DIR}/context.json","id":"testdata/TestSysContext/test.gpt:agents","toolMapping":{"sys.context":[{"reference":"sys.context","toolID":"sys.context"}]},"localTools":{"":"testdata/TestSysContext/test.gpt:","agents":"testdata/TestSysContext/test.gpt:agents"},"source":{"location":"testdata/TestSysContext/test.gpt","lineNo":8},"workingDir":"testdata/TestSysContext"}}}} +{"call":{"id":"","tool":{"name":"sys.context","description":"Retrieves the current internal GPTScript tool call context information","modelName":"gpt-4o","arguments":{"type":"object"},"instructions":"#!sys.context","id":"sys.context","source":{}},"currentAgent":{},"agentGroup":[{"named":"iAmSuperman","reference":"./file.gpt","toolID":"testdata/TestSysContext/file.gpt:I am Superman Agent"}],"inputContext":null,"toolCategory":"context","toolName":"sys.context"},"program":{"name":"testdata/TestSysContext/test.gpt","entryToolId":"testdata/TestSysContext/test.gpt:","toolSet":{"sys.context":{"name":"sys.context","description":"Retrieves the current internal GPTScript tool call context information","modelName":"gpt-4o","arguments":{"type":"object"},"instructions":"#!sys.context","id":"sys.context","source":{}},"testdata/TestSysContext/file.gpt:I am Superman Agent":{"name":"I am Superman Agent","modelName":"gpt-4o","instructions":"I'm super","id":"testdata/TestSysContext/file.gpt:I am Superman Agent","localTools":{"i am superman agent":"testdata/TestSysContext/file.gpt:I am Superman Agent"},"source":{"location":"testdata/TestSysContext/file.gpt","lineNo":1},"workingDir":"testdata/TestSysContext"},"testdata/TestSysContext/test.gpt:":{"modelName":"gpt-4o","chat":true,"context":["agents"],"agents":["./file.gpt"],"instructions":"Tool body","id":"testdata/TestSysContext/test.gpt:","toolMapping":{"./file.gpt":[{"reference":"./file.gpt","toolID":"testdata/TestSysContext/file.gpt:I am Superman Agent"}],"agents":[{"reference":"agents","toolID":"testdata/TestSysContext/test.gpt:agents"}]},"localTools":{"":"testdata/TestSysContext/test.gpt:","agents":"testdata/TestSysContext/test.gpt:agents"},"source":{"location":"testdata/TestSysContext/test.gpt","lineNo":1},"workingDir":"testdata/TestSysContext"},"testdata/TestSysContext/test.gpt:agents":{"name":"agents","modelName":"gpt-4o","context":["sys.context"],"instructions":"#!/bin/bash\n\necho \"${GPTSCRIPT_CONTEXT}\"\necho \"${GPTSCRIPT_CONTEXT}\" \u003e ${GPTSCRIPT_TOOL_DIR}/context.json","id":"testdata/TestSysContext/test.gpt:agents","toolMapping":{"sys.context":[{"reference":"sys.context","toolID":"sys.context"}]},"localTools":{"":"testdata/TestSysContext/test.gpt:","agents":"testdata/TestSysContext/test.gpt:agents"},"source":{"location":"testdata/TestSysContext/test.gpt","lineNo":8},"workingDir":"testdata/TestSysContext"}}}} diff --git a/pkg/tests/testdata/TestSysContext/step1.golden b/pkg/tests/testdata/TestSysContext/step1.golden index 426e5991..e16a51bf 100644 --- a/pkg/tests/testdata/TestSysContext/step1.golden +++ b/pkg/tests/testdata/TestSysContext/step1.golden @@ -8,7 +8,6 @@ "input": "input 1", "completion": { "model": "gpt-4o", - "internalSystemPrompt": false, "tools": [ { "function": { @@ -31,7 +30,7 @@ "role": "system", "content": [ { - "text": "{\"call\":{\"id\":\"\",\"tool\":{\"name\":\"sys.context\",\"description\":\"Retrieves the current internal GPTScript tool call context information\",\"modelName\":\"gpt-4o\",\"internalPrompt\":null,\"arguments\":{\"type\":\"object\"},\"instructions\":\"#!sys.context\",\"id\":\"sys.context\",\"source\":{}},\"currentAgent\":{},\"agentGroup\":[{\"named\":\"iAmSuperman\",\"reference\":\"./file.gpt\",\"toolID\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\"}],\"inputContext\":null,\"toolCategory\":\"context\",\"toolName\":\"sys.context\"},\"program\":{\"name\":\"testdata/TestSysContext/test.gpt\",\"entryToolId\":\"testdata/TestSysContext/test.gpt:\",\"toolSet\":{\"sys.context\":{\"name\":\"sys.context\",\"description\":\"Retrieves the current internal GPTScript tool call context information\",\"modelName\":\"gpt-4o\",\"internalPrompt\":null,\"arguments\":{\"type\":\"object\"},\"instructions\":\"#!sys.context\",\"id\":\"sys.context\",\"source\":{}},\"testdata/TestSysContext/file.gpt:I am Superman Agent\":{\"name\":\"I am Superman Agent\",\"modelName\":\"gpt-4o\",\"internalPrompt\":null,\"instructions\":\"I'm super\",\"id\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\",\"localTools\":{\"i am superman agent\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\"},\"source\":{\"location\":\"testdata/TestSysContext/file.gpt\",\"lineNo\":1},\"workingDir\":\"testdata/TestSysContext\"},\"testdata/TestSysContext/test.gpt:\":{\"modelName\":\"gpt-4o\",\"chat\":true,\"internalPrompt\":null,\"context\":[\"agents\"],\"agents\":[\"./file.gpt\"],\"instructions\":\"Tool body\",\"id\":\"testdata/TestSysContext/test.gpt:\",\"toolMapping\":{\"./file.gpt\":[{\"reference\":\"./file.gpt\",\"toolID\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\"}],\"agents\":[{\"reference\":\"agents\",\"toolID\":\"testdata/TestSysContext/test.gpt:agents\"}]},\"localTools\":{\"\":\"testdata/TestSysContext/test.gpt:\",\"agents\":\"testdata/TestSysContext/test.gpt:agents\"},\"source\":{\"location\":\"testdata/TestSysContext/test.gpt\",\"lineNo\":1},\"workingDir\":\"testdata/TestSysContext\"},\"testdata/TestSysContext/test.gpt:agents\":{\"name\":\"agents\",\"modelName\":\"gpt-4o\",\"internalPrompt\":null,\"context\":[\"sys.context\"],\"instructions\":\"#!/bin/bash\\n\\necho \\\"${GPTSCRIPT_CONTEXT}\\\"\\necho \\\"${GPTSCRIPT_CONTEXT}\\\" \\u003e ${GPTSCRIPT_TOOL_DIR}/context.json\",\"id\":\"testdata/TestSysContext/test.gpt:agents\",\"toolMapping\":{\"sys.context\":[{\"reference\":\"sys.context\",\"toolID\":\"sys.context\"}]},\"localTools\":{\"\":\"testdata/TestSysContext/test.gpt:\",\"agents\":\"testdata/TestSysContext/test.gpt:agents\"},\"source\":{\"location\":\"testdata/TestSysContext/test.gpt\",\"lineNo\":8},\"workingDir\":\"testdata/TestSysContext\"}}}}\n\nTool body" + "text": "{\"call\":{\"id\":\"\",\"tool\":{\"name\":\"sys.context\",\"description\":\"Retrieves the current internal GPTScript tool call context information\",\"modelName\":\"gpt-4o\",\"arguments\":{\"type\":\"object\"},\"instructions\":\"#!sys.context\",\"id\":\"sys.context\",\"source\":{}},\"currentAgent\":{},\"agentGroup\":[{\"named\":\"iAmSuperman\",\"reference\":\"./file.gpt\",\"toolID\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\"}],\"inputContext\":null,\"toolCategory\":\"context\",\"toolName\":\"sys.context\"},\"program\":{\"name\":\"testdata/TestSysContext/test.gpt\",\"entryToolId\":\"testdata/TestSysContext/test.gpt:\",\"toolSet\":{\"sys.context\":{\"name\":\"sys.context\",\"description\":\"Retrieves the current internal GPTScript tool call context information\",\"modelName\":\"gpt-4o\",\"arguments\":{\"type\":\"object\"},\"instructions\":\"#!sys.context\",\"id\":\"sys.context\",\"source\":{}},\"testdata/TestSysContext/file.gpt:I am Superman Agent\":{\"name\":\"I am Superman Agent\",\"modelName\":\"gpt-4o\",\"instructions\":\"I'm super\",\"id\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\",\"localTools\":{\"i am superman agent\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\"},\"source\":{\"location\":\"testdata/TestSysContext/file.gpt\",\"lineNo\":1},\"workingDir\":\"testdata/TestSysContext\"},\"testdata/TestSysContext/test.gpt:\":{\"modelName\":\"gpt-4o\",\"chat\":true,\"context\":[\"agents\"],\"agents\":[\"./file.gpt\"],\"instructions\":\"Tool body\",\"id\":\"testdata/TestSysContext/test.gpt:\",\"toolMapping\":{\"./file.gpt\":[{\"reference\":\"./file.gpt\",\"toolID\":\"testdata/TestSysContext/file.gpt:I am Superman Agent\"}],\"agents\":[{\"reference\":\"agents\",\"toolID\":\"testdata/TestSysContext/test.gpt:agents\"}]},\"localTools\":{\"\":\"testdata/TestSysContext/test.gpt:\",\"agents\":\"testdata/TestSysContext/test.gpt:agents\"},\"source\":{\"location\":\"testdata/TestSysContext/test.gpt\",\"lineNo\":1},\"workingDir\":\"testdata/TestSysContext\"},\"testdata/TestSysContext/test.gpt:agents\":{\"name\":\"agents\",\"modelName\":\"gpt-4o\",\"context\":[\"sys.context\"],\"instructions\":\"#!/bin/bash\\n\\necho \\\"${GPTSCRIPT_CONTEXT}\\\"\\necho \\\"${GPTSCRIPT_CONTEXT}\\\" \\u003e ${GPTSCRIPT_TOOL_DIR}/context.json\",\"id\":\"testdata/TestSysContext/test.gpt:agents\",\"toolMapping\":{\"sys.context\":[{\"reference\":\"sys.context\",\"toolID\":\"sys.context\"}]},\"localTools\":{\"\":\"testdata/TestSysContext/test.gpt:\",\"agents\":\"testdata/TestSysContext/test.gpt:agents\"},\"source\":{\"location\":\"testdata/TestSysContext/test.gpt\",\"lineNo\":8},\"workingDir\":\"testdata/TestSysContext\"}}}}\n\nTool body" } ], "usage": {} diff --git a/pkg/types/completion.go b/pkg/types/completion.go index dd70ad50..7f5c1e66 100644 --- a/pkg/types/completion.go +++ b/pkg/types/completion.go @@ -9,15 +9,14 @@ import ( ) type CompletionRequest struct { - Model string `json:"model,omitempty"` - InternalSystemPrompt *bool `json:"internalSystemPrompt,omitempty"` - Tools []CompletionTool `json:"tools,omitempty"` - Messages []CompletionMessage `json:"messages,omitempty"` - MaxTokens int `json:"maxTokens,omitempty"` - Chat bool `json:"chat,omitempty"` - Temperature *float32 `json:"temperature,omitempty"` - JSONResponse bool `json:"jsonResponse,omitempty"` - Cache *bool `json:"cache,omitempty"` + Model string `json:"model,omitempty"` + Tools []CompletionTool `json:"tools,omitempty"` + Messages []CompletionMessage `json:"messages,omitempty"` + MaxTokens int `json:"maxTokens,omitempty"` + Chat bool `json:"chat,omitempty"` + Temperature *float32 `json:"temperature,omitempty"` + JSONResponse bool `json:"jsonResponse,omitempty"` + Cache *bool `json:"cache,omitempty"` } func (r *CompletionRequest) GetCache() bool { diff --git a/pkg/types/tool.go b/pkg/types/tool.go index 54d5d817..02b49e13 100644 --- a/pkg/types/tool.go +++ b/pkg/types/tool.go @@ -121,7 +121,6 @@ type Parameters struct { Chat bool `json:"chat,omitempty"` Temperature *float32 `json:"temperature,omitempty"` Cache *bool `json:"cache,omitempty"` - InternalPrompt *bool `json:"internalPrompt"` Arguments *openapi3.Schema `json:"arguments,omitempty"` Tools []string `json:"tools,omitempty"` GlobalTools []string `json:"globalTools,omitempty"` @@ -465,9 +464,6 @@ func (t ToolDef) String() string { _, _ = fmt.Fprintf(buf, "Parameter: %s: %s\n", key, prop.Value.Description) } } - if t.Parameters.InternalPrompt != nil { - _, _ = fmt.Fprintf(buf, "Internal Prompt: %v\n", *t.Parameters.InternalPrompt) - } if len(t.Parameters.Credentials) > 0 { for _, cred := range t.Parameters.Credentials { _, _ = fmt.Fprintf(buf, "Credential: %s\n", cred) diff --git a/pkg/types/tool_test.go b/pkg/types/tool_test.go index a47014a1..8f16068c 100644 --- a/pkg/types/tool_test.go +++ b/pkg/types/tool_test.go @@ -18,7 +18,6 @@ func TestToolDef_String(t *testing.T) { Chat: true, Temperature: float32Ptr(0.8), Cache: boolPtr(true), - InternalPrompt: boolPtr(true), Arguments: ObjectSchema("arg1", "desc1", "arg2", "desc2"), Tools: []string{"Tool1", "Tool2"}, GlobalTools: []string{"GlobalTool1", "GlobalTool2"}, @@ -60,7 +59,6 @@ JSON Response: true Temperature: 0.800000 Parameter: arg1: desc1 Parameter: arg2: desc2 -Internal Prompt: true Credential: Credential1 Credential: Credential2 Share Credential: ExportCredential1