Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -37,18 +37,8 @@ if "chat_history" not in st.session_state:
|
|
37 |
st.session_state["chat_history"] = []
|
38 |
|
39 |
|
40 |
-
def create_sources_string(source_urls: Set[str]) -> str:
|
41 |
-
if not source_urls:
|
42 |
-
return ""
|
43 |
-
sources_list = list(source_urls)
|
44 |
-
sources_list.sort()
|
45 |
-
sources_string = "sources:\n"
|
46 |
-
for i, source in enumerate(sources_list):
|
47 |
-
sources_string += f"{i+1}. {source}\n"
|
48 |
-
return sources_string
|
49 |
|
50 |
-
|
51 |
-
prompt = st.text_input("Prompt", placeholder="Enter your question here (eg. Who is Anuj Mahajan, What is his work experience ?)...")
|
52 |
|
53 |
|
54 |
if prompt:
|
@@ -56,11 +46,9 @@ if prompt:
|
|
56 |
generated_response = run_llm(
|
57 |
query=prompt, chat_history=st.session_state["chat_history"]
|
58 |
)
|
59 |
-
|
60 |
-
[doc.metadata["source"] for doc in generated_response["source_documents"]]
|
61 |
-
)
|
62 |
formatted_response = (
|
63 |
-
f"{generated_response['answer']}
|
64 |
)
|
65 |
|
66 |
st.session_state.user_prompt_history.append(prompt)
|
|
|
37 |
st.session_state["chat_history"] = []
|
38 |
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
+
prompt = st.text_input("Prompt", placeholder="Enter your question with my name for the first prompt (eg. Who is Anuj Mahajan ?, What is his work experience ?)...")
|
|
|
42 |
|
43 |
|
44 |
if prompt:
|
|
|
46 |
generated_response = run_llm(
|
47 |
query=prompt, chat_history=st.session_state["chat_history"]
|
48 |
)
|
49 |
+
|
|
|
|
|
50 |
formatted_response = (
|
51 |
+
f"{generated_response['answer']}"
|
52 |
)
|
53 |
|
54 |
st.session_state.user_prompt_history.append(prompt)
|