Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import streamlit as st
|
|
7 |
from llama_index.core import Settings
|
8 |
from llama_index.llms.cerebras import Cerebras
|
9 |
from llama_index.core import PromptTemplate
|
10 |
-
from llama_index.embeddings.
|
11 |
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
|
12 |
from llama_index.readers.docling import DoclingReader
|
13 |
from llama_index.core.node_parser import MarkdownNodeParser
|
@@ -68,9 +68,12 @@ with st.sidebar:
|
|
68 |
|
69 |
docs = loader.load_data()
|
70 |
|
71 |
-
#
|
72 |
llm = load_llm()
|
73 |
-
|
|
|
|
|
|
|
74 |
# Creating an index over loaded data
|
75 |
Settings.embed_model = embed_model
|
76 |
node_parser = MarkdownNodeParser()
|
@@ -111,7 +114,7 @@ with st.sidebar:
|
|
111 |
col1, col2 = st.columns([6, 1])
|
112 |
|
113 |
with col1:
|
114 |
-
st.header(f"RAG over Excel using Dockling 🐥 &
|
115 |
|
116 |
with col2:
|
117 |
st.button("Clear ↺", on_click=reset_chat)
|
@@ -145,10 +148,7 @@ if prompt := st.chat_input("What's up?"):
|
|
145 |
full_response += chunk
|
146 |
message_placeholder.markdown(full_response + "▌")
|
147 |
|
148 |
-
# full_response = query_engine.query(prompt)
|
149 |
-
|
150 |
message_placeholder.markdown(full_response)
|
151 |
-
# st.session_state.context = ctx
|
152 |
|
153 |
# Add assistant response to chat history
|
154 |
-
st.session_state.messages.append({"role": "assistant", "content": full_response})
|
|
|
7 |
from llama_index.core import Settings
|
8 |
from llama_index.llms.cerebras import Cerebras
|
9 |
from llama_index.core import PromptTemplate
|
10 |
+
from llama_index.embeddings.mixedbreadai import MixedbreadAIEmbedding, EncodingFormat
|
11 |
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
|
12 |
from llama_index.readers.docling import DoclingReader
|
13 |
from llama_index.core.node_parser import MarkdownNodeParser
|
|
|
68 |
|
69 |
docs = loader.load_data()
|
70 |
|
71 |
+
# Setup llm & embedding model
|
72 |
llm = load_llm()
|
73 |
+
# Use Mixedbread AI Embedding instead of HuggingFaceEmbedding
|
74 |
+
mixedbread_api_key = os.getenv("MXBAI_API_KEY")
|
75 |
+
embed_model = MixedbreadAIEmbedding(api_key=mixedbread_api_key, model_name="mixedbread-ai/mxbai-embed-large-v1")
|
76 |
+
|
77 |
# Creating an index over loaded data
|
78 |
Settings.embed_model = embed_model
|
79 |
node_parser = MarkdownNodeParser()
|
|
|
114 |
col1, col2 = st.columns([6, 1])
|
115 |
|
116 |
with col1:
|
117 |
+
st.header(f"RAG over Excel using Dockling 🐥 & Llama-3.3 70B")
|
118 |
|
119 |
with col2:
|
120 |
st.button("Clear ↺", on_click=reset_chat)
|
|
|
148 |
full_response += chunk
|
149 |
message_placeholder.markdown(full_response + "▌")
|
150 |
|
|
|
|
|
151 |
message_placeholder.markdown(full_response)
|
|
|
152 |
|
153 |
# Add assistant response to chat history
|
154 |
+
st.session_state.messages.append({"role": "assistant", "content": full_response})
|