aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2023-12-09 11:25:12 -0500
committerXe Iaso <me@xeiaso.net>2023-12-14 11:47:18 -0500
commita549412eacff66f495db347bc57371de99219b33 (patch)
treecc42454e2bcf889a7b1c7044275c0550dbcf6873
parente3d3291226f3e76b6968d422262fe4398e35a936 (diff)
downloadx-a549412eacff66f495db347bc57371de99219b33.tar.xz
x-a549412eacff66f495db347bc57371de99219b33.zip
web/openai/moderation: constructor method
Signed-off-by: Xe Iaso <me@xeiaso.net>
-rw-r--r--web/openai/moderation/moderation.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/web/openai/moderation/moderation.go b/web/openai/moderation/moderation.go
index 7f73bf2..0476b1c 100644
--- a/web/openai/moderation/moderation.go
+++ b/web/openai/moderation/moderation.go
@@ -97,6 +97,13 @@ type Client struct {
apiKey string
}
+func New(httpCli *http.Client, apiKey string) *Client {
+ return &Client{
+ httpCli: httpCli,
+ apiKey: apiKey,
+ }
+}
+
func (c Client) Check(ctx context.Context, input string) (*Response, error) {
data := Request{
Input: input,