-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathengines.go
42 lines (34 loc) · 1.04 KB
/
engines.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
package openai_gosdk
const enginesURL = "https://api.openai.com/v1/engines"
type RequestEngines struct{}
type ResponseEngines struct {
Data []struct {
Id string `json:"id"`
Object string `json:"object"`
Owner string `json:"owner"`
Ready bool `json:"ready"`
} `json:"data"`
Object string `json:"object"`
}
func NewEngines(baseOpenAI BaseOpenAI) OpenAI[RequestEngines, ResponseEngines] {
return OpenAI[RequestEngines, ResponseEngines]{
BaseOpenAI: baseOpenAI,
TargetURL: enginesURL,
Method: GET,
}
}
const retrieveEngineURL = "https://api.openai.com/v1/engines/"
type RequestRetrieveEngine struct{}
type ResponseRetrieveEngine struct {
Id string `json:"id"`
Object string `json:"object"`
Owner string `json:"owner"`
Ready bool `json:"ready"`
}
func NewRetrieveEngine(baseOpenAI BaseOpenAI, engineID string) OpenAI[RequestRetrieveEngine, ResponseRetrieveEngine] {
return OpenAI[RequestRetrieveEngine, ResponseRetrieveEngine]{
BaseOpenAI: baseOpenAI,
TargetURL: retrieveEngineURL + engineID,
Method: GET,
}
}