The conversation entices an entire song, the bhagavad ghita, it is so elaborate and intricate, how can someone who was not part of that conversation know every word of it exactly as it happened?
Sage Vyasa had the ascetic power due to which he could see/listen everything that transpired in the Mahabharata war zone.
We should not forget that it was Sage Vyasa, who gave the boon to Sanjaya that the latter will narrate every minute detail to Dhritarashtra.
"Vyasa said,--'O king, thy sons and the other monarchs have their hour arrived. 2 Mustered in battle they will kill one another. O Bharata, their hour having come, they will all perish. Bearing in mind the changes brought on by time, do not yield thy heart to grief. O king, if thou wish to see them (fighting) in battle, I will, O son, grant thee vision. Behold the battle."
"Dhritarashtra said,--'O best of regenerate Rishi, I like not to behold the slaughter of kinsmen. I shall, however, through thy potency hear of this battle minutely."
"Upon his not wishing to see the battle but wishing to hear of it, Vyasa, that lord of boons, gave a boon to Sanjaya. (And addressing Dhritarashtra he said),--
'This Sanjaya, O king, will describe the battle to thee. Nothing in the whole battle will be beyond this one's eyes.' Endued, O king with celestial vision, Sanjaya will narrate the battle to thee.
He will have knowledge of everything. Manifest or concealed, (happening) by day or by night, even that which is thought of in the mind, Sanjaya shall know everything. Weapons will not cut him and exertion will not fatigue him. This son of Gavalgani will come out of the battle with life.
As regards myself, O bull of Bharata's race, the fame of these Kurus, as also of all the Pandavas, I will spread. Do not grieve. This is destiny, O tiger among men. It behoveth thee not to give way to grief. It is not capable of being prevented. As regards victory, it is there where righteousness is.'"