Spaces:
Sleeping
Sleeping
Update rag_engine.py
Browse files- rag_engine.py +7 -5
rag_engine.py
CHANGED
@@ -126,8 +126,10 @@ class RAGEngine:
|
|
126 |
return answer
|
127 |
|
128 |
def stream_answer(self, query):
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
|
|
|
126 |
return answer
|
127 |
|
128 |
def stream_answer(self, query):
|
129 |
+
# Simulate streaming response, yielding chunks of text
|
130 |
+
# (This is just an example of how you'd stream chunks of data)
|
131 |
+
result = self.get_answer(query) # Retrieve the full answer
|
132 |
+
# Here you can yield chunks of the answer instead of returning it all at once.
|
133 |
+
chunk_size = 1000 # Define the chunk size
|
134 |
+
for i in range(0, len(result), chunk_size):
|
135 |
+
yield result[i:i + chunk_size] # Yield parts of the response
|