@@ -4,8 +4,10 @@ import (
4
4
"context"
5
5
"encoding/json"
6
6
"os"
7
+ "strings"
7
8
"testing"
8
9
10
+ "github.com/gptscript-ai/gptscript/pkg/openai"
9
11
"github.com/gptscript-ai/gptscript/pkg/tests/tester"
10
12
"github.com/gptscript-ai/gptscript/pkg/types"
11
13
"github.com/hexops/autogold/v2"
@@ -218,7 +220,7 @@ func TestSubChat(t *testing.T) {
218
220
resp , err := r .Chat (context .Background (), nil , prg , os .Environ (), "Hello" )
219
221
require .NoError (t , err )
220
222
221
- autogold .Expect (`{
223
+ autogold .Expect (strings . ReplaceAll ( `{
222
224
"done": false,
223
225
"content": "Assistant 1",
224
226
"toolID": "testdata/TestSubChat/test.gpt:6",
@@ -227,7 +229,7 @@ func TestSubChat(t *testing.T) {
227
229
"state": {
228
230
"input": "Hello",
229
231
"completion": {
230
- "Model": "gpt-4-turbo-preview ",
232
+ "Model": "MODEL ",
231
233
"InternalSystemPrompt": null,
232
234
"Tools": [
233
235
{
@@ -300,7 +302,7 @@ func TestSubChat(t *testing.T) {
300
302
"continuation": {
301
303
"state": {
302
304
"completion": {
303
- "Model": "gpt-4-turbo-preview ",
305
+ "Model": "MODEL ",
304
306
"InternalSystemPrompt": false,
305
307
"Tools": null,
306
308
"Messages": [
@@ -336,12 +338,12 @@ func TestSubChat(t *testing.T) {
336
338
],
337
339
"subCallID": "call_1"
338
340
}
339
- }` ).Equal (t , toJSONString (t , resp ))
341
+ }` , "MODEL" , openai . DefaultModel ) ).Equal (t , toJSONString (t , resp ))
340
342
341
343
resp , err = r .Chat (context .Background (), resp .State , prg , os .Environ (), "User 1" )
342
344
require .NoError (t , err )
343
345
344
- autogold .Expect (`{
346
+ autogold .Expect (strings . ReplaceAll ( `{
345
347
"done": false,
346
348
"content": "Assistant 2",
347
349
"toolID": "testdata/TestSubChat/test.gpt:6",
@@ -350,7 +352,7 @@ func TestSubChat(t *testing.T) {
350
352
"state": {
351
353
"input": "Hello",
352
354
"completion": {
353
- "Model": "gpt-4-turbo-preview ",
355
+ "Model": "MODEL ",
354
356
"InternalSystemPrompt": null,
355
357
"Tools": [
356
358
{
@@ -423,7 +425,7 @@ func TestSubChat(t *testing.T) {
423
425
"continuation": {
424
426
"state": {
425
427
"completion": {
426
- "Model": "gpt-4-turbo-preview ",
428
+ "Model": "MODEL ",
427
429
"InternalSystemPrompt": false,
428
430
"Tools": null,
429
431
"Messages": [
@@ -475,7 +477,7 @@ func TestSubChat(t *testing.T) {
475
477
],
476
478
"subCallID": "call_1"
477
479
}
478
- }` ).Equal (t , toJSONString (t , resp ))
480
+ }` , "MODEL" , openai . DefaultModel ) ).Equal (t , toJSONString (t , resp ))
479
481
}
480
482
481
483
func TestChat (t * testing.T ) {
@@ -492,7 +494,7 @@ func TestChat(t *testing.T) {
492
494
resp , err := r .Chat (context .Background (), nil , prg , os .Environ (), "Hello" )
493
495
require .NoError (t , err )
494
496
495
- autogold .Expect (`{
497
+ autogold .Expect (strings . ReplaceAll ( `{
496
498
"done": false,
497
499
"content": "Assistant 1",
498
500
"toolID": "testdata/TestChat/test.gpt:1",
@@ -501,7 +503,7 @@ func TestChat(t *testing.T) {
501
503
"state": {
502
504
"input": "Hello",
503
505
"completion": {
504
- "Model": "gpt-4-turbo-preview ",
506
+ "Model": "MODEL ",
505
507
"InternalSystemPrompt": false,
506
508
"Tools": null,
507
509
"Messages": [
@@ -541,12 +543,12 @@ func TestChat(t *testing.T) {
541
543
},
542
544
"continuationToolID": "testdata/TestChat/test.gpt:1"
543
545
}
544
- }` ).Equal (t , toJSONString (t , resp ))
546
+ }` , "MODEL" , openai . DefaultModel ) ).Equal (t , toJSONString (t , resp ))
545
547
546
548
resp , err = r .Chat (context .Background (), resp .State , prg , os .Environ (), "User 1" )
547
549
require .NoError (t , err )
548
550
549
- autogold .Expect (`{
551
+ autogold .Expect (strings . ReplaceAll ( `{
550
552
"done": false,
551
553
"content": "Assistant 2",
552
554
"toolID": "testdata/TestChat/test.gpt:1",
@@ -555,7 +557,7 @@ func TestChat(t *testing.T) {
555
557
"state": {
556
558
"input": "Hello",
557
559
"completion": {
558
- "Model": "gpt-4-turbo-preview ",
560
+ "Model": "MODEL ",
559
561
"InternalSystemPrompt": false,
560
562
"Tools": null,
561
563
"Messages": [
@@ -611,7 +613,7 @@ func TestChat(t *testing.T) {
611
613
},
612
614
"continuationToolID": "testdata/TestChat/test.gpt:1"
613
615
}
614
- }` ).Equal (t , toJSONString (t , resp ))
616
+ }` , "MODEL" , openai . DefaultModel ) ).Equal (t , toJSONString (t , resp ))
615
617
}
616
618
617
619
func TestChatRunNoError (t * testing.T ) {
0 commit comments