I think you just have to assume so.
Openai says they don't train on API usage, but do on online chat interface. Don't know about google. But their entire business model is about selling you ads, so in broad strokes, they're incentivized to know as much as possible about everyone
Personally I've decided the upside of faster coding is worth the privacy hit for now