Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/chore-update-registry1-weekly-bu…
Browse files Browse the repository at this point in the history
…ndle-0.13.0' into 835-upgrade-vllm-for-gptq-bfloat16-inferencing
  • Loading branch information
justinthelaw committed Oct 1, 2024
2 parents 8caf64f + a6f0af0 commit 0b291f4
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions tests/utils/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
DEFAULT_TEST_PASSWORD = "password"


def get_supabase_url() -> str:
"""Get the URL for Supabase.
Returns:
str: The URL for Supabase. (default: "https://supabase-kong.uds.dev/auth/v1")
"""

return os.getenv("SUPABASE_URL", "https://supabase-kong.uds.dev/auth/v1")


def create_test_user(
anon_key: str = ANON_KEY,
email: str = DEFAULT_TEST_EMAIL,
Expand All @@ -34,6 +44,8 @@ def create_test_user(
Returns:
str: The JWT token for the created or existing user.
"""
supabase_base_url = get_supabase_url()

headers = {
"apikey": f"{anon_key}",
"Authorization": f"Bearer {anon_key}",
Expand All @@ -56,10 +68,11 @@ def create_test_user(
traceback.format_exc(),
)

return get_jwt_token(anon_key, email, password)
return get_jwt_token(anon_key, email, password, supabase_base_url)


def get_jwt_token(
supabase_base_url: str,
api_key: str,
test_email: str = DEFAULT_TEST_EMAIL,
test_password: str = DEFAULT_TEST_PASSWORD,
Expand All @@ -81,7 +94,8 @@ def get_jwt_token(
Raises:
AssertionError: If the request fails or the response status code is not 200.
"""
url = "https://supabase-kong.uds.dev/auth/v1/token?grant_type=password"

url = f"{supabase_base_url}/token?grant_type=password"
headers = {"apikey": f"{api_key}", "Content-Type": "application/json"}
data = {"email": test_email, "password": test_password}

Expand All @@ -102,7 +116,15 @@ def get_leapfrogai_model() -> str:
str: The model to use for LeapfrogAI. (default: "vllm")
"""

return os.getenv("LEAPFROGAI_MODEL", "vllm")
model = os.getenv("LEAPFROGAI_MODEL")

if model is None:
model = "vllm"
logging.warning(
f"LEAPFROGAI_MODEL is not set, using default model of `{model}`"
)

return model


def get_openai_key() -> str:
Expand Down

0 comments on commit 0b291f4

Please sign in to comment.