Recently, I have ran into an annoying behavior: ‘this’ is not working with function calling.
‘this’ is used in Object Oriented Programming for giving context to a function. Thus, we can call one function, but use several that are inside the same object, also, variables.
For instance, I have a service in Angular. This service has a general model, and more especific models. The more specific model is just calling the general model, but adding a parametrization. Thus, it makes something like
this.general_model ("model 1"). Whereas the function calling will call the specific model instead.
I have tried, but when call the function myself, it works; when I can do it with functioin calling, it complains the this.function and this.variable is missing. Thougth a lot about it. The only explanation: functon calling has a static version of the functions, without any context.
But, I ran into this on the documentation:
“Under the hood, functions are injected into the system message in a syntax the model has been trained on.” Source
So, it means the function is actually passed as a text, not as a object reference.
They also say:
“This means functions count against the model’s context limit and are billed as input tokens. If running into context limits, we suggest limiting the number of functions or the length of documentation you provide for function parameters.”
Any thoughts from OOP programmers?