|
|
@ -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() { |
|
|
|