update: add env variables support and secrets management
Browse files- pages/01_Resume Screen.py +1 -1
- pages/02_Professional Screen.py +1 -1
- pages/03_Behavioral Screen.py +1 -1
- pages/05_Search_Candidates.py +22 -14
- utils/llm.py +9 -5
pages/01_Resume Screen.py
CHANGED
@@ -31,7 +31,7 @@ def load_lottiefile(filepath: str):
|
|
31 |
st_lottie(load_lottiefile("images/welcome.json"), speed=1, reverse=False, loop=True, quality="high", height=300)
|
32 |
|
33 |
if "VOYAGE_API_KEY" not in st.session_state:
|
34 |
-
st.session_state = st.text_input("PLEASE ENTER YOUR VOYAGE API KEY. Head over to this [link](https://dash.voyageai.com/)",
|
35 |
placeholder="Enter your Key here...",
|
36 |
type="password")
|
37 |
st.stop()
|
|
|
31 |
st_lottie(load_lottiefile("images/welcome.json"), speed=1, reverse=False, loop=True, quality="high", height=300)
|
32 |
|
33 |
if "VOYAGE_API_KEY" not in st.session_state:
|
34 |
+
st.session_state["VOYAGE_API_KEY"] = st.text_input("PLEASE ENTER YOUR VOYAGE API KEY. Head over to this [link](https://dash.voyageai.com/)",
|
35 |
placeholder="Enter your Key here...",
|
36 |
type="password")
|
37 |
st.stop()
|
pages/02_Professional Screen.py
CHANGED
@@ -30,7 +30,7 @@ def load_lottiefile(filepath: str):
|
|
30 |
st_lottie(load_lottiefile("images/welcome.json"), speed=1, reverse=False, loop=True, quality="high", height=300)
|
31 |
|
32 |
if "VOYAGE_API_KEY" not in st.session_state:
|
33 |
-
st.session_state = st.text_input("PLEASE ENTER YOUR VOYAGE API KEY. Head over to this [link](https://dash.voyageai.com/)",
|
34 |
placeholder="Enter your Key here...",
|
35 |
type="password")
|
36 |
st.stop()
|
|
|
30 |
st_lottie(load_lottiefile("images/welcome.json"), speed=1, reverse=False, loop=True, quality="high", height=300)
|
31 |
|
32 |
if "VOYAGE_API_KEY" not in st.session_state:
|
33 |
+
st.session_state["VOYAGE_API_KEY"] = st.text_input("PLEASE ENTER YOUR VOYAGE API KEY. Head over to this [link](https://dash.voyageai.com/)",
|
34 |
placeholder="Enter your Key here...",
|
35 |
type="password")
|
36 |
st.stop()
|
pages/03_Behavioral Screen.py
CHANGED
@@ -31,7 +31,7 @@ def load_lottiefile(filepath: str):
|
|
31 |
st_lottie(load_lottiefile("images/welcome.json"), speed=1, reverse=False, loop=True, quality="high", height=300)
|
32 |
|
33 |
if "VOYAGE_API_KEY" not in st.session_state:
|
34 |
-
st.session_state = st.text_input("PLEASE ENTER YOUR VOYAGE API KEY. Head over to this [link](https://dash.voyageai.com/)",
|
35 |
placeholder="Enter your Key here...",
|
36 |
type="password")
|
37 |
st.stop()
|
|
|
31 |
st_lottie(load_lottiefile("images/welcome.json"), speed=1, reverse=False, loop=True, quality="high", height=300)
|
32 |
|
33 |
if "VOYAGE_API_KEY" not in st.session_state:
|
34 |
+
st.session_state["VOYAGE_API_KEY"] = st.text_input("PLEASE ENTER YOUR VOYAGE API KEY. Head over to this [link](https://dash.voyageai.com/)",
|
35 |
placeholder="Enter your Key here...",
|
36 |
type="password")
|
37 |
st.stop()
|
pages/05_Search_Candidates.py
CHANGED
@@ -12,19 +12,28 @@ from dotenv import load_dotenv
|
|
12 |
load_dotenv()
|
13 |
|
14 |
st.title("Search the right candidates!")
|
15 |
-
|
16 |
-
if "OPENAI_API_KEY" not in
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
if "messages" not in st.session_state:
|
30 |
st.session_state.messages = []
|
@@ -40,7 +49,6 @@ if query := st.chat_input("Whom are you looking for today?"):
|
|
40 |
st.session_state.messages.append({"role": "user", "content": query})
|
41 |
with st.chat_message("user"):
|
42 |
st.markdown(query)
|
43 |
-
|
44 |
with st.chat_message("assistant"):
|
45 |
message_placeholder = st.empty()
|
46 |
with st.spinner('Pulling out amazing candidates behind the bushes...'):
|
|
|
12 |
load_dotenv()
|
13 |
|
14 |
st.title("Search the right candidates!")
|
15 |
+
# st.write( "OPENAI_API_KEY" not in os.environ.keys())
|
16 |
+
# if "OPENAI_API_KEY" not in os.environ.keys():
|
17 |
+
# os.environ["OPENAI_API_KEY"] = st.text_input(
|
18 |
+
# "PLEASE ENTER YOUR OPEN API KEY. Head over to this [link](https://platform.openai.com/api-keys)",
|
19 |
+
# placeholder="Enter your Key here...",
|
20 |
+
# type="password")
|
21 |
+
# st.write("You can also set the OPENAI_API_KEY environment variable.")
|
22 |
+
# st.rerun()
|
23 |
+
#
|
24 |
+
# if "COHERE_API_KEY" not in os.environ.keys():
|
25 |
+
# os.environ["COHERE_API_KEY"] = st.text_input(
|
26 |
+
# "PLEASE ENTER YOUR COHERE API KEY. Head over to this [link](https://dashboard.cohere.com/welcome/login?redirect_uri=%2F)",
|
27 |
+
# placeholder="Enter your Key here...",
|
28 |
+
# type="password")
|
29 |
+
# st.rerun()
|
30 |
+
#
|
31 |
+
# if "VOYAGE_API_KEY" not in os.environ.keys():
|
32 |
+
# os.environ["VOYAGE_API_KEY"] = st.text_input(
|
33 |
+
# "PLEASE ENTER YOUR VOYAGE API KEY. Head over to this [link](https://dash.voyageai.com/)",
|
34 |
+
# placeholder="Enter your Key here...",
|
35 |
+
# type="password")
|
36 |
+
# st.rerun()
|
37 |
|
38 |
if "messages" not in st.session_state:
|
39 |
st.session_state.messages = []
|
|
|
49 |
st.session_state.messages.append({"role": "user", "content": query})
|
50 |
with st.chat_message("user"):
|
51 |
st.markdown(query)
|
|
|
52 |
with st.chat_message("assistant"):
|
53 |
message_placeholder = st.empty()
|
54 |
with st.spinner('Pulling out amazing candidates behind the bushes...'):
|
utils/llm.py
CHANGED
@@ -12,7 +12,6 @@ from dotenv import load_dotenv
|
|
12 |
from operator import itemgetter
|
13 |
from langchain_core.runnables import RunnableParallel, RunnablePassthrough, RunnableLambda
|
14 |
from langchain.output_parsers import StructuredOutputParser, ResponseSchema
|
15 |
-
|
16 |
load_dotenv()
|
17 |
|
18 |
response_schemas = [
|
@@ -43,8 +42,10 @@ human_message = ("You are provided with a list of resumes. "
|
|
43 |
|
44 |
|
45 |
@st.cache_resource
|
46 |
-
def init_retriever(dataset_path="hub://p1utoze/default",
|
47 |
-
|
|
|
|
|
48 |
db = DeepLake(token=st.secrets["deep_lake_token"], dataset_path=dataset_path, read_only=True, embedding=embeddings)
|
49 |
retriever = db.as_retriever()
|
50 |
retriever.search_kwargs['top_k'] = "5"
|
@@ -58,7 +59,7 @@ def init_retriever(dataset_path="hub://p1utoze/default", embeddings_model="voyag
|
|
58 |
|
59 |
@st.cache_resource
|
60 |
def load_model():
|
61 |
-
chat = ChatOpenAI(
|
62 |
return chat
|
63 |
|
64 |
|
@@ -81,7 +82,10 @@ def typewriter(text: str, title: str, speed: int):
|
|
81 |
time.sleep(1 / speed)
|
82 |
|
83 |
def model_pipeline(memory):
|
84 |
-
compression_retriever = init_retriever(
|
|
|
|
|
|
|
85 |
chat = load_model()
|
86 |
system_message_prompt = SystemMessagePromptTemplate.from_template(system_message)
|
87 |
human_message_prompt = HumanMessagePromptTemplate.from_template(
|
|
|
12 |
from operator import itemgetter
|
13 |
from langchain_core.runnables import RunnableParallel, RunnablePassthrough, RunnableLambda
|
14 |
from langchain.output_parsers import StructuredOutputParser, ResponseSchema
|
|
|
15 |
load_dotenv()
|
16 |
|
17 |
response_schemas = [
|
|
|
42 |
|
43 |
|
44 |
@st.cache_resource
|
45 |
+
def init_retriever(dataset_path="hub://p1utoze/default",
|
46 |
+
embeddings_model="voyage-lite-01",
|
47 |
+
):
|
48 |
+
embeddings = VoyageEmbeddings(model=embeddings_model, show_progress_bar=True)
|
49 |
db = DeepLake(token=st.secrets["deep_lake_token"], dataset_path=dataset_path, read_only=True, embedding=embeddings)
|
50 |
retriever = db.as_retriever()
|
51 |
retriever.search_kwargs['top_k'] = "5"
|
|
|
59 |
|
60 |
@st.cache_resource
|
61 |
def load_model():
|
62 |
+
chat = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0.4)
|
63 |
return chat
|
64 |
|
65 |
|
|
|
82 |
time.sleep(1 / speed)
|
83 |
|
84 |
def model_pipeline(memory):
|
85 |
+
compression_retriever = init_retriever(
|
86 |
+
"hub://p1utoze/resumes",
|
87 |
+
embeddings_model="voyage-lite-01",
|
88 |
+
)
|
89 |
chat = load_model()
|
90 |
system_message_prompt = SystemMessagePromptTemplate.from_template(system_message)
|
91 |
human_message_prompt = HumanMessagePromptTemplate.from_template(
|