try to fixup tests, enable e2e (#53)

* try to fixup tests, enable e2e

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Generate JSON character data with tools

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Rework generation of character

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Simplify text

Signed-off-by: mudler <mudler@localai.io>

* Relax some test constraints

Signed-off-by: mudler <mudler@localai.io>

* Fixups

* Properly fit schema generation

* Swap default model

* ci fixups

---------

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Signed-off-by: mudler <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto
2025-03-18 23:28:02 +01:00
committed by GitHub
parent 31b5849d02
commit e32a569796
16 changed files with 733 additions and 144 deletions

View File

@@ -7,15 +7,18 @@ import (
)
var _ = Describe("Agent test", func() {
Context("identity", func() {
var agent *Agent
It("generates all the fields with random data", func() {
agent, err := New(
WithLLMAPIURL(apiModel),
var err error
agent, err = New(
WithLLMAPIURL(apiURL),
WithModel(testModel),
WithRandomIdentity(),
)
Expect(err).ToNot(HaveOccurred())
By("generating random identity")
Expect(agent.Character.Name).ToNot(BeEmpty())
Expect(agent.Character.Age).ToNot(BeZero())
Expect(agent.Character.Occupation).ToNot(BeEmpty())
@@ -23,21 +26,20 @@ var _ = Describe("Agent test", func() {
Expect(agent.Character.MusicTaste).ToNot(BeEmpty())
})
It("detect an invalid character", func() {
_, err := New(WithRandomIdentity())
var err error
agent, err = New(WithRandomIdentity())
Expect(err).To(HaveOccurred())
})
It("generates all the fields", func() {
var err error
agent, err := New(
WithLLMAPIURL(apiModel),
WithLLMAPIURL(apiURL),
WithModel(testModel),
WithRandomIdentity("An old man with a long beard, a wizard, who lives in a tower."),
WithRandomIdentity("An 90-year old man with a long beard, a wizard, who lives in a tower."),
)
Expect(err).ToNot(HaveOccurred())
Expect(agent.Character.Name).ToNot(BeEmpty())
Expect(agent.Character.Age).ToNot(BeZero())
Expect(agent.Character.Occupation).ToNot(BeEmpty())
Expect(agent.Character.Hobbies).ToNot(BeEmpty())
Expect(agent.Character.MusicTaste).ToNot(BeEmpty())
})
})
})