I'm assuming there is a few fields in the template it needs to fill in right?
So there's two steps here
- Figuring out which template to use
- Actually filling it in
For 1), I think you could do some basic vector retrieval to narrow down the templates (if you have a lot), and then ask the LLM to pick which template to use based on a summary of each template?
For 2), you could use something like a pydantic program to just extract a structured object containing the finished blank fields from the template