You need to split content into chunk but also need to retain semantic meaning. I have been building same thing: https://chatfast.io. This also support scanned pdf and image. (I built my own algorithm, backend in c# not using llama_index or langchain)