Help me understand the relation between file content and context window

Does the content of a file, whether it has been indexed or not, eventually end up in the prompt behind the scene ? (when using assistants api)

I am trying to add a bunch of code to the GTP-4 120k model and it will try to explain what the code does. I think that I have 2 options: 1 - add the code in the first prompt for the GPT to be aware of it, or 2 - add the code via uploading file in a thread (a zip probably), but then the question becomes: if the content in the file ends up in the prompt anyway and it uses the context window, then should I even think of using files ? Adding the code directly is simpler for me. However, if somehow adding code in files does help the context window or the GPT performance (or at least doesn’t decrease it), then files would be the way to go.

Side note: I mentioned adding files in a thread because it should depend on the thread (for my use case), but also because sending code in files for data retrieval (to an assistant) wouldn’t work that well because the model uses “semantic search” and finding similarity between my question and code in the vector db would be challenging, and probably the code retrieved from the db would be the wrong. And so, when using the code interpreter tool I can add files that will not be indexed - but does that mean their content gets added into the prompt ? Please correct my understanding if I got it all wrong.