Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ with st.sidebar:
|
|
36 |
|
37 |
|
38 |
#load embedding models
|
39 |
-
@st.cache_resource
|
40 |
def load_embedding_models(model):
|
41 |
|
42 |
if model == 'Sbert':
|
@@ -56,7 +56,7 @@ def load_embedding_models(model):
|
|
56 |
embeddings = load_embedding_models(book)
|
57 |
|
58 |
##### functionss ####
|
59 |
-
@st.
|
60 |
def load_vectorstore(_embeddings):
|
61 |
# download from hugging face
|
62 |
cache_dir="cfa_level_1_cache"
|
@@ -84,7 +84,7 @@ def load_vectorstore(_embeddings):
|
|
84 |
return vectorstore.as_retriever(search_kwargs={"k": 4})
|
85 |
|
86 |
tool = create_retriever_tool(
|
87 |
-
load_vectorstore(),
|
88 |
"search_cfa_docs",
|
89 |
"Searches and returns documents regarding the CFA level 1 curriculum. CFA is a rigorous program for investment professionals which covers topics such as ethics, corporate finance, economics, fixed income, equities and derivatives markets. You do not know anything about the CFA program, so if you are ever asked about CFA material or curriculum you should use this tool.",
|
90 |
)
|
|
|
36 |
|
37 |
|
38 |
#load embedding models
|
39 |
+
@st.cache_resource
|
40 |
def load_embedding_models(model):
|
41 |
|
42 |
if model == 'Sbert':
|
|
|
56 |
embeddings = load_embedding_models(book)
|
57 |
|
58 |
##### functionss ####
|
59 |
+
@st.cache_data
|
60 |
def load_vectorstore(_embeddings):
|
61 |
# download from hugging face
|
62 |
cache_dir="cfa_level_1_cache"
|
|
|
84 |
return vectorstore.as_retriever(search_kwargs={"k": 4})
|
85 |
|
86 |
tool = create_retriever_tool(
|
87 |
+
load_vectorstore(embeddings),
|
88 |
"search_cfa_docs",
|
89 |
"Searches and returns documents regarding the CFA level 1 curriculum. CFA is a rigorous program for investment professionals which covers topics such as ethics, corporate finance, economics, fixed income, equities and derivatives markets. You do not know anything about the CFA program, so if you are ever asked about CFA material or curriculum you should use this tool.",
|
90 |
)
|