Files
go-openai/config.go
sashabaranov 1eb5d625f8 Better configuration (#79)
* Configurable Transport (#75)

* new functions to allow HTTPClient configuration

* updated go.mod for testing from remote

* updated go.mod for remote testing

* revert go.mod replace directives

* Fixed NewOrgClientWithTransport comment

* Make client fully configurable

* make empty messages limit configurable #70 #71

* make auth token private in config

* add docs

* lint

---------

Co-authored-by: Michael Fox <m.will.fox@gmail.com>
2023-02-21 00:16:44 +04:00

34 lines
557 B
Go

package gogpt
import (
"net/http"
)
const (
apiURLv1 = "https://api.openai.com/v1"
defaultEmptyMessagesLimit uint = 300
)
// ClientConfig is a configuration of a client.
type ClientConfig struct {
authToken string
HTTPClient *http.Client
BaseURL string
OrgID string
EmptyMessagesLimit uint
}
func DefaultConfig(authToken string) ClientConfig {
return ClientConfig{
HTTPClient: &http.Client{},
BaseURL: apiURLv1,
OrgID: "",
authToken: authToken,
EmptyMessagesLimit: defaultEmptyMessagesLimit,
}
}