Fun stuff about Classes
classes can be used to persist memory for functions that need to load a lot of stuff in memory and have to be used consecutively. For example.
Protect AI - LLM Guard requires the program to load all the Large Language Model (LLM) into the memory to process the query, but since the models are loaded in a function scope the function memory is released as soon as the function call is complete, which means that the models have to load every-time a query needs to be processed which is very inefficient.
This can be overcome by using a Class with an internal method that loads the models when the class is created and the memory is not released, in this manner we can persist memory in the application during runtime although the usage is very less.