Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,7 @@ def chunk_text(text, tokenizer, chunk_size=150, chunk_overlap=30):
|
|
46 |
return chunks
|
47 |
|
48 |
def retrieve_chunks(question, index, embed_model, text_chunks, k=3):
|
49 |
-
question_embedding =
|
50 |
D, I = index.search(np.array([question_embedding]), k)
|
51 |
relevant_chunks = [text_chunks[i] for i in I[0]]
|
52 |
return relevant_chunks
|
@@ -135,7 +135,9 @@ def setup_knowledge_base():
|
|
135 |
# --- Monitor All Conversations ---
|
136 |
def start_conversation_monitor(client, index, embed_model, text_chunks):
|
137 |
last_msg_index = {}
|
138 |
-
|
|
|
|
|
139 |
def poll_conversation(convo_sid):
|
140 |
while True:
|
141 |
try:
|
|
|
46 |
return chunks
|
47 |
|
48 |
def retrieve_chunks(question, index, embed_model, text_chunks, k=3):
|
49 |
+
question_embedding = embed_model.encode(question)
|
50 |
D, I = index.search(np.array([question_embedding]), k)
|
51 |
relevant_chunks = [text_chunks[i] for i in I[0]]
|
52 |
return relevant_chunks
|
|
|
135 |
# --- Monitor All Conversations ---
|
136 |
def start_conversation_monitor(client, index, embed_model, text_chunks):
|
137 |
last_msg_index = {}
|
138 |
+
|
139 |
+
print(embed_model)
|
140 |
+
|
141 |
def poll_conversation(convo_sid):
|
142 |
while True:
|
143 |
try:
|