Skip to content

Commit

Permalink
Allow custom http client
Browse files Browse the repository at this point in the history
  • Loading branch information
hupe1980 committed Jun 25, 2023
1 parent 54ac4ef commit 9c5541f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion huggingface.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type InferenceClientOptions struct {
Model string
Endpoint string
InferenceEndpoint string
HTTPClient HTTPClient
}

// InferenceClient is a client for performing inference using Hugging Face models.
Expand All @@ -45,8 +46,12 @@ func NewInferenceClient(token string, optFns ...func(o *InferenceClientOptions))
fn(&opts)
}

if opts.HTTPClient == nil {
opts.HTTPClient = http.DefaultClient
}

return &InferenceClient{
httpClient: http.DefaultClient,
httpClient: opts.HTTPClient,
token: token,
opts: opts,
}
Expand Down

0 comments on commit 9c5541f

Please sign in to comment.