Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -99,8 +99,8 @@ print("Pinecone Vector/Embedding DB Ready.")
|
|
99 |
|
100 |
index_name_extracted=pinecone.list_indexes()
|
101 |
print(index_name_extracted)
|
102 |
-
index_current = pinecone.Index(index_name=
|
103 |
-
index_status=index_current.describe_index_stats(
|
104 |
print(index_status)
|
105 |
print(namespace)
|
106 |
|
@@ -131,8 +131,12 @@ chain = load_qa_chain(llm=llm, chain_type="stuff", prompt=PROMPT)
|
|
131 |
def run_chain(user_query):
|
132 |
pinecone.init(api_key=PINECONE_API_KEY, environment=PINECONE_ENVIRONMENT)
|
133 |
index_name_extracted=pinecone.list_indexes()
|
134 |
-
index_current = pinecone.Index(index_name=
|
135 |
-
index_status=index_current.describe_index_stats(
|
|
|
|
|
|
|
|
|
136 |
if user_query !="" and not user_query.strip().isspace() and not user_query.isspace():
|
137 |
print("Your query:\n"+user_query)
|
138 |
vector_db_from_index = Pinecone.from_existing_index(index_name, hf_embeddings, namespace=namespace)
|
@@ -142,10 +146,11 @@ def run_chain(user_query):
|
|
142 |
temp_ai_response = initial_ai_response.partition('<|end|>')[0]
|
143 |
final_ai_response = temp_ai_response.replace('\n', '')
|
144 |
print(final_ai_response)
|
|
|
145 |
print(index_name_extracted)
|
146 |
print(index_status)
|
147 |
print(namespace)
|
148 |
-
print("
|
149 |
return final_ai_response
|
150 |
else:
|
151 |
print("Invalid inputs.")
|
|
|
99 |
|
100 |
index_name_extracted=pinecone.list_indexes()
|
101 |
print(index_name_extracted)
|
102 |
+
index_current = pinecone.Index(index_name=index_name)
|
103 |
+
index_status=index_current.describe_index_stats()
|
104 |
print(index_status)
|
105 |
print(namespace)
|
106 |
|
|
|
131 |
def run_chain(user_query):
|
132 |
pinecone.init(api_key=PINECONE_API_KEY, environment=PINECONE_ENVIRONMENT)
|
133 |
index_name_extracted=pinecone.list_indexes()
|
134 |
+
index_current = pinecone.Index(index_name=index_name)
|
135 |
+
index_status=index_current.describe_index_stats()
|
136 |
+
print("***********************************")
|
137 |
+
print(index_name_extracted)
|
138 |
+
print(index_status)
|
139 |
+
print(namespace)
|
140 |
if user_query !="" and not user_query.strip().isspace() and not user_query.isspace():
|
141 |
print("Your query:\n"+user_query)
|
142 |
vector_db_from_index = Pinecone.from_existing_index(index_name, hf_embeddings, namespace=namespace)
|
|
|
146 |
temp_ai_response = initial_ai_response.partition('<|end|>')[0]
|
147 |
final_ai_response = temp_ai_response.replace('\n', '')
|
148 |
print(final_ai_response)
|
149 |
+
print("***********************************")
|
150 |
print(index_name_extracted)
|
151 |
print(index_status)
|
152 |
print(namespace)
|
153 |
+
print("***********************************")
|
154 |
return final_ai_response
|
155 |
else:
|
156 |
print("Invalid inputs.")
|