I found this, which adds additional text to the existing licenses to prohibit training an AI on the licensed code: https://github.com/non-ai-licenses/non-ai-licenses
Though, per OSI's definition, your code probably would no longer be open source, since training an LLM is technically considered a field of endeavour:
OSD number 6:
The license must not restrict anyone from making use of the program in a specific field of endeavor. For example, it may not restrict the program from being used in a business, or from being used for genetic research.