From b4241d0a0d8cfb1d78795c7a4427b69713b698a2 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Fri, 12 May 2023 14:10:18 +0200 Subject: [PATCH] tests: enable whisper (#239) --- api/api_test.go | 10 +++++++--- tests/fixtures/whisper.yaml | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 tests/fixtures/whisper.yaml diff --git a/api/api_test.go b/api/api_test.go index 1189cdb..e443311 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -4,6 +4,7 @@ import ( "context" "os" "path/filepath" + "runtime" . "github.com/go-skynet/LocalAI/api" "github.com/go-skynet/LocalAI/pkg/model" @@ -46,7 +47,7 @@ var _ = Describe("API test", func() { It("returns the models list", func() { models, err := client.ListModels(context.TODO()) Expect(err).ToNot(HaveOccurred()) - Expect(len(models.Models)).To(Equal(4)) + Expect(len(models.Models)).To(Equal(5)) Expect(models.Models[0].ID).To(Equal("testmodel")) }) It("can generate completions", func() { @@ -82,7 +83,10 @@ var _ = Describe("API test", func() { Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("error, status code: 500, message: could not load model - all backends returned error: 12 errors occurred:")) }) - PIt("transcribes audio", func() { + It("transcribes audio", func() { + if runtime.GOOS != "linux" { + Skip("test supported only on linux") + } resp, err := client.CreateTranscription( context.Background(), openai.AudioRequest{ @@ -119,7 +123,7 @@ var _ = Describe("API test", func() { models, err := client.ListModels(context.TODO()) Expect(err).ToNot(HaveOccurred()) - Expect(len(models.Models)).To(Equal(6)) + Expect(len(models.Models)).To(Equal(7)) Expect(models.Models[0].ID).To(Equal("testmodel")) }) It("can generate chat completions from config file", func() { diff --git a/tests/fixtures/whisper.yaml b/tests/fixtures/whisper.yaml new file mode 100644 index 0000000..4ea99ef --- /dev/null +++ b/tests/fixtures/whisper.yaml @@ -0,0 +1,4 @@ +name: whisper-1 +backend: whisper +parameters: + model: whisper-en \ No newline at end of file