Implementing Streaming algorithm and k-means clusters to RAG