🌓
API Reference
FunctionCallingEngine
The main class of the tiny_fnc_engine library.
Methods:
__init__(self)
: Initialize the FunctionCallingEngine.reset_session(self) -> None
: Reset the session of the engine, clearing stored outputs.add_functions(self, functions: list[callable]) -> None
: Add functions to the engine.add_functions_from_file(self, file_path: str) -> None
: Add functions to the engine from a specified .py file.call_function(self, function_call: FunctionCall) -> ValidOutput
: Call a single function from the engine.call_functions(self, function_calls: list[FunctionCall]) -> list[ValidOutput]
: Call multiple functions from the engine.parse_function_calls(self, function_calls: Union[dict, list[dict]]) -> list[FunctionCall]
: Parse either a single function call or a list of function calls.parse_and_call_functions(self, function_calls: Union[dict, list[dict], str], verbose: bool = False) -> list[ValidOutput]
: Parse and call either a single function call or a list of function calls. Theverbose
parameter, when set to True, prints details about each function call.
reset_session()
The reset_session()
method is used to clear the stored outputs from previous function calls. This is useful when you want to start a new sequence of function calls without any interference from previous results. For example:
engine = FunctionCallingEngine()
# ... perform some function calls ...
engine.reset_session() # Clear all stored outputs
# ... start a new sequence of function calls ...