Skip to content

Commit

Permalink
client v2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
phact committed Oct 15, 2024
1 parent 8b4ca67 commit 680ae9f
Show file tree
Hide file tree
Showing 5 changed files with 1,297 additions and 1,260 deletions.
14 changes: 1 addition & 13 deletions client/astra_assistants/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
import sys

import openai

from .async_openai_with_default_key import AsyncOpenAIWithDefaultKey
from .openai_with_default_key import OpenAIWithDefaultKey
from .patch import patch

OpenAI = OpenAIWithDefaultKey
openai.OpenAI = OpenAI
sys.modules['openai'].OpenAI = OpenAI

AsyncOpenAI = AsyncOpenAIWithDefaultKey
openai.AsyncOpenAI = AsyncOpenAI
sys.modules['openai'].AsyncOpenAI = AsyncOpenAI

__all__ = ["OpenAI", "AsyncOpenAI", "patch"]
__all__ = ["OpenAIWithDefaultKey", "AsyncOpenAIWithDefaultKey", "patch"]
2 changes: 2 additions & 0 deletions client/astra_assistants/async_openai_with_default_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

class AsyncOpenAIWithDefaultKey(AsyncOpenAI):
def __init__(self, *args, **kwargs):
if kwargs.get("api_key") is not None:
return super(AsyncOpenAIWithDefaultKey, self).__init__(*args, **kwargs)
key = os.environ.get("OPENAI_API_KEY", "dummy")
if key == "dummy":
logger.debug("OPENAI_API_KEY is unset. Setting it to 'dummy' so openai doesn't kill the "
Expand Down
2 changes: 2 additions & 0 deletions client/astra_assistants/openai_with_default_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

class OpenAIWithDefaultKey(OpenAI):
def __init__(self, *args, **kwargs):
#if kwargs.get("api_key") is not None:
# return super(OpenAIWithDefaultKey, self).__init__(*args, **kwargs)
key = os.environ.get("OPENAI_API_KEY", "dummy")
if key == "dummy":
logger.debug("OPENAI_API_KEY is unset. Setting it to 'dummy' so openai doesn't kill the "
Expand Down
Loading

0 comments on commit 680ae9f

Please sign in to comment.