Spaces:
Running
Running
ryanrwatkins
commited on
Commit
•
0054da1
1
Parent(s):
29bc228
Update app.py
Browse files
app.py
CHANGED
@@ -160,11 +160,15 @@ def select_embeddings_model(LLM_service="HuggingFace"):
|
|
160 |
model='text-embedding-ada-002',
|
161 |
api_key=openai_api_key)
|
162 |
"""
|
|
|
|
|
163 |
if LLM_service == "Google":
|
164 |
embeddings = GoogleGenerativeAIEmbeddings(
|
165 |
model="models/embedding-001",
|
166 |
google_api_key=google_api_key,
|
167 |
)
|
|
|
|
|
168 |
if LLM_service == "HuggingFace":
|
169 |
embeddings = HuggingFaceInferenceAPIEmbeddings(
|
170 |
api_key=HF_key,
|
@@ -174,7 +178,7 @@ def select_embeddings_model(LLM_service="HuggingFace"):
|
|
174 |
return embeddings
|
175 |
|
176 |
#embeddings_OpenAI = select_embeddings_model(LLM_service="OpenAI")
|
177 |
-
embeddings_google = select_embeddings_model(LLM_service="Google")
|
178 |
embeddings_HuggingFace = select_embeddings_model(LLM_service="HuggingFace")
|
179 |
|
180 |
|
@@ -204,13 +208,14 @@ if create_vectorstores:
|
|
204 |
)
|
205 |
print("vector_store_OpenAI:",vector_store_OpenAI._collection.count(),"chunks.")
|
206 |
"""
|
|
|
207 |
vector_store_google,new_vectorstore_name = create_vectorstore(
|
208 |
embeddings=embeddings_google,
|
209 |
documents = chunks,
|
210 |
vectorstore_name="Vit_All_Google_Embeddings"
|
211 |
)
|
212 |
print("vector_store_google:",vector_store_google._collection.count(),"chunks.")
|
213 |
-
|
214 |
|
215 |
vector_store_HF = create_vectorstore(
|
216 |
embeddings=embeddings_HuggingFace,
|
@@ -225,12 +230,14 @@ vector_store_OpenAI = Chroma(
|
|
225 |
persist_directory = LOCAL_VECTOR_STORE_DIR.as_posix() + "/Vit_All_OpenAI_Embeddings",
|
226 |
embedding_function=embeddings_OpenAI)
|
227 |
print("vector_store_OpenAI:",vector_store_OpenAI._collection.count(),"chunks.")
|
|
|
|
|
228 |
"""
|
229 |
vector_store_google = Chroma(
|
230 |
persist_directory = current_dir + "/Vit_All_Google_Embeddings",
|
231 |
embedding_function=embeddings_google)
|
232 |
print("vector_store_google:",vector_store_google._collection.count(),"chunks.")
|
233 |
-
|
234 |
|
235 |
vector_store_HF = Chroma(
|
236 |
persist_directory = current_dir + "/Vit_All_HF_Embeddings",
|
|
|
160 |
model='text-embedding-ada-002',
|
161 |
api_key=openai_api_key)
|
162 |
"""
|
163 |
+
|
164 |
+
"""
|
165 |
if LLM_service == "Google":
|
166 |
embeddings = GoogleGenerativeAIEmbeddings(
|
167 |
model="models/embedding-001",
|
168 |
google_api_key=google_api_key,
|
169 |
)
|
170 |
+
"""
|
171 |
+
|
172 |
if LLM_service == "HuggingFace":
|
173 |
embeddings = HuggingFaceInferenceAPIEmbeddings(
|
174 |
api_key=HF_key,
|
|
|
178 |
return embeddings
|
179 |
|
180 |
#embeddings_OpenAI = select_embeddings_model(LLM_service="OpenAI")
|
181 |
+
#embeddings_google = select_embeddings_model(LLM_service="Google")
|
182 |
embeddings_HuggingFace = select_embeddings_model(LLM_service="HuggingFace")
|
183 |
|
184 |
|
|
|
208 |
)
|
209 |
print("vector_store_OpenAI:",vector_store_OpenAI._collection.count(),"chunks.")
|
210 |
"""
|
211 |
+
"""
|
212 |
vector_store_google,new_vectorstore_name = create_vectorstore(
|
213 |
embeddings=embeddings_google,
|
214 |
documents = chunks,
|
215 |
vectorstore_name="Vit_All_Google_Embeddings"
|
216 |
)
|
217 |
print("vector_store_google:",vector_store_google._collection.count(),"chunks.")
|
218 |
+
"""
|
219 |
|
220 |
vector_store_HF = create_vectorstore(
|
221 |
embeddings=embeddings_HuggingFace,
|
|
|
230 |
persist_directory = LOCAL_VECTOR_STORE_DIR.as_posix() + "/Vit_All_OpenAI_Embeddings",
|
231 |
embedding_function=embeddings_OpenAI)
|
232 |
print("vector_store_OpenAI:",vector_store_OpenAI._collection.count(),"chunks.")
|
233 |
+
"""
|
234 |
+
|
235 |
"""
|
236 |
vector_store_google = Chroma(
|
237 |
persist_directory = current_dir + "/Vit_All_Google_Embeddings",
|
238 |
embedding_function=embeddings_google)
|
239 |
print("vector_store_google:",vector_store_google._collection.count(),"chunks.")
|
240 |
+
"""
|
241 |
|
242 |
vector_store_HF = Chroma(
|
243 |
persist_directory = current_dir + "/Vit_All_HF_Embeddings",
|