Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,10 +16,13 @@ os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
|
| 16 |
#OPENAI_API_KEY = ""
|
| 17 |
OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY", "")
|
| 18 |
OPENAI_TEMP = 0
|
|
|
|
| 19 |
PINECONE_KEY = os.environ["PINECONE_KEY"]
|
| 20 |
PINECONE_ENV = "asia-northeast1-gcp"
|
| 21 |
PINECONE_INDEX = "3gpp"
|
| 22 |
|
|
|
|
|
|
|
| 23 |
# return top-k text chunk from vector store
|
| 24 |
VECTOR_SEARCH_TOP_K = 10
|
| 25 |
|
|
@@ -57,7 +60,7 @@ def init_model(api_key):
|
|
| 57 |
try:
|
| 58 |
if api_key and api_key.startswith("sk-") and len(api_key) > 50:
|
| 59 |
|
| 60 |
-
embeddings = HuggingFaceEmbeddings(model_name=
|
| 61 |
|
| 62 |
pinecone.init(api_key = PINECONE_KEY,
|
| 63 |
environment = PINECONE_ENV)
|
|
|
|
| 16 |
#OPENAI_API_KEY = ""
|
| 17 |
OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY", "")
|
| 18 |
OPENAI_TEMP = 0
|
| 19 |
+
|
| 20 |
PINECONE_KEY = os.environ["PINECONE_KEY"]
|
| 21 |
PINECONE_ENV = "asia-northeast1-gcp"
|
| 22 |
PINECONE_INDEX = "3gpp"
|
| 23 |
|
| 24 |
+
EMBEDDING_MODEL = "sentence-transformers/all-mpnet-base-v2"
|
| 25 |
+
|
| 26 |
# return top-k text chunk from vector store
|
| 27 |
VECTOR_SEARCH_TOP_K = 10
|
| 28 |
|
|
|
|
| 60 |
try:
|
| 61 |
if api_key and api_key.startswith("sk-") and len(api_key) > 50:
|
| 62 |
|
| 63 |
+
embeddings = HuggingFaceEmbeddings(model_name=EMBEDDING_MODEL)
|
| 64 |
|
| 65 |
pinecone.init(api_key = PINECONE_KEY,
|
| 66 |
environment = PINECONE_ENV)
|