From 6a07fdd7bdbec8e2633a5a2a474adca9fc3fb2fa Mon Sep 17 00:00:00 2001 From: Bijay Regmi Date: Sun, 10 Sep 2023 11:08:44 +0200 Subject: [PATCH] ensure linting and code standard --- pandasai/llm/openai.py | 8 +++----- tests/llms/test_openai.py | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pandasai/llm/openai.py b/pandasai/llm/openai.py index 5a215e609..ddbcc23e8 100644 --- a/pandasai/llm/openai.py +++ b/pandasai/llm/openai.py @@ -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, ): """ @@ -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: diff --git a/tests/llms/test_openai.py b/tests/llms/test_openai.py index 07d8d5e22..efd71ba4a 100644 --- a/tests/llms/test_openai.py +++ b/tests/llms/test_openai.py @@ -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"