Set your Instant Pot to the 'Sauté' function. Add the olive oil and let it heat up. Add the chopped onion, carrots, and celery. Sauté for about 5-7 minutes, stirring occasionally, until the vegetables begin to soften.
Add the minced garlic and cook for another minute until fragrant. If using chicken, add it now and sauté until lightly browned on all sides.
Pour in the chicken or vegetable broth and scrape the bottom of the pot to release any browned bits. Add the diced tomatoes (with their juice), dried thyme, and dried rosemary. Season with salt and pepper.
Secure the lid on the Instant Pot and set the valve to 'Sealing'. Select the 'Manual' or 'Pressure Cook' setting and set the timer for 8 minutes on high pressure.
Once the cooking cycle is complete, allow for a natural pressure release (NPR) for at least 10 minutes. After 10 minutes, carefully perform a quick release (QR) for any remaining pressure.
Open the lid. If you're adding pasta or rice, stir it in now. Close the lid and select the 'Sauté' function again. Cook, stirring occasionally, until the pasta or rice is tender (about 5-10 minutes, depending on the type).
Taste and adjust seasoning if necessary. Stir in fresh parsley just before serving.