Skip to content

Commit

Permalink
fix: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
viveknair committed Apr 25, 2023
1 parent 6429350 commit 82fcabf
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions package/gentrace/providers/getters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import re
from urllib.parse import urlparse

import openai

Expand All @@ -12,13 +11,22 @@
VALID_GENTRACE_HOST = r"^https?://[\w.-]+:\d{1,5}/api/v1/?$"


def test_validity():
from gentrace import api_key, host

if not api_key:
raise ValueError("Gentrace API key not set")

if host and not re.match(VALID_GENTRACE_HOST, host):
raise ValueError("Gentrace host is invalid")


def configure_openai():
from gentrace import api_key, host

from .llms.openai import annotate_openai_module

if not api_key:
raise ValueError("Gentrace API key not set")
test_validity()

if host and not re.match(VALID_GENTRACE_HOST, host):
raise ValueError("Gentrace host is invalid")
Expand All @@ -30,12 +38,9 @@ def configure_openai():


def configure_pinecone():
from gentrace import api_key, host

from .vectorstores.pinecone import annotate_pinecone_module

if not api_key:
raise ValueError("Gentrace API key not set")
test_validity()

annotate_pinecone_module()

Expand Down

0 comments on commit 82fcabf

Please sign in to comment.