Skip to content

chore: update default model to gpt-4-turbo #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ OUTPUT:
Hello, World!
```

The model used by default is `gpt-4-turbo-preview` and you must have access to that model in your OpenAI account.
The model used by default is `gpt-4-turbo` and you must have access to that model in your OpenAI account.

If using Azure OpenAI, make sure you configure the model to be one of the supported versions with the `--default-model` argument.

Expand Down Expand Up @@ -244,7 +244,7 @@ Tool parameters are key-value pairs defined at the beginning of a tool block, be
| Key | Description |
|------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `Name` | The name of the tool. |
| `Model Name` | The OpenAI model to use, by default it uses "gpt-4-turbo-preview" |
| `Model Name` | The OpenAI model to use, by default it uses "gpt-4-turbo" |
| `Description` | The description of the tool. It is important that this properly describes the tool's purpose as the description is used by the LLM. |
| `Internal Prompt`| Setting this to `false` will disable the built-in system prompt for this tool. |
| `Tools` | A comma-separated list of tools that are available to be called by this tool. |
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/02-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ OUTPUT:
Hello, World!
```

The model used by default is `gpt-4-turbo-preview` and you must have access to that model in your OpenAI account.
The model used by default is `gpt-4-turbo` and you must have access to that model in your OpenAI account.

If using Azure OpenAI, make sure you configure the model to be one of the supported versions with the `--default-model` argument.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/07-gpt-file-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Tool parameters are key-value pairs defined at the beginning of a tool block, be
| Key | Description |
|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| `Name` | The name of the tool. |
| `Model Name` | The OpenAI model to use, by default it uses "gpt-4-turbo-preview" |
| `Model Name` | The OpenAI model to use, by default it uses "gpt-4-turbo" |
| `Description` | The description of the tool. It is important that this properly describes the tool's purpose as the description is used by the LLM. |
| `Internal Prompt` | Setting this to `false` will disable the built-in system prompt for this tool. |
| `Tools` | A comma-separated list of tools that are available to be called by this tool. |
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/fatih/color v1.16.0
github.com/getkin/kin-openapi v0.123.0
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/gptscript-ai/chat-completion-client v0.0.0-20240404013040-49eb8f6affa1
github.com/gptscript-ai/chat-completion-client v0.0.0-20240502162133-7dabc28eab59
github.com/hexops/autogold/v2 v2.2.1
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056
github.com/mholt/archiver/v4 v4.0.0-alpha.8
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gptscript-ai/chat-completion-client v0.0.0-20240404013040-49eb8f6affa1 h1:h0ikiEkB6lUgiOKN5ltZ7rzIvA13qjz8qcB/3wWdCws=
github.com/gptscript-ai/chat-completion-client v0.0.0-20240404013040-49eb8f6affa1/go.mod h1:7P/o6/IWa1KqsntVf68hSnLKuu3+xuqm6lYhch1w4jo=
github.com/gptscript-ai/chat-completion-client v0.0.0-20240502162133-7dabc28eab59 h1:Nda0GDkrmIDiAFHfaXu0eIp6SsBs0/4Zyo87ff3Qcqo=
github.com/gptscript-ai/chat-completion-client v0.0.0-20240502162133-7dabc28eab59/go.mod h1:7P/o6/IWa1KqsntVf68hSnLKuu3+xuqm6lYhch1w4jo=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/gptscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (r *GPTScript) PersistentPre(*cobra.Command, []string) error {
color.NoColor = !*r.Color
}

