@@ -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
481483func 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
617619func TestChatRunNoError (t * testing.T ) {
0 commit comments