Learning to Cooperate with Humans using Generative Agents