DeepVen commited on
Commit
63aedd5
·
1 Parent(s): a9e095f

Update LLMInsights.py

Browse files
Files changed (1) hide show
  1. LLMInsights.py +13 -4
LLMInsights.py CHANGED
@@ -401,10 +401,19 @@ with tab1:
401
  st.text_area(label=" ", value=hallucination_score, height=30)
402
  st.markdown('<h1 style="color:#100170;font-size:24px;">context</h1>', unsafe_allow_html=True)
403
  st.text_area(label="", value=context)
404
- descriptions = [doc.metadata.get('description', '') for doc in response["source_documents"]]
405
- descriptions_text = '\n'.join(descriptions)
406
- st.markdown('<h1 style="color:#100170;font-size:24px;">Augmented Knowledge Descriptions</h1>', unsafe_allow_html=True)
407
- st.text_area(label="", value=descriptions_text, height=400)
 
 
 
 
 
 
 
 
 
408
 
409
 
410
 
 
401
  st.text_area(label=" ", value=hallucination_score, height=30)
402
  st.markdown('<h1 style="color:#100170;font-size:24px;">context</h1>', unsafe_allow_html=True)
403
  st.text_area(label="", value=context)
404
+ metadata_list = [doc.metadata for doc in response["source_documents"]]
405
+ formatted_metadata_list = []
406
+ for i, metadata in enumerate(metadata_list, start=1):
407
+ formatted_metadata = f"Data {i}:\n"
408
+ formatted_metadata += f"Source: {metadata.get('source', '')}\n"
409
+ formatted_metadata += f"Title: {metadata.get('title', '')}\n"
410
+ formatted_metadata += f"Description: {metadata.get('description', '')}\n\n"
411
+ formatted_metadata_list.append(formatted_metadata)
412
+
413
+ metadata_text = '\n'.join(formatted_metadata_list)
414
+
415
+ st.markdown('<h1 style="color:#100170;font-size:24px;">Augmented Knowledge Metadata</h1>', unsafe_allow_html=True)
416
+ st.text_area(label="", value=metadata_text, height=400)
417
 
418
 
419