MCPcopy Create free account
hub / github.com/coder/aibridge / requestOptions

Method requestOptions

intercept/responses/base.go:151–169  ·  view source on GitHub ↗
(respCopy *responseCopier)

Source from the content-addressed store, hash-verified

149}
150
151func (i *responsesInterceptionBase) requestOptions(respCopy *responseCopier) []option.RequestOption {
152 opts := []option.RequestOption{
153 // Sends original payload to solve json re-encoding issues
154 // eg. Codex CLI produces requests without ID set in reasoning items: https://platform.openai.com/docs/api-reference/responses/create#responses_create-input-input_item_list-item-reasoning-id
155 // when re-encoded, ID field is set to empty string which results
156 // in bad request while not sending ID field at all somehow works.
157 option.WithRequestBody("application/json", []byte(i.reqPayload)),
158
159 // copyMiddleware copies body of original response body to the buffer in responseCopier,
160 // also reference to headers and status code is kept responseCopier.
161 // responseCopier is used by interceptors to forward response as it was received,
162 // eliminating any possibility of JSON re-encoding issues.
163 option.WithMiddleware(respCopy.copyMiddleware),
164 }
165 if !i.reqPayload.Stream() {
166 opts = append(opts, option.WithRequestTimeout(requestTimeout))
167 }
168 return opts
169}
170
171func (i *responsesInterceptionBase) recordUserPrompt(ctx context.Context, responseID string, prompt string) {
172 if responseID == "" {

Callers 2

ProcessRequestMethod · 0.80
ProcessRequestMethod · 0.80

Calls 1

StreamMethod · 0.45

Tested by

no test coverage detected