Harrison/allow org none (#2527)

This commit is contained in:
Harrison Chase 2023-04-06 23:00:42 -07:00 committed by GitHub
parent aecd1c8ee3
commit 704b0feb38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 6 deletions

View File

@ -39,7 +39,10 @@ class OpenAIModerationChain(Chain):
values, "openai_api_key", "OPENAI_API_KEY"
)
openai_organization = get_from_dict_or_env(
values, "openai_organization", "OPENAI_ORGANIZATION", default=None
values,
"openai_organization",
"OPENAI_ORGANIZATION",
default="",
)
try:
import openai

View File

@ -69,7 +69,10 @@ class AzureChatOpenAI(ChatOpenAI):
"OPENAI_API_TYPE",
)
openai_organization = get_from_dict_or_env(
values, "openai_organization", "OPENAI_ORGANIZATION", default=None
values,
"openai_organization",
"OPENAI_ORGANIZATION",
default="",
)
try:
import openai

View File

@ -152,7 +152,10 @@ class ChatOpenAI(BaseChatModel):
values, "openai_api_key", "OPENAI_API_KEY"
)
openai_organization = get_from_dict_or_env(
values, "openai_organization", "OPENAI_ORGANIZATION", default=None
values,
"openai_organization",
"OPENAI_ORGANIZATION",
default="",
)
try:
import openai

View File

@ -160,7 +160,10 @@ class OpenAIEmbeddings(BaseModel, Embeddings):
values, "openai_api_key", "OPENAI_API_KEY"
)
openai_organization = get_from_dict_or_env(
values, "openai_organization", "OPENAI_ORGANIZATION", default=None
values,
"openai_organization",
"OPENAI_ORGANIZATION",
default="",
)
try:
import openai

View File

@ -205,7 +205,10 @@ class BaseOpenAI(BaseLLM):
values, "openai_api_key", "OPENAI_API_KEY"
)
openai_organization = get_from_dict_or_env(
values, "openai_organization", "OPENAI_ORGANIZATION", default=None
values,
"openai_organization",
"OPENAI_ORGANIZATION",
default="",
)
try:
import openai
@ -596,7 +599,7 @@ class OpenAIChat(BaseLLM):
values, "openai_api_key", "OPENAI_API_KEY"
)
openai_organization = get_from_dict_or_env(
values, "openai_organization", "OPENAI_ORGANIZATION", default=None
values, "openai_organization", "OPENAI_ORGANIZATION", default=""
)
try:
import openai