Spaces:
Runtime error
Runtime error
Aabbhishekk
commited on
Commit
•
621bc57
1
Parent(s):
4149dcc
Update app.py
Browse files
app.py
CHANGED
@@ -25,16 +25,9 @@ hf = HuggingFaceHubEmbeddings(
|
|
25 |
huggingfacehub_api_token= HUGGINGFACEHUB_API_TOKEN,
|
26 |
)
|
27 |
|
28 |
-
EMB_SBERT_MPNET_BASE = "sentence-transformers/all-mpnet-base-v2"
|
29 |
-
config = {"persist_directory":None,
|
30 |
-
"load_in_8bit":False,
|
31 |
-
"embedding" : EMB_SBERT_MPNET_BASE
|
32 |
-
}
|
33 |
|
34 |
|
35 |
-
|
36 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
37 |
-
return HuggingFaceEmbeddings(model_name=EMB_SBERT_MPNET_BASE, model_kwargs={"device": device})
|
38 |
|
39 |
llm = HuggingFaceHub(
|
40 |
repo_id='mistralai/Mistral-7B-Instruct-v0.2',
|
@@ -43,8 +36,7 @@ llm = HuggingFaceHub(
|
|
43 |
|
44 |
)
|
45 |
|
46 |
-
|
47 |
-
embedding = create_sbert_mpnet()
|
48 |
|
49 |
from langchain.text_splitter import CharacterTextSplitter, TokenTextSplitter
|
50 |
from langchain.vectorstores import Chroma
|
@@ -85,17 +77,7 @@ def main():
|
|
85 |
embeddings = hf
|
86 |
knowledge_base = FAISS.from_texts(texts, embeddings)
|
87 |
|
88 |
-
retriever = knowledge_base.as_retriever(search_kwargs={"k":
|
89 |
-
# retriever = FAISS.as_retriever()
|
90 |
-
# persist_directory = config["persist_directory"]
|
91 |
-
# vectordb = Chroma.from_documents(documents=texts, embedding=embedding, persist_directory=persist_directory)
|
92 |
-
|
93 |
-
# retriever = vectordb.as_retriever(search_kwargs={"k":5})
|
94 |
-
|
95 |
-
# mode = st.selectbox(
|
96 |
-
# label="Select agent type",
|
97 |
-
# options=("Agent with AskHuman tool", "Traditional RAG Agent","Search Agent"),
|
98 |
-
# )
|
99 |
|
100 |
|
101 |
|
|
|
25 |
huggingfacehub_api_token= HUGGINGFACEHUB_API_TOKEN,
|
26 |
)
|
27 |
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
|
30 |
+
|
|
|
|
|
31 |
|
32 |
llm = HuggingFaceHub(
|
33 |
repo_id='mistralai/Mistral-7B-Instruct-v0.2',
|
|
|
36 |
|
37 |
)
|
38 |
|
39 |
+
|
|
|
40 |
|
41 |
from langchain.text_splitter import CharacterTextSplitter, TokenTextSplitter
|
42 |
from langchain.vectorstores import Chroma
|
|
|
77 |
embeddings = hf
|
78 |
knowledge_base = FAISS.from_texts(texts, embeddings)
|
79 |
|
80 |
+
retriever = knowledge_base.as_retriever(search_kwargs={"k":3})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
|
83 |
|