Skip to content

Commit

Permalink
use identified api key when creating OpenAI clients
Browse files Browse the repository at this point in the history
  • Loading branch information
varjas committed Jan 10, 2025
1 parent 891b317 commit cc194a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/langchain/langchain/chains/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def validate_environment(cls, values: Dict) -> Any:
if values["openai_pre_1_0"]:
values["client"] = openai.Moderation
else:
values["client"] = openai.OpenAI()
values["async_client"] = openai.AsyncOpenAI()
values["client"] = openai.OpenAI(api_key=openai_api_key)
values["async_client"] = openai.AsyncOpenAI(api_key=openai_api_key)

except ImportError:
raise ImportError(
Expand Down

0 comments on commit cc194a3

Please sign in to comment.