genWizard 0.0.3
genWizard allows for versatile usage of openAI generation and prompting management.
License: MIT
Keywords: machine learning

GENWIZARD LIBRARY:

'genWizard' is a complex project aimed at utilizing AI for text generation, particularly using OpenAI's language models. it is designed around the concept of generating content based on provided prompts, and involves a multi-stage process of expanding prompts, evaluating the reliability and validity of generated outputs, and comparing these outputs.

The purpose of the project is the allow anyone with little to no experience in coding AI to utilize the features of OpenAI's LLMs. 

-----------------------------------------------------------------------------------

SETUP:
    -

-----------------------------------------------------------------------------------

DATABASE MANAGER CLASS:
    - `__init__(self)`: The constructor for the `DatabaseManager` class. This initializes the instance with a mapping of paths to different directories in your project.

    - `get_latest_file(self, path, number=1)`: This function retrieves the latest file(s) from a given directory, as determined by the `path` argument. If `number` is greater than 1, it will return the specified number of latest files. The returned files are sorted in descending order of creation time.

    - `write(self, id, content=None, filetype=".txt")`: This function writes content to a file in a directory specified by `id`. The file is named with the current timestamp and the provided `filetype`. If no content is given, it prompts the user to provide content.

    - `read(self, id, filename=None)`: This function reads content from a file in a directory specified by `id`. If no filename is given, it reads from the latest file in the directory. It returns the content of the file.

    - `delete(self, id, filename=None)`: This function deletes a file in a directory specified by `id`. If no filename is given, it deletes the latest file in the directory.

    - `edit(self, id, filename=None, content=None)`: This function edits a file in a directory specified by `id`. If no filename is given, it edits the latest file in the directory. If no content is given, it prompts the user to provide new content.

In essence, the `DatabaseManager` class is a utility for reading from, writing to, editing, and deleting files in specified directories in your project.

-----------------------------------------------------------------------------------

GENERATOR CLASS:
    - `__init__(self, engine="gpt-3.5-turbo", api_key="")`: The constructor for the `Generator` class. Initializes an instance of the `Generator` class with the specified OpenAI engine and API key. It also creates an empty list `conversation_log` for storing the conversation history and an instance of the `DatabaseManager`.

    - `display_info(self)`: This function prints out the details of the `Generator` instance, including the OpenAI engine being used and the API key.

    - `base_generation(self, prompt, memory=False, token=300, temperature=0.5)`: This function makes a request to the OpenAI API using the provided prompt and other optional parameters. If `memory` is set to `True`, it will remember the response from the OpenAI API and store it in `conversation_log`. If `memory` is `False`, it will forget the response. It returns the response content as a string.

    - `multi_generation(self, prompt, number=1, memory=False)`: This function uses the `base_generation` function to generate multiple responses from the OpenAI API. The number of responses is determined by the `number` parameter. It returns a list of responses.

The `Generator` class serves as a wrapper for the OpenAI API, providing utility functions for making requests and handling responses. It also integrates with the `DatabaseManager` class to handle data storage and retrieval.

-----------------------------------------------------------------------------------

EXPANDER CLASS:
    - `__init__(self)`: The constructor for the `Expander` class. This initializes the instance with a `Generator` object and a `DatabaseManager` object.

    - `base_expansion(self, prompt_parts: list) -> str`: This function takes a list of string parts and joins them with two newline characters ("\n\n"). It is used for creating a prompt by joining multiple strings together in a specific format.

    - `expansion_generator(self, user_prompt: str, filename="expansion_generator_prompt.txt") -> list`: This function generates an expanded text based on a user-provided prompt. It reads an "expansion_prompt" from a file (default name "expansion_generator_prompt.txt") located in the directory associated with the ID 2 in the `DatabaseManager`'s path mapping. It then creates a full prompt by joining the "expansion_prompt" and the user's prompt using `base_expansion`. The full prompt is fed into the generator for text generation. The generated text is split by newline characters and returned as a list of strings. 

In essence, the `Expander` class is used to expand a given prompt by adding additional content from a file and then generate text based on the expanded prompt.

===================================================================================

GENWIZARD CHANGELOGS

===================================================================================

0.0.3
-----------------------------------------------------------------------------------
First Release
- Includes the basic functions: Database Manager, Expander, and Generator.