Method: Appending and state preserving huge data set for common use

I’m working on a project where I want to do the following:

  1. I have a list of a huge number (around 3000) predefined functions that are callable in some third-party library on Python.
  2. I also have a description of all of these 3000 functions, as well as how a random person would call that function. For example, if the function finds exp(x), then the user command would be “What’s the e to the 10th?”

Here’s what I want my model to do:

With the knowledge of this dataset, I want a model where based on a user command, it tells me which function/s to use (these could be compound functions/ stacked commands). These functions can ONLY be out of these pre defined 3000, and can not hallucinate and create its own functions (which the fine-tuning seems to be doing).

Example of a compound function -
Let’s say there exists a function only to multiply, and to divide by integers. If the user says “Multiply this by 1.5”, the model must return (even if it is without parameters it is alright) multiplyTwoNumbers > divideTwoNumbers [where these 2 are part of the 3000]
Example of a stacked command -
Multiply by 10 then print the value
It must output multiplyTwoNumbers > printValue [where again, these 2 are part of the 3000]

Please help me out as to how I can go about doing this. Fine-tuning seems to be causing a lot of problems with the model hallucinating functions, as well as it not being able to do the compound commands (since the fine-tune uses primarily only the NLP part of it in my opinion, and not other parts such as previous knowledge in that library, or math/ algebraic knowledge).