if r.DefaultModel != "gpt-4-turbo-preview" {
if r.DefaultModel != openai.DefaultModel {
log.Infof("WARNING: Changing the default model can have unknown behavior for existing tools. Use the model field per tool instead.")
}

Expand Down
16 changes: 9 additions & 7 deletions pkg/loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package loader
import (
"context"
"encoding/json"
"strings"
"testing"

"github.com/gptscript-ai/gptscript/pkg/openai"
"github.com/hexops/autogold/v2"
"github.com/stretchr/testify/require"
)
Expand All @@ -22,12 +24,12 @@ func TestHelloWorld(t *testing.T) {
"https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/sub/tool.gpt",
"")
require.NoError(t, err)
autogold.Expect(`{
autogold.Expect(strings.ReplaceAll(`{
"name": "https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/sub/tool.gpt",
"entryToolId": "https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/sub/tool.gpt:1",
"toolSet": {
"https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/bob.gpt:1": {
"modelName": "gpt-4-turbo-preview",
"modelName": "MODEL",
"internalPrompt": null,
"instructions": "Say hello world",
"id": "https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/bob.gpt:1",
Expand All @@ -41,7 +43,7 @@ func TestHelloWorld(t *testing.T) {
"workingDir": "https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example"
},
"https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/sub/tool.gpt:1": {
"modelName": "gpt-4-turbo-preview",
"modelName": "MODEL",
"internalPrompt": null,
"tools": [
"../bob.gpt"
Expand All @@ -61,18 +63,18 @@ func TestHelloWorld(t *testing.T) {
"workingDir": "https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/sub"
}
}
}`).Equal(t, toString(prg))
}`, "MODEL", openai.DefaultModel)).Equal(t, toString(prg))

prg, err = Program(context.Background(), "https://get.gptscript.ai/echo.gpt", "")
require.NoError(t, err)

autogold.Expect(`{
autogold.Expect(strings.ReplaceAll(`{
"name": "https://get.gptscript.ai/echo.gpt",
"entryToolId": "https://get.gptscript.ai/echo.gpt:1",
"toolSet": {
"https://get.gptscript.ai/echo.gpt:1": {
"description": "Returns back the input of the script",
"modelName": "gpt-4-turbo-preview",
"modelName": "MODEL",
"internalPrompt": null,
"arguments": {
"properties": {
Expand All @@ -95,7 +97,7 @@ func TestHelloWorld(t *testing.T) {
"workingDir": "https://get.gptscript.ai/"
}
}
}`).Equal(t, toString(prg))
}`, "MODEL", openai.DefaultModel)).Equal(t, toString(prg))
}

func TestParse(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/openai/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
)

const (
DefaultModel = openai.GPT4TurboPreview
DefaultModel = openai.GPT4Turbo
)

var (
Expand All @@ -47,7 +47,7 @@ type Options struct {
APIVersion string `usage:"OpenAI API Version (for Azure)" name:"openai-api-version" env:"OPENAI_API_VERSION"`
APIType openai.APIType `usage:"OpenAI API Type (valid: OPEN_AI, AZURE, AZURE_AD)" name:"openai-api-type" env:"OPENAI_API_TYPE"`
OrgID string `usage:"OpenAI organization ID" name:"openai-org-id" env:"OPENAI_ORG_ID"`
DefaultModel string `usage:"Default LLM model to use" default:"gpt-4-turbo-preview"`
DefaultModel string `usage:"Default LLM model to use" default:"gpt-4-turbo"`
ConfigFile string `usage:"Path to GPTScript config file" name:"config"`
SetSeed bool `usage:"-"`
CacheKey string `usage:"-"`
Expand Down
30 changes: 16 additions & 14 deletions pkg/tests/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import (
"context"
"encoding/json"
"os"
"strings"
"testing"

"github.com/gptscript-ai/gptscript/pkg/openai"
"github.com/gptscript-ai/gptscript/pkg/tests/tester"
"github.com/gptscript-ai/gptscript/pkg/types"
"github.com/hexops/autogold/v2"
Expand Down Expand Up @@ -218,7 +220,7 @@ func TestSubChat(t *testing.T) {
resp, err := r.Chat(context.Background(), nil, prg, os.Environ(), "Hello")
require.NoError(t, err)

autogold.Expect(`{
autogold.Expect(strings.ReplaceAll(`{
"done": false,
"content": "Assistant 1",
"toolID": "testdata/TestSubChat/test.gpt:6",
Expand All @@ -227,7 +229,7 @@ func TestSubChat(t *testing.T) {
"state": {
"input": "Hello",
"completion": {
"Model": "gpt-4-turbo-preview",
"Model": "MODEL",
"InternalSystemPrompt": null,
"Tools": [
{
Expand Down Expand Up @@ -300,7 +302,7 @@ func TestSubChat(t *testing.T) {
"continuation": {
"state": {
"completion": {
"Model": "gpt-4-turbo-preview",
"Model": "MODEL",
"InternalSystemPrompt": false,
"Tools": null,
"Messages": [
Expand Down Expand Up @@ -336,12 +338,12 @@ func TestSubChat(t *testing.T) {
],
"subCallID": "call_1"
}
}`).Equal(t, toJSONString(t, resp))
}`, "MODEL", openai.DefaultModel)).Equal(t, toJSONString(t, resp))

resp, err = r.Chat(context.Background(), resp.State, prg, os.Environ(), "User 1")
require.NoError(t, err)

autogold.Expect(`{
autogold.Expect(strings.ReplaceAll(`{
"done": false,
"content": "Assistant 2",
"toolID": "testdata/TestSubChat/test.gpt:6",
Expand All @@ -350,7 +352,7 @@ func TestSubChat(t *testing.T) {
"state": {
"input": "Hello",
"completion": {
"Model": "gpt-4-turbo-preview",
"Model": "MODEL",
"InternalSystemPrompt": null,
"Tools": [
{
Expand Down Expand Up @@ -423,7 +425,7 @@ func TestSubChat(t *testing.T) {
"continuation": {
"state": {
"completion": {
"Model": "gpt-4-turbo-preview",
"Model": "MODEL",
"InternalSystemPrompt": false,
"Tools": null,
"Messages": [
Expand Down Expand Up @@ -475,7 +477,7 @@ func TestSubChat(t *testing.T) {
],
"subCallID": "call_1"
}
}`).Equal(t, toJSONString(t, resp))
}`, "MODEL", openai.DefaultModel)).Equal(t, toJSONString(t, resp))
}

func TestChat(t *testing.T) {
Expand All @@ -492,7 +494,7 @@ func TestChat(t *testing.T) {
resp, err := r.Chat(context.Background(), nil, prg, os.Environ(), "Hello")
require.NoError(t, err)

autogold.Expect(`{
autogold.Expect(strings.ReplaceAll(`{
"done": false,
"content": "Assistant 1",
"toolID": "testdata/TestChat/test.gpt:1",
Expand All @@ -501,7 +503,7 @@ func TestChat(t *testing.T) {
"state": {
"input": "Hello",
"completion": {
"Model": "gpt-4-turbo-preview",
"Model": "MODEL",
"InternalSystemPrompt": false,
"Tools": null,
"Messages": [
Expand Down Expand Up @@ -541,12 +543,12 @@ func TestChat(t *testing.T) {
},
"continuationToolID": "testdata/TestChat/test.gpt:1"
}
}`).Equal(t, toJSONString(t, resp))
}`, "MODEL", openai.DefaultModel)).Equal(t, toJSONString(t, resp))

resp, err = r.Chat(context.Background(), resp.State, prg, os.Environ(), "User 1")
require.NoError(t, err)

autogold.Expect(`{
autogold.Expect(strings.ReplaceAll(`{
"done": false,
"content": "Assistant 2",
"toolID": "testdata/TestChat/test.gpt:1",
Expand All @@ -555,7 +557,7 @@ func TestChat(t *testing.T) {
"state": {
"input": "Hello",
"completion": {
"Model": "gpt-4-turbo-preview",
"Model": "MODEL",
"InternalSystemPrompt": false,
"Tools": null,
"Messages": [
Expand Down Expand Up @@ -611,7 +613,7 @@ func TestChat(t *testing.T) {
},
"continuationToolID": "testdata/TestChat/test.gpt:1"
}
}`).Equal(t, toJSONString(t, resp))
}`, "MODEL", openai.DefaultModel)).Equal(t, toJSONString(t, resp))
}

func TestChatRunNoError(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestCase/call1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": null,
"Tools": [
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestCase2/call1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": null,
"Tools": [
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestChat/call1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": false,
"Tools": null,
"Messages": [
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestChat/call2.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": false,
"Tools": null,
"Messages": [
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestChatRunNoError/call1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": false,
"Tools": null,
"Messages": [
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestContext/call1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": null,
"Tools": null,
"Messages": [
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestContextArg/call1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": null,
"Tools": null,
"Messages": [
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestContextSubChat/call1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": null,
"Tools": [
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestContextSubChat/call10.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": false,
"Tools": null,
"Messages": [
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestContextSubChat/call2.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": false,
"Tools": [
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestContextSubChat/call3.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": false,
"Tools": [
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestContextSubChat/call4.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": null,
"Tools": [
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestContextSubChat/call5.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": false,
"Tools": null,
"Messages": [
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestContextSubChat/call6.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": null,
"Tools": [
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestContextSubChat/call7.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": false,
"Tools": [
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestContextSubChat/call8.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": false,
"Tools": [
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/testdata/TestContextSubChat/call9.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
`{
"Model": "gpt-4-turbo-preview",
"Model": "gpt-4-turbo",
"InternalSystemPrompt": null,
"Tools": [
{
Expand Down
Loading