client/ollama: install and use (*Client).HTTPClient
This commit is contained in:
parent
f6e02d4bc7
commit
6acc205de0
@ -36,6 +36,8 @@ var I_Acknowledge_This_API_Is_Under_Development bool
|
|||||||
type Client struct {
|
type Client struct {
|
||||||
// BaseURL is the base URL of the Ollama API.
|
// BaseURL is the base URL of the Ollama API.
|
||||||
BaseURL string
|
BaseURL string
|
||||||
|
|
||||||
|
HTTPClient *http.Client // The HTTP client to use. If nil, http.DefaultClient is used.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build requests the remote Ollama service to build a model. It uploads any
|
// Build requests the remote Ollama service to build a model. It uploads any
|
||||||
@ -104,7 +106,8 @@ func Do[Res any](ctx context.Context, c *Client, method, path string, in any) (*
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := http.DefaultClient.Do(req)
|
hc := cmp.Or(c.HTTPClient, http.DefaultClient)
|
||||||
|
res, err := hc.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user