Rainbow shark are semi aggressive so they deferentially would pick on the betta and maybe kill him. Usually when getting aggressive or semi aggressive fish you want to stick them together but betta are the exception to that rule, you never want to but them with aggressive and semi aggressive fish.
A 2 1/2 gallon really is a small tank from experience. The only thing you could possibly get away with is a small snail or ghost shrimp. Even with ghost shrimp it's better to have more than one so really even that's not that great of an idea. Even if you got a five gallon that would be better. If your short on space (Like me) there are 5g hex. tanks available.
Well im about to put in 60+ hours of wrk this week so after this week i should be able to pour some money into giving my new friend more adequate space and probably a small family of tetras so hes not alone. going to get fake plants and such too for him. My goal is to breed him eventually