Skip to content

Commit c8b4d57

Browse files
authored
Merge pull request #307 from njhale/bump-oai-default-model
chore: update default model to gpt-4-turbo
2 parents 5d42f19 + 190861f commit c8b4d57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+83
-79
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ OUTPUT:
118118
Hello, World!
119119
```
120120

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

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

@@ -244,7 +244,7 @@ Tool parameters are key-value pairs defined at the beginning of a tool block, be
244244
| Key | Description |
245245
|------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
246246
| `Name` | The name of the tool. |
247-
| `Model Name` | The OpenAI model to use, by default it uses "gpt-4-turbo-preview" |
247+
| `Model Name` | The OpenAI model to use, by default it uses "gpt-4-turbo" |
248248
| `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. |
249249
| `Internal Prompt`| Setting this to `false` will disable the built-in system prompt for this tool. |
250250
| `Tools` | A comma-separated list of tools that are available to be called by this tool. |

docs/docs/02-getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ OUTPUT:
5959
Hello, World!
6060
```
6161

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

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

docs/docs/07-gpt-file-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Tool parameters are key-value pairs defined at the beginning of a tool block, be
4646
| Key | Description |
4747
|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
4848
| `Name` | The name of the tool. |
49-
| `Model Name` | The OpenAI model to use, by default it uses "gpt-4-turbo-preview" |
49+
| `Model Name` | The OpenAI model to use, by default it uses "gpt-4-turbo" |
5050
| `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. |
5151
| `Internal Prompt` | Setting this to `false` will disable the built-in system prompt for this tool. |
5252
| `Tools` | A comma-separated list of tools that are available to be called by this tool. |

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
github.com/fatih/color v1.16.0
1515
github.com/getkin/kin-openapi v0.123.0
1616
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
17-
github.com/gptscript-ai/chat-completion-client v0.0.0-20240404013040-49eb8f6affa1
17+
github.com/gptscript-ai/chat-completion-client v0.0.0-20240502162133-7dabc28eab59
1818
github.com/hexops/autogold/v2 v2.2.1
1919
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056
2020
github.com/mholt/archiver/v4 v4.0.0-alpha.8

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+
123123
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
124124
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
125125
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
126-
github.com/gptscript-ai/chat-completion-client v0.0.0-20240404013040-49eb8f6affa1 h1:h0ikiEkB6lUgiOKN5ltZ7rzIvA13qjz8qcB/3wWdCws=
127-
github.com/gptscript-ai/chat-completion-client v0.0.0-20240404013040-49eb8f6affa1/go.mod h1:7P/o6/IWa1KqsntVf68hSnLKuu3+xuqm6lYhch1w4jo=
126+
github.com/gptscript-ai/chat-completion-client v0.0.0-20240502162133-7dabc28eab59 h1:Nda0GDkrmIDiAFHfaXu0eIp6SsBs0/4Zyo87ff3Qcqo=
127+
github.com/gptscript-ai/chat-completion-client v0.0.0-20240502162133-7dabc28eab59/go.mod h1:7P/o6/IWa1KqsntVf68hSnLKuu3+xuqm6lYhch1w4jo=
128128
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
129129
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
130130
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=

pkg/cli/gptscript.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func (r *GPTScript) PersistentPre(*cobra.Command, []string) error {
243243
color.NoColor = !*r.Color
244244
}
245245

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

