mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-24 06:46:39 +00:00
tests: enable whisper (#239)
This commit is contained in:
parent
8250391e49
commit
b4241d0a0d
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
. "github.com/go-skynet/LocalAI/api"
|
. "github.com/go-skynet/LocalAI/api"
|
||||||
"github.com/go-skynet/LocalAI/pkg/model"
|
"github.com/go-skynet/LocalAI/pkg/model"
|
||||||
@ -46,7 +47,7 @@ var _ = Describe("API test", func() {
|
|||||||
It("returns the models list", func() {
|
It("returns the models list", func() {
|
||||||
models, err := client.ListModels(context.TODO())
|
models, err := client.ListModels(context.TODO())
|
||||||
Expect(err).ToNot(HaveOccurred())
|
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"))
|
Expect(models.Models[0].ID).To(Equal("testmodel"))
|
||||||
})
|
})
|
||||||
It("can generate completions", func() {
|
It("can generate completions", func() {
|
||||||
@ -82,7 +83,10 @@ var _ = Describe("API test", func() {
|
|||||||
Expect(err).To(HaveOccurred())
|
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:"))
|
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(
|
resp, err := client.CreateTranscription(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
openai.AudioRequest{
|
openai.AudioRequest{
|
||||||
@ -119,7 +123,7 @@ var _ = Describe("API test", func() {
|
|||||||
|
|
||||||
models, err := client.ListModels(context.TODO())
|
models, err := client.ListModels(context.TODO())
|
||||||
Expect(err).ToNot(HaveOccurred())
|
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"))
|
Expect(models.Models[0].ID).To(Equal("testmodel"))
|
||||||
})
|
})
|
||||||
It("can generate chat completions from config file", func() {
|
It("can generate chat completions from config file", func() {
|
||||||
|
4
tests/fixtures/whisper.yaml
vendored
Normal file
4
tests/fixtures/whisper.yaml
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
name: whisper-1
|
||||||
|
backend: whisper
|
||||||
|
parameters:
|
||||||
|
model: whisper-en
|
Loading…
Reference in New Issue
Block a user