In a large pot, heat the olive oil over medium heat. Add the chopped onion and minced garlic, and sauté until the onion becomes translucent, about 3-5 minutes.
Add the uncooked jasmine rice to the pot, stirring to coat it in the olive oil and onions. Toast the rice for about 2 minutes.
Pour in the chicken or vegetable broth and bring to a boil. Once boiling, reduce the heat to low and let it simmer for about 15-20 minutes, or until the rice is fully cooked.
In a separate bowl, whisk together the eggs and lemon juice until well combined.
Once the rice is cooked, remove the pot from heat. Slowly ladle a small amount of the hot broth into the egg-lemon mixture while whisking continuously to temper the eggs.
Gradually transfer the tempered egg mixture back into the soup, stirring constantly to create a smooth and creamy texture.
If using, add the shredded chicken to the soup. Season with salt and pepper to taste.
Return the pot to low heat for a few minutes, but do not let it boil.