Spaces:
Paused
Paused
Commit ·
32c790e
1
Parent(s): 09fcba2
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,18 +25,6 @@ print("CHECK - Pinecone vector db setup")
|
|
| 25 |
openai.api_key = os.environ.get("OPENAI_API_KEY")
|
| 26 |
embeddings = OpenAIEmbeddings()
|
| 27 |
|
| 28 |
-
# initialize pinecone db
|
| 29 |
-
index_name = "kellogg-markstrat"
|
| 30 |
-
|
| 31 |
-
pinecone.init(
|
| 32 |
-
api_key=os.getenv("PINECONE_API_KEY"), # find at app.pinecone.io
|
| 33 |
-
environment=os.getenv("PINECONE_ENV"), # next to api key in console
|
| 34 |
-
)
|
| 35 |
-
|
| 36 |
-
# load existing index
|
| 37 |
-
vectorsearch = Pinecone.from_existing_index(index_name, embeddings)
|
| 38 |
-
retriever = vectorsearch.as_retriever()
|
| 39 |
-
|
| 40 |
print("CHECK - setting up conversational retrieval agent")
|
| 41 |
|
| 42 |
# callback handler for streaming
|
|
@@ -85,7 +73,19 @@ def predict(message, model_type):
|
|
| 85 |
# Create a Queue
|
| 86 |
q = Queue()
|
| 87 |
job_done = object()
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
# conversational retrieval agent component construction - memory, prompt template, agent, agent executor
|
| 90 |
# specifying LLM to use
|
| 91 |
if (model_type==1):
|
|
|
|
| 25 |
openai.api_key = os.environ.get("OPENAI_API_KEY")
|
| 26 |
embeddings = OpenAIEmbeddings()
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
print("CHECK - setting up conversational retrieval agent")
|
| 29 |
|
| 30 |
# callback handler for streaming
|
|
|
|
| 73 |
# Create a Queue
|
| 74 |
q = Queue()
|
| 75 |
job_done = object()
|
| 76 |
+
|
| 77 |
+
# initialize pinecone db
|
| 78 |
+
index_name = "kellogg-markstrat"
|
| 79 |
+
|
| 80 |
+
pinecone.init(
|
| 81 |
+
api_key=os.getenv("PINECONE_API_KEY"), # find at app.pinecone.io
|
| 82 |
+
environment=os.getenv("PINECONE_ENV"), # next to api key in console
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
+
# load existing index
|
| 86 |
+
vectorsearch = Pinecone.from_existing_index(index_name, embeddings)
|
| 87 |
+
retriever = vectorsearch.as_retriever()
|
| 88 |
+
|
| 89 |
# conversational retrieval agent component construction - memory, prompt template, agent, agent executor
|
| 90 |
# specifying LLM to use
|
| 91 |
if (model_type==1):
|