Skip to content

Commit

Permalink
Merge pull request #35 from TheDataGuild/fix/reference-section-format
Browse files Browse the repository at this point in the history
Fix/reference section format
  • Loading branch information
Quantisan authored Sep 26, 2023
2 parents 989c0a6 + 22d0ba8 commit 3406f72
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions mind_palace/app.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import streamlit as st

import openai

import extract
import index
import openai
import streamlit as st
from llama_index.query_engine import CitationQueryEngine


openai.api_key = st.secrets.openai_key
xml_dir = "./resources/xmls/12-pdfs-from-steve-aug-22/"

Expand Down Expand Up @@ -55,8 +52,9 @@ def load_index(model):
message = {"role": "assistant", "content": response.response}
st.session_state.messages.append(message) # Add response to message history

for i, source_node in enumerate(response.source_nodes):
st.write(f"[{i+1}]")
st.write(f"id: {source_node.node.node_id}")
st.write(f"score: {source_node.score}")
st.write(f"text: {source_node.node.get_text().split(':', 1)[1]}")
st.markdown("### Sources")
for i, source_node in enumerate(response.source_nodes):
with st.expander(f"[{i + 1}] {source_node.node.node_id}"):
st.write(f"relevancy score: {source_node.score}")
st.write("original text:")
st.write(source_node.node.get_text().split(":", 1)[1])

0 comments on commit 3406f72

Please sign in to comment.