anurag-s-39 commited on
Commit
628fc9c
·
verified ·
1 Parent(s): 0a6aec0

Upload folder using huggingface_hub

Browse files
app.py CHANGED
@@ -34,18 +34,10 @@ for message in st.session_state.messages:
34
 
35
  if prompt := st.chat_input("Disclaimer: I am still a product in developement"):
36
  app = conversational_ai()
37
- # if prompt.startswith("/add"):
38
- # with st.chat_message("user"):
39
- # st.markdown(prompt)
40
- # st.session_state.messages.append({"role": "user", "content": prompt})
41
- # prompt = prompt.replace("/add", "").strip()
42
- # with st.chat_message("assistant"):
43
- # message_placeholder = st.empty()
44
- # message_placeholder.markdown("Adding to knowledge base...")
45
- # app.add(prompt)
46
- # message_placeholder.markdown(f"Added {prompt} to knowledge base!")
47
- # st.session_state.messages.append({"role": "assistant", "content": f"Added {prompt} to knowledge base!"})
48
- # st.stop()
49
 
50
  with st.chat_message("user"):
51
  st.markdown(prompt)
@@ -57,13 +49,19 @@ if prompt := st.chat_input("Disclaimer: I am still a product in developement"):
57
 
58
  print("Querying the Agent.")
59
  cntxt = app.search(prompt)
60
- print(*cntxt, sep="\n=======================\n")
61
- full_response = app.llm.query(
62
- input_query=prompt,
63
- contexts=[i["context"] for i in cntxt if i["metadata"]["score"] <= 0.6],
64
- )
 
 
 
 
 
 
 
65
  # print(f"##FULL:\n\n{full_response}")
66
- full_response = full_response.rpartition("Answer:")[-1].strip()
67
  print(f"#ANSWER\n\n{full_response}")
68
 
69
  msg_placeholder.markdown(full_response)
 
34
 
35
  if prompt := st.chat_input("Disclaimer: I am still a product in developement"):
36
  app = conversational_ai()
37
+ # app.reset()
38
+ # print(len(app.db.get()["metadatas"]))
39
+ # print(len(app.get_data_sources()))
40
+ # quit()
 
 
 
 
 
 
 
 
41
 
42
  with st.chat_message("user"):
43
  st.markdown(prompt)
 
49
 
50
  print("Querying the Agent.")
51
  cntxt = app.search(prompt)
52
+ relevant_c = [i["context"] for i in cntxt if i["metadata"]["score"] <= 0.6]
53
+ print(*relevant_c, sep="\n=======================\n")
54
+ if len(relevant_c) != 0:
55
+ full_response = app.llm.query(
56
+ input_query=prompt,
57
+ contexts=relevant_c,
58
+ )
59
+ full_response = full_response.rpartition("Answer:")[-1].strip()
60
+ else:
61
+ full_response = (
62
+ "Sorry but I don't have relevant knowledge to asnwer that query."
63
+ )
64
  # print(f"##FULL:\n\n{full_response}")
 
65
  print(f"#ANSWER\n\n{full_response}")
66
 
67
  msg_placeholder.markdown(full_response)
db/main/737ff09d-da7b-4fe3-943e-a4f166193732/data_level0.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d8596925d8714b13f0383e0123ae04fcc4be73a193e872efe5ff3ea1eda3121b
3
+ size 25416000
db/main/737ff09d-da7b-4fe3-943e-a4f166193732/header.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3f445a47350fd2d3af747ffa1ff77a48cf0421ff1ad7b9b45f4b12debed708ec
3
+ size 100
db/main/737ff09d-da7b-4fe3-943e-a4f166193732/index_metadata.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f5177e0d9903ab4d2aca56587d447a9da0117a5d11f9899d7b63f54ba874ec35
3
+ size 580092
db/main/737ff09d-da7b-4fe3-943e-a4f166193732/length.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96bb159ed116de922b7b84e5658c92ec7613a536143c98126ad1316cc8970c78
3
+ size 24000
db/main/737ff09d-da7b-4fe3-943e-a4f166193732/link_lists.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3447b632d6e24261228876d42a20f9bdabb46eee5a52f3c9df292ba241deaa5e
3
+ size 50792
db/main/chroma.sqlite3 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:730195b8e7360785c267b979efb70b5339863fc6a115f2b95147596823ea010f
3
- size 70705152
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bd923bab98ca799a896ba787de37366003d0bbdbef4a695fc47156003d5d5fc1
3
+ size 67289088