MCPcopy Create free account
hub / github.com/coderabbit214/document-ai / Send

Function Send

pkg/openai/common.go:21–40  ·  view source on GitHub ↗
(suffix string, reqBytes []byte)

Source from the content-addressed store, hash-verified

19}
20
21func Send(suffix string, reqBytes []byte) (body []byte, err error) {
22 req, err := http.NewRequest(http.MethodPost, Api+suffix, bytes.NewBuffer(reqBytes))
23 if err != nil {
24 common.Logger.Error(err.Error())
25 return
26 }
27 req.Header.Set("Content-Type", "application/json")
28 req.Header.Set("Authorization", "Bearer "+common.GlobalObject.OpenAi.Key)
29
30 client := &http.Client{}
31 resp, err := client.Do(req)
32 if err != nil {
33 common.Logger.Error(err.Error())
34 return
35 }
36 defer resp.Body.Close()
37
38 body, err = io.ReadAll(resp.Body)
39 return
40}

Callers 2

SendChatFunction · 0.70
SendEmbeddingsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected