Hi,
An A1c of 5.0 is reasonable for a person with diabetes (considering non-diabetic levels are typical in the mid-4s). Great work!
How was your diet and hba1c prior to adopting the diet and taking medication.
Hba1c of 5.0 correlates to an average blood sugar of about 100. A non diabetic average blood sugar will be in the 80s. Thus while you are doing well, yours levels are still slightly higher than optimal.
Most likely the result of 5.0 is due to both diet and the metformin.
Metformin is a safe drug. Suggest that you continue with both the drug and your diet, and continue to monitor hba1c.
You can also use a home blood glucose meter to help you determine what foods work best for you and don't raise your blood sugars.
If you have a diabetic specialist ask them. If not, you should engage one. There are CRNP's that have taken on this specialty. It's important to have a medical relationship with your health care professional either doctor or nurse.