Shrimp are extremely fragile; they need specific parameters and conditions to thrive; even .25 ppm Ammonia can kill them. And the stress of living in such close proximity to a predator certainly can.
Can you keep shrimp with Bettas in such a small tank? Of course. "Should" you? No. If you've ever seen an invert-only tank you'd understand why.
In my invert-only tank all the shrimp and Crays are out and about 24/7 and only hide when they molt. They even come to the front of the tank when I lift the lid in anticipation of food and their colors are even more vibrant. The tank is much more enjoyable for them and for me. When I had them in the 20 long, despite its heavy planting, they spent more time hiding in the back cover. The difference in their behavior is amazing.
In the end we all have to do what we're comfortable doing. For me that means I'm no longer comfortable putting inverts in with a Betta any more than I'd be comfortable subjecting a Betta to life with an Oscar five times its size .... and many of us have seen that video.
I will add I have Hester and Larry, two Vampire Shrimp, in my 20 long community tank with a Betta; they're the only invert I've found whose behavior doesn't change when other fish are present. However, I'd not have them in a smaller tank with a Betta and they require a really mature tank as they are filter feeders.
If you want inverts, nothing is more interesting than an invert tank. Even in a 2.5 you can have one or two Amano, 10 RCS, three Dwarf Crays and five or six Thai Micro Crabs. Too much fun. I had my Malawa in a 2.5 until I upgraded to a larger tank. When they swim the shrimp remind me of ET being bicycled toward the moon.