From eeb6982623c694b1d4662185376fd3a5ad8c257a Mon Sep 17 00:00:00 2001 From: conneroisu Date: Wed, 16 Oct 2024 14:32:29 -0400 Subject: [PATCH] just test length from generated model response --- README.md | 2 +- models.go | 2 +- models_test.go | 66 +++++++++++++++------ scripts/generate-models/models_test.go.tmpl | 4 +- 4 files changed, 54 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 378fbaf..fe2a177 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ API Documentation: https://console.groq.com/docs/quickstart Code generated by groq\-modeler DO NOT EDIT. -Created at: 2024\-10\-16 14:22:50 +Created at: 2024\-10\-16 14:32:20 groq\-modeler Version 1.1.2 diff --git a/models.go b/models.go index 371a6a3..b6a3d33 100644 --- a/models.go +++ b/models.go @@ -1,6 +1,6 @@ // Code generated by groq-modeler DO NOT EDIT. // -// Created at: 2024-10-16 14:22:50 +// Created at: 2024-10-16 14:32:20 // // groq-modeler Version 1.1.2 package groq diff --git a/models_test.go b/models_test.go index 5c583f1..ac7c52a 100644 --- a/models_test.go +++ b/models_test.go @@ -1,6 +1,6 @@ // Code generated by groq-modeler DO NOT EDIT. // -// Created at: 2024-10-16 14:22:50 +// Created at: 2024-10-16 14:32:20 // // groq-modeler Version 1.1.2 package groq @@ -38,7 +38,9 @@ func TestChatModelsGemma29BIt(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Gemma29BIt calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Gemma29BIt calling CreateChatCompletion") + } } // TestChatModelsGemma7BIt tests the Gemma7BIt model. @@ -65,7 +67,9 @@ func TestChatModelsGemma7BIt(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Gemma7BIt calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Gemma7BIt calling CreateChatCompletion") + } } // TestChatModelsLlama3170BVersatile tests the Llama3170BVersatile model. @@ -92,7 +96,9 @@ func TestChatModelsLlama3170BVersatile(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Llama3170BVersatile calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Llama3170BVersatile calling CreateChatCompletion") + } } // TestChatModelsLlama318BInstant tests the Llama318BInstant model. @@ -119,7 +125,9 @@ func TestChatModelsLlama318BInstant(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Llama318BInstant calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Llama318BInstant calling CreateChatCompletion") + } } // TestChatModelsLlama3211BTextPreview tests the Llama3211BTextPreview model. @@ -146,7 +154,9 @@ func TestChatModelsLlama3211BTextPreview(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Llama3211BTextPreview calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Llama3211BTextPreview calling CreateChatCompletion") + } } // TestChatModelsLlama3211BVisionPreview tests the Llama3211BVisionPreview model. @@ -173,7 +183,9 @@ func TestChatModelsLlama3211BVisionPreview(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Llama3211BVisionPreview calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Llama3211BVisionPreview calling CreateChatCompletion") + } } // TestChatModelsLlama321BPreview tests the Llama321BPreview model. @@ -200,7 +212,9 @@ func TestChatModelsLlama321BPreview(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Llama321BPreview calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Llama321BPreview calling CreateChatCompletion") + } } // TestChatModelsLlama323BPreview tests the Llama323BPreview model. @@ -227,7 +241,9 @@ func TestChatModelsLlama323BPreview(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Llama323BPreview calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Llama323BPreview calling CreateChatCompletion") + } } // TestChatModelsLlama3290BTextPreview tests the Llama3290BTextPreview model. @@ -254,7 +270,9 @@ func TestChatModelsLlama3290BTextPreview(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Llama3290BTextPreview calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Llama3290BTextPreview calling CreateChatCompletion") + } } // TestChatModelsLlama3290BVisionPreview tests the Llama3290BVisionPreview model. @@ -281,7 +299,9 @@ func TestChatModelsLlama3290BVisionPreview(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Llama3290BVisionPreview calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Llama3290BVisionPreview calling CreateChatCompletion") + } } // TestChatModelsLlama370B8192 tests the Llama370B8192 model. @@ -308,7 +328,9 @@ func TestChatModelsLlama370B8192(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Llama370B8192 calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Llama370B8192 calling CreateChatCompletion") + } } // TestChatModelsLlama38B8192 tests the Llama38B8192 model. @@ -335,7 +357,9 @@ func TestChatModelsLlama38B8192(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Llama38B8192 calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Llama38B8192 calling CreateChatCompletion") + } } // TestChatModelsLlama3Groq70B8192ToolUsePreview tests the Llama3Groq70B8192ToolUsePreview model. @@ -362,7 +386,9 @@ func TestChatModelsLlama3Groq70B8192ToolUsePreview(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Llama3Groq70B8192ToolUsePreview calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Llama3Groq70B8192ToolUsePreview calling CreateChatCompletion") + } } // TestChatModelsLlama3Groq8B8192ToolUsePreview tests the Llama3Groq8B8192ToolUsePreview model. @@ -389,7 +415,9 @@ func TestChatModelsLlama3Groq8B8192ToolUsePreview(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Llama3Groq8B8192ToolUsePreview calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Llama3Groq8B8192ToolUsePreview calling CreateChatCompletion") + } } // TestChatModelsLlavaV157B4096Preview tests the LlavaV157B4096Preview model. @@ -416,7 +444,9 @@ func TestChatModelsLlavaV157B4096Preview(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model LlavaV157B4096Preview calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model LlavaV157B4096Preview calling CreateChatCompletion") + } } // TestChatModelsMixtral8X7B32768 tests the Mixtral8X7B32768 model. @@ -443,7 +473,9 @@ func TestChatModelsMixtral8X7B32768(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model Mixtral8X7B32768 calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model Mixtral8X7B32768 calling CreateChatCompletion") + } } // TestWhisperLargeV3 tests the WhisperLargeV3 transcription model. diff --git a/scripts/generate-models/models_test.go.tmpl b/scripts/generate-models/models_test.go.tmpl index 5127f05..5cbb0ac 100644 --- a/scripts/generate-models/models_test.go.tmpl +++ b/scripts/generate-models/models_test.go.tmpl @@ -39,7 +39,9 @@ func TestChatModels{{ $model.Name }}(t *testing.T) { RetryDelay: time.Second * 2, }) a.NoError(err, "CreateChatCompletionJSON error") - a.NotEmpty(response.Choices[0].Message.Content, "response.Choices[0].Message.Content is empty for model {{ $model.Name }} calling CreateChatCompletionJSON") + if len(response.Choices[0].Message.Content) == 0 { + t.Errorf("response.Choices[0].Message.Content is empty for model {{ $model.Name }} calling CreateChatCompletion") + } } {{- end }}