Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
mudler committed Oct 17, 2023
1 parent 2411b9e commit 0ce46c8
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package e2e_test

import (
"context"
"fmt"
"os/exec"

. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -37,28 +38,28 @@ var _ = Describe("E2E test", func() {
cmd := exec.Command("/bin/bash", "-xce", "docker logs $(docker ps -q --filter ancestor=localai-tests)")
out, err := cmd.CombinedOutput()
Expect(err).ToNot(HaveOccurred())
Expect(string(out)).To(ContainSubstring("found 1 CUDA devices"))
Expect(string(out)).To(ContainSubstring("using CUDA for GPU acceleration"))
Expect(string(out)).To(ContainSubstring("found 1 CUDA devices"), string(out))
Expect(string(out)).To(ContainSubstring("using CUDA for GPU acceleration"), string(out))
})

Context("Generates text", func() {
It("streams chat tokens", func() {
models, err := client.ListModels(context.TODO())
Expect(err).ToNot(HaveOccurred())
Expect(models.Models).ToNot(BeEmpty(), models.Models)
// models, err := client.ListModels(context.TODO())
// Expect(err).ToNot(HaveOccurred())
// Expect(models.Models).ToNot(BeEmpty(), models.Models)

model := models.Models[0].ID
resp, err := client.CreateChatCompletion(context.TODO(), openai.ChatCompletionRequest{
Model: model, Messages: []openai.ChatCompletionMessage{
{
Role: "user",
Content: "How much is 2+2?",
},
}})
model := "gpt-4"
resp, err := client.CreateChatCompletion(context.TODO(),
openai.ChatCompletionRequest{
Model: model, Messages: []openai.ChatCompletionMessage{
{
Role: "user",
Content: "How much is 2+2?",
},
}})
Expect(err).ToNot(HaveOccurred())
Expect(len(resp.Choices)).To(Equal(1))
Expect(resp.Choices[0].Message.Content).To(Or(ContainSubstring("4"), ContainSubstring("four")))

Expect(len(resp.Choices)).To(Equal(1), fmt.Sprint(resp))
Expect(resp.Choices[0].Message.Content).To(Or(ContainSubstring("4"), ContainSubstring("four")), fmt.Sprint(resp.Choices[0].Message.Content))
})
})
})
Expand Down

0 comments on commit 0ce46c8

Please sign in to comment.