I recently came across RAG Engine in VertexAI platform, but unfortunately this isn’t available to use with web apis.
Is anyone aware of a workaround of how to give gemini access to private knowledge besides attaching files (that consume much tokens)?
Hello,
One possible option could be to first tokenize and embed your data, then run a similarity search to retrieve the most relevant information. You can then provide this information along with your query as the prompt to Gemini.
Yeah, I came to the same conclusion, but why it has to be this difficult? 
Yes, it might seem tricky but it is not very difficult to implement and you can find plenty of resources available to help you with this.