mirror of
https://github.com/mudler/LocalAI.git
synced 2025-06-30 06:30:43 +00:00
No need to test rwkv specifically, now part of llama.cpp
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
8abaeda244
commit
288bfc521b
1 changed files with 0 additions and 67 deletions
|
@ -5,14 +5,12 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"embed"
|
"embed"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/mudler/LocalAI/core/config"
|
"github.com/mudler/LocalAI/core/config"
|
||||||
. "github.com/mudler/LocalAI/core/http"
|
. "github.com/mudler/LocalAI/core/http"
|
||||||
|
@ -913,71 +911,6 @@ var _ = Describe("API test", func() {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
Context("backends", func() {
|
|
||||||
It("runs rwkv completion", func() {
|
|
||||||
if runtime.GOOS != "linux" {
|
|
||||||
Skip("test supported only on linux")
|
|
||||||
}
|
|
||||||
resp, err := client.CreateCompletion(context.TODO(), openai.CompletionRequest{Model: "rwkv_test", Prompt: "Count up to five: one, two, three, four,"})
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
Expect(len(resp.Choices) > 0).To(BeTrue())
|
|
||||||
Expect(resp.Choices[0].Text).To(ContainSubstring("five"))
|
|
||||||
|
|
||||||
stream, err := client.CreateCompletionStream(context.TODO(), openai.CompletionRequest{
|
|
||||||
Model: "rwkv_test", Prompt: "Count up to five: one, two, three, four,", Stream: true,
|
|
||||||
})
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
defer stream.Close()
|
|
||||||
|
|
||||||
tokens := 0
|
|
||||||
text := ""
|
|
||||||
for {
|
|
||||||
response, err := stream.Recv()
|
|
||||||
if errors.Is(err, io.EOF) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
text += response.Choices[0].Text
|
|
||||||
tokens++
|
|
||||||
}
|
|
||||||
Expect(text).ToNot(BeEmpty())
|
|
||||||
Expect(text).To(ContainSubstring("five"))
|
|
||||||
Expect(tokens).ToNot(Or(Equal(1), Equal(0)))
|
|
||||||
})
|
|
||||||
It("runs rwkv chat completion", func() {
|
|
||||||
if runtime.GOOS != "linux" {
|
|
||||||
Skip("test supported only on linux")
|
|
||||||
}
|
|
||||||
resp, err := client.CreateChatCompletion(context.TODO(),
|
|
||||||
openai.ChatCompletionRequest{Model: "rwkv_test", Messages: []openai.ChatCompletionMessage{{Content: "Can you count up to five?", Role: "user"}}})
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
Expect(len(resp.Choices) > 0).To(BeTrue())
|
|
||||||
Expect(strings.ToLower(resp.Choices[0].Message.Content)).To(Or(ContainSubstring("sure"), ContainSubstring("five"), ContainSubstring("5")))
|
|
||||||
|
|
||||||
stream, err := client.CreateChatCompletionStream(context.TODO(), openai.ChatCompletionRequest{Model: "rwkv_test", Messages: []openai.ChatCompletionMessage{{Content: "Can you count up to five?", Role: "user"}}})
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
defer stream.Close()
|
|
||||||
|
|
||||||
tokens := 0
|
|
||||||
text := ""
|
|
||||||
for {
|
|
||||||
response, err := stream.Recv()
|
|
||||||
if errors.Is(err, io.EOF) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
text += response.Choices[0].Delta.Content
|
|
||||||
tokens++
|
|
||||||
}
|
|
||||||
Expect(text).ToNot(BeEmpty())
|
|
||||||
Expect(strings.ToLower(text)).To(Or(ContainSubstring("sure"), ContainSubstring("five")))
|
|
||||||
|
|
||||||
Expect(tokens).ToNot(Or(Equal(1), Equal(0)))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
// See tests/integration/stores_test
|
// See tests/integration/stores_test
|
||||||
Context("Stores", Label("stores"), func() {
|
Context("Stores", Label("stores"), func() {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue