I read this in the US in late 1980s, and I think it was written around then. It was set in the not-too-distant future. The main character was a woman, American I believe (or at least Western), working in Japan on building an AI. I think she was working for a government agency rather than a corporation. There's virtual reality involved. She programs it to follow the samurai code and winds up falling in love with it. I don't remember much of the plot, but I think there was the standard fear of AI causing conflict.
Might this be The Cybernetic Samurai (1985) by Victor Milán...?
Deep in the fortress-like headquarters of Yoshimitsu TeleCommunications, American scientist Elizabeth O'Neill had molded the circuitry of a mammoth computer into a living, thinking, feeling being--a human soul trapped in the confines of a cybernetic body.
She named her creation Tokugawa, hero of Japanese samurai lore, and educated him with all of the values of a feudal Japanese shogun.
Yet Tokugawa's powers were far greater than Elizabeth had imagined. WIth access to every computer in post-World War III's fully-automated society, he had the potential to become the ultimate spy, the perfect assassin, an invincible dictator.
Only loyalty to samurai virtues kept his attention in check--until the day when Elizabeth was taken away from him, and Tokugawa began his quest for revenge...