From b8eb00f44e704000429b03ce5518fc952ae42c93 Mon Sep 17 00:00:00 2001 From: Andrii Ieroshenko Date: Fri, 15 Dec 2023 09:00:50 -0800 Subject: [PATCH] show button state --- packages/jupyter-ai-magics/jupyter_ai_magics/providers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/jupyter-ai-magics/jupyter_ai_magics/providers.py b/packages/jupyter-ai-magics/jupyter_ai_magics/providers.py index a2e22f5c1..4d30ac0f7 100644 --- a/packages/jupyter-ai-magics/jupyter_ai_magics/providers.py +++ b/packages/jupyter-ai-magics/jupyter_ai_magics/providers.py @@ -520,6 +520,7 @@ class OpenAIProvider(BaseProvider, OpenAI): pypi_package_deps = ["openai"] auth_strategy = EnvAuthStrategy(name="OPENAI_API_KEY") + @classmethod def is_api_key_exc(cls, e: Exception): """ Determine if the exception is an OpenAI API key error. @@ -558,6 +559,7 @@ def append_exchange(self, prompt: str, output: str): self.prefix_messages.append({"role": "user", "content": prompt}) self.prefix_messages.append({"role": "assistant", "content": output}) + @classmethod def is_api_key_exc(cls, e: Exception): """ Determine if the exception is an OpenAI API key error. @@ -602,6 +604,7 @@ class ChatOpenAINewProvider(BaseProvider, ChatOpenAI): TextField(key="openai_proxy", label="Proxy (optional)", format="text"), ] + @classmethod def is_api_key_exc(cls, e: Exception): """ Determine if the exception is an OpenAI API key error.