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

Function WithMaxRetries

option/requestoption.go:101–109  ·  view source on GitHub ↗

WithMaxRetries returns a RequestOption that sets the maximum number of retries that the client attempts to make. When given 0, the client only makes one request. By default, the client retries two times. WithMaxRetries panics when retries is negative.

(retries int)

Source from the content-addressed store, hash-verified

99//
100// WithMaxRetries panics when retries is negative.
101func WithMaxRetries(retries int) RequestOption {
102 if retries < 0 {
103 panic("option: cannot have fewer than 0 retries")
104 }
105 return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
106 r.MaxRetries = retries
107 return nil
108 })
109}
110
111// WithHeader returns a RequestOption that sets the header value to the associated key. It overwrites
112// any value if there was one already present.

Callers

nothing calls this directly

Calls 1

RequestOptionFuncFuncType · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…