-
-// inputTexts returns the text of each user message of the input of call.
-func inputTexts(t *testing.T, call ModelFakeCall) []string {
- t.Helper()
-
- var body struct {
- Input []struct {
- Role string `json:"role"`
- Content []struct {
- Text string `json:"text"`
- } `json:"content"`
- } `json:"input"`
- }
-
- require.NoError(t, json.Unmarshal(call.raw, &body))
-
- var texts []string
- for _, item := range body.Input {
- if item.Role != "user" {
- continue
- }
-
- var text strings.Builder
- for _, part := range item.Content {
- text.WriteString(part.Text)
- }
-
- texts = append(texts, text.String())
- }
-
- return texts
-}