-
Notifications
You must be signed in to change notification settings - Fork 0
/
wrapper_test.go
54 lines (48 loc) · 1.02 KB
/
wrapper_test.go
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
53
54
package wrapper
import "testing"
func TestListModels(t *testing.T) {
c, err := NewGPTClient("http://localhost:4891/v1", "")
if err != nil {
t.Fatal(err)
}
models, err := c.ListModels()
if err != nil {
t.Fatal(err)
}
t.Log(models)
}
func TestRetrieveModel(t *testing.T) {
c, err := NewGPTClient("http://localhost:4891/v1", "")
if err != nil {
t.Fatal(err)
}
model, err := c.RetrieveModel("mpt-7b-chat")
if err != nil {
t.Fatal(err)
}
t.Log(model)
}
func TestCreateCompletion(t *testing.T) {
c, err := NewGPTClient("http://localhost:4891/v1", "")
if err != nil {
t.Fatal(err)
}
cResp,err:=c.CreateCompletion("")
if err!=nil{
t.Fatal(err)
}
t.Log(cResp)
}
func TestCreateCompletionRawRequest(t *testing.T) {
c, err := NewGPTClient("http://localhost:4891/v1", "")
if err != nil {
t.Fatal(err)
}
cReq:=getDefaultDataCompletionReq()
cReq.Prompt="Please tell me the things about Rust Programming language."
cResp,err:=c.CreateCompletionRawRequest(cReq)
if err!=nil{
t.Fatal(err)
}
t.Log(cResp)
}