rchrdgwr commited on
Commit
0bf285c
·
1 Parent(s): 4ab5918

added sources

Browse files
Files changed (2) hide show
  1. app.py +13 -5
  2. chainlit.md +7 -0
app.py CHANGED
@@ -100,16 +100,24 @@ async def main(message):
100
  # Send the response back to the user
101
  # await msg.send()
102
 
103
- # context_documents = response["context"]
104
  # num_contexts = len(context_documents)
105
  # context_msg = f"Number of found context: {num_contexts}"
106
 
107
 
108
  # await cl.Message(content=context_msg).send()
109
-
110
- # for doc in context_documents:
111
- # document_title = doc.metadata.get("source", "Unknown Document")
112
- # chunk_number = doc.metadata.get("chunk_number", "Unknown Chunk")
 
 
 
 
 
 
 
 
113
 
114
  # document_context = doc.page_content.strip()
115
  # truncated_context = document_context[:MAX_PREVIEW_LENGTH] + ("..." if len(document_context) > MAX_PREVIEW_LENGTH else "")
 
100
  # Send the response back to the user
101
  # await msg.send()
102
 
103
+ context_documents = response["context"]
104
  # num_contexts = len(context_documents)
105
  # context_msg = f"Number of found context: {num_contexts}"
106
 
107
 
108
  # await cl.Message(content=context_msg).send()
109
+ chunk_str = "Sources: "
110
+ for doc in context_documents:
111
+ document_title = doc.metadata.get("source", "Unknown Document")
112
+ chunk_number = doc.metadata.get("chunk_id", "Unknown Chunk")
113
+ chunk_string = chunk_string + " " + chunk_number
114
+
115
+ await cl.Message(
116
+ content=f"**{document_title} ( Chunk: {chunk_number})**",
117
+ elements=[
118
+ cl.Text(content=chunk_string, display="inline")
119
+ ]
120
+ ).send()
121
 
122
  # document_context = doc.page_content.strip()
123
  # truncated_context = document_context[:MAX_PREVIEW_LENGTH] + ("..." if len(document_context) > MAX_PREVIEW_LENGTH else "")
chainlit.md CHANGED
@@ -6,3 +6,10 @@ AI Mentor has been trained to answer questions on 2 documents:
6
  * Blueprint for an AI Bill of Rights: Making Automated Systems Work for the American People
7
  * National Institute of Standards and Technology (NIST) Artificial Intelligent Risk Management Framework
8
 
 
 
 
 
 
 
 
 
6
  * Blueprint for an AI Bill of Rights: Making Automated Systems Work for the American People
7
  * National Institute of Standards and Technology (NIST) Artificial Intelligent Risk Management Framework
8
 
9
+ The following technology stack was used:
10
+ * Chainlit - application
11
+ * Langchain
12
+ * Qdrant - vector store
13
+ * Fine tuned Snowflake embedding model
14
+ * Ragas - evaluating the models and the chunking strategy
15
+ * Hugging Face - application and fine tuned model hosting