Atricle 3 and 4 of the EU 'Copyright in the Digital Single Market' give data miners quite extensive rights.
Move operation to the EU, train a foundational model, than train a constitutional model based on that.
As much as I hate the upcoming AI regulation, the CDSM is solid.
https://academic.oup.com/grurint/article/71/8/685/6650009 https://eur-lex.europa.eu/eli/dir/2019/790/oj
Update: Fixed wrong link
There are some things that would make for good faith displays by the players in the space. For example, Microsoft has been investing a lot and yet their code offering is not trained on their internal code base. Same for Google. Start by doing that and I'll entertain the argument that your tools are fair use or data mining.
Regarding the copyright of returned material here is a good discussion:
https://copyrightblog.kluweriplaw.com/2023/05/09/generative-...
That’s the author’s entire gripe. Brave reproduced a Wikipedia entry without attribution and then slapped a copyright on it to boot.