pkg/loader/loader_test.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ package loader
33
import (
44
"context"
55
"encoding/json"
6+
"strings"
67
"testing"
78

9+
"github.com/gptscript-ai/gptscript/pkg/openai"
810
"github.com/hexops/autogold/v2"
911
"github.com/stretchr/testify/require"
1012
)
@@ -22,12 +24,12 @@ func TestHelloWorld(t *testing.T) {
2224
"https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/sub/tool.gpt",
2325
"")
2426
require.NoError(t, err)
25-
autogold.Expect(`{
27+
autogold.Expect(strings.ReplaceAll(`{
2628
"name": "https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/sub/tool.gpt",
2729
"entryToolId": "https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/sub/tool.gpt:1",
2830
"toolSet": {
2931
"https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/bob.gpt:1": {
30-
"modelName": "gpt-4-turbo-preview",
32+
"modelName": "MODEL",
3133
"internalPrompt": null,
3234
"instructions": "Say hello world",
3335
"id": "https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/bob.gpt:1",
@@ -41,7 +43,7 @@ func TestHelloWorld(t *testing.T) {
4143
"workingDir": "https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example"
4244
},
4345
"https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/sub/tool.gpt:1": {
44-
"modelName": "gpt-4-turbo-preview",
46+
"modelName": "MODEL",
4547
"internalPrompt": null,
4648
"tools": [
4749
"../bob.gpt"
@@ -61,18 +63,18 @@ func TestHelloWorld(t *testing.T) {
6163
"workingDir": "https://raw.githubusercontent.com/ibuildthecloud/test/bafe5a62174e8a0ea162277dcfe3a2ddb7eea928/example/sub"
6264
}
6365
}
64-
}`).Equal(t, toString(prg))
66+
}`, "MODEL", openai.DefaultModel)).Equal(t, toString(prg))
6567

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

69-
autogold.Expect(`{
71+
autogold.Expect(strings.ReplaceAll(`{
7072
"name": "https://get.gptscript.ai/echo.gpt",
7173
"entryToolId": "https://get.gptscript.ai/echo.gpt:1",
7274
"toolSet": {
7375
"https://get.gptscript.ai/echo.gpt:1": {
7476
"description": "Returns back the input of the script",
75-
"modelName": "gpt-4-turbo-preview",
77+
"modelName": "MODEL",
7678
"internalPrompt": null,
7779
"arguments": {
7880
"properties": {
@@ -95,7 +97,7 @@ func TestHelloWorld(t *testing.T) {
9597
"workingDir": "https://get.gptscript.ai/"
9698
}
9799
}
98-
}`).Equal(t, toString(prg))
100+
}`, "MODEL", openai.DefaultModel)).Equal(t, toString(prg))
99101
}
100102

101103
func TestParse(t *testing.T) {

pkg/openai/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
)
2323

2424
const (
25-
DefaultModel = openai.GPT4TurboPreview
25+
DefaultModel = openai.GPT4Turbo
2626
)
2727

2828
var (
@@ -47,7 +47,7 @@ type Options struct {
4747
APIVersion string `usage:"OpenAI API Version (for Azure)" name:"openai-api-version" env:"OPENAI_API_VERSION"`
4848
APIType openai.APIType `usage:"OpenAI API Type (valid: OPEN_AI, AZURE, AZURE_AD)" name:"openai-api-type" env:"OPENAI_API_TYPE"`
4949
OrgID string `usage:"OpenAI organization ID" name:"openai-org-id" env:"OPENAI_ORG_ID"`
50-
DefaultModel string `usage:"Default LLM model to use" default:"gpt-4-turbo-preview"`
50+
DefaultModel string `usage:"Default LLM model to use" default:"gpt-4-turbo"`
5151
ConfigFile string `usage:"Path to GPTScript config file" name:"config"`
5252
SetSeed bool `usage:"-"`
5353
CacheKey string `usage:"-"`

pkg/tests/runner_test.go

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import (
44
"context"
55
"encoding/json"
66
"os"
7+
"strings"
78
"testing"
89

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

221-
autogold.Expect(`{
223+
autogold.Expect(strings.ReplaceAll(`{
222224
"done": false,
223225
"content": "Assistant 1",
224226
"toolID": "testdata/TestSubChat/test.gpt:6",
@@ -227,7 +229,7 @@ func TestSubChat(t *testing.T) {
227229
"state": {
228230
"input": "Hello",
229231
"completion": {
230-
"Model": "gpt-4-turbo-preview",
232+
"Model": "MODEL",
231233
"InternalSystemPrompt": null,
232234
"Tools": [
233235
{
@@ -300,7 +302,7 @@ func TestSubChat(t *testing.T) {
300302
"continuation": {
301303
"state": {
302304
"completion": {
303-
"Model": "gpt-4-turbo-preview",
305+
"Model": "MODEL",
304306
"InternalSystemPrompt": false,
305307
"Tools": null,
306308
"Messages": [
@@ -336,12 +338,12 @@ func TestSubChat(t *testing.T) {
336338
],
337339
"subCallID": "call_1"
338340
}
339-
}`).Equal(t, toJSONString(t, resp))
341+
}`, "MODEL", openai.DefaultModel)).Equal(t, toJSONString(t, resp))
340342

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

344-
autogold.Expect(`{
346+
autogold.Expect(strings.ReplaceAll(`{
345347
"done": false,
346348
"content": "Assistant 2",
347349
"toolID": "testdata/TestSubChat/test.gpt:6",
@@ -350,7 +352,7 @@ func TestSubChat(t *testing.T) {
350352
"state": {
351353
"input": "Hello",
352354
"completion": {
353-
"Model": "gpt-4-turbo-preview",
355+
"Model": "MODEL",
354356
"InternalSystemPrompt": null,
355357
"Tools": [
356358
{
@@ -423,7 +425,7 @@ func TestSubChat(t *testing.T) {
423425
"continuation": {
424426
"state": {
425427
"completion": {
426-
"Model": "gpt-4-turbo-preview",
428+
"Model": "MODEL",
427429
"InternalSystemPrompt": false,
428430
"Tools": null,
429431
"Messages": [
@@ -475,7 +477,7 @@ func TestSubChat(t *testing.T) {
475477
],
476478
"subCallID": "call_1"
477479
}
478-
}`).Equal(t, toJSONString(t, resp))
480+
}`, "MODEL", openai.DefaultModel)).Equal(t, toJSONString(t, resp))
479481
}
480482

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

495-
autogold.Expect(`{
497+
autogold.Expect(strings.ReplaceAll(`{
496498
"done": false,
497499
"content": "Assistant 1",
498500
"toolID": "testdata/TestChat/test.gpt:1",
@@ -501,7 +503,7 @@ func TestChat(t *testing.T) {
501503
"state": {
502504
"input": "Hello",
503505
"completion": {
504-
"Model": "gpt-4-turbo-preview",
506+
"Model": "MODEL",
505507
"InternalSystemPrompt": false,
506508
"Tools": null,
507509
"Messages": [
@@ -541,12 +543,12 @@ func TestChat(t *testing.T) {
541543
},
542544
"continuationToolID": "testdata/TestChat/test.gpt:1"
543545
}
544-
}`).Equal(t, toJSONString(t, resp))
546+
}`, "MODEL", openai.DefaultModel)).Equal(t, toJSONString(t, resp))
545547

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

549-
autogold.Expect(`{
551+
autogold.Expect(strings.ReplaceAll(`{
550552
"done": false,
551553
"content": "Assistant 2",
552554
"toolID": "testdata/TestChat/test.gpt:1",
@@ -555,7 +557,7 @@ func TestChat(t *testing.T) {
555557
"state": {
556558
"input": "Hello",
557559
"completion": {
558-
"Model": "gpt-4-turbo-preview",
560+
"Model": "MODEL",
559561
"InternalSystemPrompt": false,
560562
"Tools": null,
561563
"Messages": [
@@ -611,7 +613,7 @@ func TestChat(t *testing.T) {
611613
},
612614
"continuationToolID": "testdata/TestChat/test.gpt:1"
613615
}
614-
}`).Equal(t, toJSONString(t, resp))
616+
}`, "MODEL", openai.DefaultModel)).Equal(t, toJSONString(t, resp))
615617
}
616618

617619
func TestChatRunNoError(t *testing.T) {

pkg/tests/testdata/TestCase/call1.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": null,
44
"Tools": [
55
{

pkg/tests/testdata/TestCase2/call1.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": null,
44
"Tools": [
55
{

pkg/tests/testdata/TestChat/call1.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": false,
44
"Tools": null,
55
"Messages": [

pkg/tests/testdata/TestChat/call2.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": false,
44
"Tools": null,
55
"Messages": [

pkg/tests/testdata/TestChatRunNoError/call1.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": false,
44
"Tools": null,
55
"Messages": [

pkg/tests/testdata/TestContext/call1.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": null,
44
"Tools": null,
55
"Messages": [

pkg/tests/testdata/TestContextArg/call1.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": null,
44
"Tools": null,
55
"Messages": [

pkg/tests/testdata/TestContextSubChat/call1.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": null,
44
"Tools": [
55
{

pkg/tests/testdata/TestContextSubChat/call10.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": false,
44
"Tools": null,
55
"Messages": [

pkg/tests/testdata/TestContextSubChat/call2.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": false,
44
"Tools": [
55
{

pkg/tests/testdata/TestContextSubChat/call3.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": false,
44
"Tools": [
55
{

pkg/tests/testdata/TestContextSubChat/call4.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": null,
44
"Tools": [
55
{

pkg/tests/testdata/TestContextSubChat/call5.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": false,
44
"Tools": null,
55
"Messages": [

pkg/tests/testdata/TestContextSubChat/call6.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": null,
44
"Tools": [
55
{

pkg/tests/testdata/TestContextSubChat/call7.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": false,
44
"Tools": [
55
{

pkg/tests/testdata/TestContextSubChat/call8.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": false,
44
"Tools": [
55
{

pkg/tests/testdata/TestContextSubChat/call9.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`{
2-
"Model": "gpt-4-turbo-preview",
2+
"Model": "gpt-4-turbo",
33
"InternalSystemPrompt": null,
44
"Tools": [
55
{

0 commit comments

Comments
 (0)