Skip to content

Commit 61f8587

Browse files
committed
tests: add llama tests with openllama
Signed-off-by: mudler <mudler@mocaccino.org>
1 parent 5abbb13 commit 61f8587

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,9 @@ test-models/testmodel:
245245
test: prepare test-models/testmodel
246246
cp -r backend-assets api
247247
cp tests/models_fixtures/* test-models
248-
C_INCLUDE_PATH=${C_INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} TEST_DIR=$(abspath ./)/test-dir/ FIXTURES=$(abspath ./)/tests/fixtures CONFIG_FILE=$(abspath ./)/test-models/config.yaml MODELS_PATH=$(abspath ./)/test-models $(GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --label-filter="!gpt4all" --flake-attempts 5 -v -r ./api ./pkg
248+
C_INCLUDE_PATH=${C_INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} TEST_DIR=$(abspath ./)/test-dir/ FIXTURES=$(abspath ./)/tests/fixtures CONFIG_FILE=$(abspath ./)/test-models/config.yaml MODELS_PATH=$(abspath ./)/test-models $(GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --label-filter="!gpt4all && !llama" --flake-attempts 5 -v -r ./api ./pkg
249249
C_INCLUDE_PATH=${C_INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} TEST_DIR=$(abspath ./)/test-dir/ FIXTURES=$(abspath ./)/tests/fixtures CONFIG_FILE=$(abspath ./)/test-models/config.yaml MODELS_PATH=$(abspath ./)/test-models $(GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --label-filter="gpt4all" --flake-attempts 5 -v -r ./api ./pkg
250+
C_INCLUDE_PATH=${C_INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} TEST_DIR=$(abspath ./)/test-dir/ FIXTURES=$(abspath ./)/tests/fixtures CONFIG_FILE=$(abspath ./)/test-models/config.yaml MODELS_PATH=$(abspath ./)/test-models $(GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --label-filter="llama" --flake-attempts 5 -v -r ./api ./pkg
250251

251252
## Help:
252253
help: ## Show this help.

api/api_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,30 @@ var _ = Describe("API test", func() {
195195
Expect(err).ToNot(HaveOccurred())
196196
Expect(content["backend"]).To(Equal("bert-embeddings"))
197197
})
198+
199+
It("runs openllama", Label("llama"), func() {
200+
response := postModelApplyRequest("http://127.0.0.1:9090/models/apply", modelApplyRequest{
201+
URL: "github:go-skynet/model-gallery/openllama_3b.yaml",
202+
Name: "openllama_3b",
203+
Overrides: map[string]string{},
204+
})
205+
206+
Expect(response["uuid"]).ToNot(BeEmpty(), fmt.Sprint(response))
207+
208+
uuid := response["uuid"].(string)
209+
210+
Eventually(func() bool {
211+
response := getModelStatus("http://127.0.0.1:9090/models/jobs/" + uuid)
212+
fmt.Println(response)
213+
return response["processed"].(bool)
214+
}, "360s").Should(Equal(true))
215+
216+
resp, err := client.CreateCompletion(context.TODO(), openai.CompletionRequest{Model: "openllama_3b", Prompt: "Count up to five: one, two, three, four, "})
217+
Expect(err).ToNot(HaveOccurred())
218+
Expect(len(resp.Choices)).To(Equal(1))
219+
Expect(resp.Choices[0].Text).To(ContainSubstring("five"))
220+
})
221+
198222
It("runs gpt4all", Label("gpt4all"), func() {
199223
if runtime.GOOS != "linux" {
200224
Skip("test supported only on linux")

0 commit comments

Comments
 (0)