Skip to content

Commit

Permalink
ensure linting and code standard
Browse files Browse the repository at this point in the history
  • Loading branch information
regmibijay committed Sep 10, 2023
1 parent 6649f7a commit 6a07fdd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions pandasai/llm/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class OpenAI(BaseOpenAI):
def __init__(
self,
api_token: Optional[str] = None,
api_key_path: Optional[str] = None
api_key_path: Optional[str] = None,
**kwargs,
):
"""
Expand All @@ -64,10 +64,8 @@ def __init__(
self.api_key_path = api_key_path

if (not self.api_token) and (not self.api_key_path):
raise APIKeyNotFoundError(
"Either OpenAI API key or key path is required"
)

raise APIKeyNotFoundError("Either OpenAI API key or key path is required")

if self.api_token:
openai.api_key = self.api_token
else:
Expand Down
4 changes: 2 additions & 2 deletions tests/llms/test_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def test_type_without_token(self):

def test_type_with_token(self):
assert OpenAI(api_token="test").type == "openai"

def test_type_with_key_path(self):
assert OpenAI(api_key_file=".key").type == "openai"
assert OpenAI(api_key_path=".key").type == "openai"

def test_proxy(self):
proxy = "http://proxy.mycompany.com:8080"
Expand Down

0 comments on commit 6a07fdd

Please sign in to comment.