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

Function SendChat

pkg/openai/chat.go:68–84  ·  view source on GitHub ↗

SendChat returns an ChatCompletionResponse

(request ChatCompletionRequest)

Source from the content-addressed store, hash-verified

66
67// SendChat returns an ChatCompletionResponse
68func SendChat(request ChatCompletionRequest) (chatCompletionResponse ChatCompletionResponse, err error) {
69 var reqBytes []byte
70 reqBytes, err = json.Marshal(request)
71 if err != nil {
72 common.Logger.Error(err.Error())
73 return
74 }
75
76 body, err := Send(chatApi, reqBytes)
77 if err != nil {
78 common.Logger.Error(err.Error())
79 return
80 }
81
82 err = json.Unmarshal(body, &chatCompletionResponse)
83 return
84}

Callers 2

chatFunction · 0.92
TestSendChatFunction · 0.85

Calls 1

SendFunction · 0.70

Tested by 1

TestSendChatFunction · 0.68