MCPcopy Index your code
hub / github.com/coder/coder / recordOpenAIRequest

Function recordOpenAIRequest

coderd/x/chatd/chatd_test.go:187–218  ·  view source on GitHub ↗
(req *chattest.OpenAIRequest)

Source from the content-addressed store, hash-verified

185}
186
187func recordOpenAIRequest(req *chattest.OpenAIRequest) recordedOpenAIRequest {
188 messages := append([]chattest.OpenAIMessage(nil), req.Messages...)
189 tools := make([]string, 0, len(req.Tools))
190 for _, tool := range req.Tools {
191 tools = append(tools, openAIToolName(tool))
192 }
193
194 var store *bool
195 if req.Store != nil {
196 value := *req.Store
197 store = &value
198 }
199
200 var previousResponseID *string
201 if req.PreviousResponseID != nil {
202 value := *req.PreviousResponseID
203 previousResponseID = &value
204 }
205
206 var contentLength int64
207 if req.Request != nil {
208 contentLength = req.Request.ContentLength
209 }
210
211 return recordedOpenAIRequest{
212 Messages: messages,
213 Tools: tools,
214 Store: store,
215 PreviousResponseID: previousResponseID,
216 ContentLength: contentLength,
217 }
218}
219
220func requestHasSystemSubstring(req recordedOpenAIRequest, want string) bool {
221 for _, msg := range req.Messages {

Calls 1

openAIToolNameFunction · 0.85

Tested by

no test coverage detected