Commit
·
e26c458
1
Parent(s):
4696f8c
Shipgit add .
Browse files- app.py +2 -4
- data/contextual_chunks/A_Method_for_Comparing_the_Fatigue_Performance_of_Forged.pkl +0 -0
- data/contextual_chunks/Characterization_of_forged_magnesium_alloys.pkl +0 -0
- data/contextual_chunks/Microstructure_and_texture_evolution_during_hot_deformation_of_AZ80_magnesium_alloy.pkl +0 -0
- vectorstore.py +2 -11
app.py
CHANGED
@@ -56,10 +56,8 @@ rag_prompt = ChatPromptTemplate.from_template("""\
|
|
56 |
vectorstore = VectorStore(
|
57 |
collection_name="mg_alloy_collection_snowflake",
|
58 |
)
|
59 |
-
|
60 |
-
|
61 |
-
vectorstore.add_documents(documents)
|
62 |
-
|
63 |
retriever = vectorstore.as_retriever(k=5)
|
64 |
|
65 |
# ------- Pydantic Models ------- #
|
|
|
56 |
vectorstore = VectorStore(
|
57 |
collection_name="mg_alloy_collection_snowflake",
|
58 |
)
|
59 |
+
documents = VectorStore.load_chunks_as_documents("data/contextual_chunks")
|
60 |
+
vectorstore.add_documents(documents)
|
|
|
|
|
61 |
retriever = vectorstore.as_retriever(k=5)
|
62 |
|
63 |
# ------- Pydantic Models ------- #
|
data/contextual_chunks/A_Method_for_Comparing_the_Fatigue_Performance_of_Forged.pkl
DELETED
Binary file (72.4 kB)
|
|
data/contextual_chunks/Characterization_of_forged_magnesium_alloys.pkl
DELETED
Binary file (185 kB)
|
|
data/contextual_chunks/Microstructure_and_texture_evolution_during_hot_deformation_of_AZ80_magnesium_alloy.pkl
DELETED
Binary file (462 kB)
|
|
vectorstore.py
CHANGED
@@ -31,17 +31,8 @@ SPARSE_EMBEDDINGS = FastEmbedSparse(model_name="Qdrant/BM25")
|
|
31 |
class VectorStore:
|
32 |
def __init__(self, collection_name="testCollection"):
|
33 |
|
34 |
-
|
35 |
-
self.
|
36 |
-
self.collections_path= "data/collections"
|
37 |
-
try:
|
38 |
-
lock_file = os.path.join(self.collections_path, ".lock")
|
39 |
-
if os.path.exists(lock_file):
|
40 |
-
os.remove(lock_file)
|
41 |
-
except:
|
42 |
-
pass
|
43 |
-
|
44 |
-
self.client = QdrantClient(path=self.collections_path)
|
45 |
|
46 |
# create the collection if it doesn't exist
|
47 |
if not self.client.collection_exists(collection_name):
|
|
|
31 |
class VectorStore:
|
32 |
def __init__(self, collection_name="testCollection"):
|
33 |
|
34 |
+
|
35 |
+
self.client = QdrantClient(":memory:")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
# create the collection if it doesn't exist
|
38 |
if not self.client.collection_exists(collection_name):
|