Automated Specifications: The openai decorator automatically generates specifications from a function's signature and docstring. This specification is then used to communicate with OpenAI's API.
**Dynamic Function Calls**: With the help of OpenAI's API, the decorated function can infer arguments from the AI's response. This eliminates the need for manual input and allows seamless interaction with OpenAI's API.
**Type & Default Handling**: The decorator handles various edge cases related to function signatures, including default and optional values. It supports primitive types like int, str, bool, float and complex types like List, Dict, Tuple, Set, Optional, and custom classes. Parameters with a default value or marked as Optional are considered optional in the specification sent to OpenAI.
**Dynamic Prompts**: Users can now pass a callable function that returns a string to the prompt parameter in the decorator. This function is executed to generate a dynamic prompt every time the decorated function is called.
**Regular Function Usage**: The openai_func decorator can also be used as a regular function. It can be directly used by passing the target function as an argument, allowing dynamic decoration of functions during runtime.