Co-pilot uses the surrounding context of your code, which is often good enough to feel "trained" on your own codebase.
So for example, say you have a function called "doThingie()". Copilot will look at how the function is defined, and be able to generate code that correctly uses "doThingie()".