How do I let GPT use a large JS library (like Express) to generate code?

I want GPT (e.g., GPT-4) to generate code snippets based on a large JavaScript library like Express.js. Because the library’s source is too big to paste directly into the prompt, how can I give GPT enough context so it produces accurate, library-specific code?

I’ve heard about using embeddings or vector databases to store the code and then retrieving only the relevant parts. Is there a simple method or tool that can help me give GPT what it needs to generate code built on top of Express, without exceeding token limits or losing important details?

Reference: GitHub - expressjs/express: Fast, unopinionated, minimalist web framework for node.