forked from mudler/cogito
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguidelines_e2e_test.go
More file actions
52 lines (46 loc) · 1.42 KB
/
Copy pathguidelines_e2e_test.go
File metadata and controls
52 lines (46 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package cogito_test
import (
. "github.com/mudler/cogito"
"github.com/mudler/cogito/clients"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("cogito test", Label("e2e"), func() {
Context("Guidelines", func() {
It("is able to find relevant guidelines", func() {
defaultLLM := clients.NewOpenAILLM(defaultModel, "", apiEndpoint)
conv := NewEmptyFragment().AddMessage("user", "When Isaac Asimov was born?")
guidelines := Guidelines{
Guideline{
Condition: "User asks about informations",
Action: "Use the search tool to find information about Isaac Asimov.",
Tools: Tools{
NewToolDefinition(
(&SearchTool{}),
SearchArgs{},
"search",
"A search engine to find information about a topic",
),
},
},
Guideline{
Condition: "User asks for the weather in a city ",
Action: "Use the weather tool to find the weather in the city.",
Tools: Tools{
NewToolDefinition(
(&GetWeatherTool{}),
WeatherArgs{},
"get_weather",
"Get weather information",
),
},
},
}
relevantGuidelines, err := GetRelevantGuidelines(defaultLLM, guidelines, conv)
Expect(err).ToNot(HaveOccurred())
Expect(len(relevantGuidelines)).To(Equal(1))
Expect(relevantGuidelines).ToNot(BeEmpty())
Expect(relevantGuidelines[0].Condition).To(ContainSubstring("User asks about informations"))
})
})
})