@@ -30,6 +30,30 @@ func TestChat(t *testing.T) {
3030 assert .Equal (t , res .Choices [0 ].Message .Content , "Test Succeeded" )
3131}
3232
33+ func TestChatCodestral (t * testing.T ) {
34+ client := NewCodestralClientDefault ("" )
35+ params := DefaultChatRequestParams
36+ params .MaxTokens = 10
37+ params .Temperature = 0
38+ res , err := client .Chat (
39+ ModelCodestralLatest ,
40+ []ChatMessage {
41+ {
42+ Role : RoleUser ,
43+ Content : "You are in test mode and must reply to this with exactly and only `Test Succeeded`" ,
44+ },
45+ },
46+ & params ,
47+ )
48+ assert .NoError (t , err )
49+ assert .NotNil (t , res )
50+
51+ assert .Greater (t , len (res .Choices ), 0 )
52+ assert .Greater (t , len (res .Choices [0 ].Message .Content ), 0 )
53+ assert .Equal (t , res .Choices [0 ].Message .Role , RoleAssistant )
54+ assert .Equal (t , res .Choices [0 ].Message .Content , "Test Succeeded" )
55+ }
56+
3357func TestChatFunctionCall (t * testing.T ) {
3458 client := NewMistralClientDefault ("" )
3559 params := DefaultChatRequestParams
@@ -135,6 +159,7 @@ func TestChatFunctionCall2(t *testing.T) {
135159 Role : RoleAssistant ,
136160 ToolCalls : []ToolCall {
137161 {
162+ Id : "aaaaaaaaa" ,
138163 Type : ToolTypeFunction ,
139164 Function : FunctionCall {
140165 Name : "get_weather" ,
@@ -166,7 +191,7 @@ func TestChatJsonMode(t *testing.T) {
166191 params .Temperature = 0
167192 params .ResponseFormat = ResponseFormatJsonObject
168193 res , err := client .Chat (
169- ModelMistralSmallLatest ,
194+ ModelOpenMixtral8x22b ,
170195 []ChatMessage {
171196 {
172197 Role : RoleUser ,
@@ -186,7 +211,7 @@ func TestChatJsonMode(t *testing.T) {
186211 assert .Greater (t , len (res .Choices ), 0 )
187212 assert .Greater (t , len (res .Choices [0 ].Message .Content ), 0 )
188213 assert .Equal (t , res .Choices [0 ].Message .Role , RoleAssistant )
189- assert .Equal (t , res .Choices [0 ].Message .Content , "{\" symbols\" : [\" Go\" , \" ChatMessage\" , \" FunctionCall\" , \" ToolCall\" ]}" )
214+ assert .Equal (t , res .Choices [0 ].Message .Content , "{\" symbols\" : [\" Go\" , \" ChatMessage\" , \" Any \" , \" FunctionCall\" , \" ToolCall\" , \" ToolResponse \" ]}" )
190215}
191216
192217func TestChatStream (t * testing.T ) {
@@ -309,7 +334,7 @@ func TestChatStreamJsonMode(t *testing.T) {
309334 params .Temperature = 0
310335 params .ResponseFormat = ResponseFormatJsonObject
311336 resChan , err := client .ChatStream (
312- ModelMistralSmallLatest ,
337+ ModelOpenMixtral8x22b ,
313338 []ChatMessage {
314339 {
315340 Role : RoleUser ,
@@ -347,6 +372,6 @@ func TestChatStreamJsonMode(t *testing.T) {
347372 }
348373 }
349374
350- assert .Equal (t , totalOutput , "{\" symbols\" : [\" Go\" , \" ChatMessage\" , \" FunctionCall\" , \" ToolCall\" ]}" )
375+ assert .Equal (t , totalOutput , "{\" symbols\" : [\" Go\" , \" ChatMessage\" , \" Any \" , \" FunctionCall\" , \" ToolCall\" , \" ToolResponse \" ]}" )
351376 assert .Nil (t , functionCall )
352377}
0 commit comments