If you look at the upper middle of the screen when forging, you'll see the percentages you get for every quality type you can reach. Generally speaking, if you have the purple versions of the necessary materials you have a decent chance of getting a purple out of the forging, but there is no way to guarantee it before you have access to the next quality tier at the end of the vanilla missions, which will pretty much invalidate every single item from the previous qualities, including purples.
There are white, yellow, blue and purple versions of each forging material, a batch of which can be upgraded to a single item of the next, higher tier (can't remember the conversion rate). While forging, the game will automatically pick the most rare material quality you have available and the used materials determine the rarity rates for the finished product. There are also 5 booster items you can hand to the smith to increase the chances for better items. Two of them are direct rewards for side quests for the smith, the other three are hidden in certain chests in certain side missions (you have to either stumble into these or look up their locations from some guides).