MCPcopy
hub / github.com/openai/openai-go / WithMiddleware

Function WithMiddleware

option/requestoption.go:89–94  ·  view source on GitHub ↗

WithMiddleware returns a RequestOption that applies the given middleware to the requests made. Each middleware will execute in the order they were given.

(middlewares ...Middleware)

Source from the content-addressed store, hash-verified

87// WithMiddleware returns a RequestOption that applies the given middleware
88// to the requests made. Each middleware will execute in the order they were given.
89func WithMiddleware(middlewares ...Middleware) RequestOption {
90 return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
91 r.Middlewares = append(r.Middlewares, middlewares...)
92 return nil
93 })
94}
95
96// WithMaxRetries returns a RequestOption that sets the maximum number of retries that the client
97// attempts to make. When given 0, the client only makes one request. By

Callers 5

WithEndpointFunction · 0.92
WithTokenCredentialFunction · 0.92
WithDebugLogFunction · 0.85

Calls 1

RequestOptionFuncFuncType · 0.92

Tested by 2

Used in the wild real call sites across dependent graphs

searching dependent graphs…