Have you tried building that system with prompting?
You could set a convention of having comments something like this:
# Requirement: function always returns an array of strings
And then have a system prompt which tells the model to always obey comments like that, and to add comments like that to record important requirements provided by the user.