* 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>
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package agent_test
|
|
|
|
import (
|
|
. "github.com/mudler/LocalAgent/core/agent"
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
var _ = Describe("Agent test", func() {
|
|
Context("identity", func() {
|
|
var agent *Agent
|
|
|
|
It("generates all the fields with random data", func() {
|
|
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())
|
|
Expect(agent.Character.Hobbies).ToNot(BeEmpty())
|
|
Expect(agent.Character.MusicTaste).ToNot(BeEmpty())
|
|
})
|
|
It("detect an invalid character", func() {
|
|
var err error
|
|
agent, err = New(WithRandomIdentity())
|
|
Expect(err).To(HaveOccurred())
|
|
})
|
|
It("generates all the fields", func() {
|
|
var err error
|
|
|
|
agent, err := New(
|
|
WithLLMAPIURL(apiURL),
|
|
WithModel(testModel),
|
|
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())
|
|
})
|
|
})
|
|
})
|