Nina
commited on
Commit
•
60ffe88
1
Parent(s):
fa7f0c5
correcting default api key and secret manager
Browse files
app.py
CHANGED
@@ -14,6 +14,9 @@ document_store = FAISSDocumentStore.load(
|
|
14 |
|
15 |
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
16 |
system_template = {"role": os.environ["role"], "content": os.environ["content"]}
|
|
|
|
|
|
|
17 |
|
18 |
dense = EmbeddingRetriever(
|
19 |
document_store=document_store,
|
@@ -80,10 +83,10 @@ def set_openai_api_key(text):
|
|
80 |
"""Set the api key and return chain.
|
81 |
If no api_key, then None is returned.
|
82 |
"""
|
83 |
-
if text
|
84 |
openai.api_key = text
|
85 |
else:
|
86 |
-
openai.api_key =
|
87 |
return f"You're all set: this is your api key: {openai.api_key}"
|
88 |
|
89 |
|
|
|
14 |
|
15 |
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
16 |
system_template = {"role": os.environ["role"], "content": os.environ["content"]}
|
17 |
+
api_key_default = os.environ["api_key"]
|
18 |
+
openai.api_key = api_key_default
|
19 |
+
|
20 |
|
21 |
dense = EmbeddingRetriever(
|
22 |
document_store=document_store,
|
|
|
83 |
"""Set the api key and return chain.
|
84 |
If no api_key, then None is returned.
|
85 |
"""
|
86 |
+
if text.startswith("sk-") and len(text) > 10:
|
87 |
openai.api_key = text
|
88 |
else:
|
89 |
+
openai.api_key = api_key_default
|
90 |
return f"You're all set: this is your api key: {openai.api_key}"
|
91 |
|
92 |
|