A paperback short story collection I read in the 1992-2002 era included a story in which a man was sinking into dementia. Appreciating that the progressive nature of the disease would make it hard for him to recognize the right time, he programmed a robot butler with his values and memories. He secretly assigned the butler to help him choose a time to commit suicide that would be early enough that he would still be capable of doing so on his chosen terms, but late enough that his quality of life was below his target threshold. His wife thought it was just a routine robotic household/professional servant.
Story was probably written 1980-1995, and probably published in an SF periodical before being collected into a PB collection. Collection was probably author-centric, rather than theme-centric. I think it's on my shelves somewhere, but asking here is faster than skimming all my shelves volume by volume.