Skip to content

Commit 09dc7ef

Browse files
authored
Add api_key parameter to Moderation.create (#123)
* Add api_key parameter to Moderation.create * Reverted auto-formatted linting
1 parent e51ae91 commit 09dc7ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

openai/api_resources/moderation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ def get_url(self):
1111
return "/moderations"
1212

1313
@classmethod
14-
def create(cls, input: Union[str, List[str]], model: Optional[str] = None):
14+
def create(cls, input: Union[str, List[str]], model: Optional[str] = None, api_key: Optional[str] = None):
1515
if model is not None and model not in cls.VALID_MODEL_NAMES:
1616
raise ValueError(
1717
f"The parameter model should be chosen from {cls.VALID_MODEL_NAMES} "
1818
f"and it is default to be None."
1919
)
2020

21-
instance = cls()
21+
instance = cls(api_key=api_key)
2222
params = {"input": input}
2323
if model is not None:
2424
params["model"] = model

0 commit comments

Comments
 (0)