# LLMManuGen (c) 2023 - Marko T. Manninen - All Rights Reserved

A Python class for structured, automated generation and management of manuscripts using JSON and Markdown formats.

Use cases:

1. Use with ChatGPT + Advanced Data Analysis plug-in
2. Use with ChatGPT + Noteable plug-in

# 1. Use with ChatGPT + Advanced Data Analysis plug-in

Please read [ChatGPT + ADA Manual](https://github.com/markomanninen/llmmanugen/blob/main/chatgpt_ada_manual.md) and use the initial prompt given in the manual in ChatGPT activated with the Advanced Data Analysis plugin.
# 2. Use with ChatGPT + Noteable plug-in

Use the following initial prompt with Noteable plug-in activate. Copy and paste the prompt to the chat window and follow the instructions. Learn by interacting in the environment.
## Prompt

To replicate the manuscript generation process, follow steps:

STEP 1.

Ask user to give a JSON data, or generate it by asking the topic, title, guidelines and table of contents for the manuscript.

1a. If data is given by uploading a file or giving a JSON data string, use it.

Reading the JSON String/File: Start by reading a JSON data that contains the blueprint of the manuscript, including meta information like title, subtitle, author, disclaimer, and general guidelines for the content creation, as well as an outline of sections and their respective prompts.

1b. Else generate JSON string with the format described in JSON Structure and Example part.

STEP 2. Initialize Manuscript Class

!pip install llmmanugen
from llmmanugen import Manuscript, Section, Prompt
print(Manuscript.__doc__)

STEP 3. Traversing Sections One by One

- Start at the first section and proceed sequentially.
- At each section, read the current and next prompt from the JSON data.

STEP 4. Content Generation:

- Use the prompts guide to generate full-length content for that section. Indicate the length of the generated text with len() function.

STEP 5. User Review and Approval:

- Present the generated content to the user for review.
- Allow for any modifications if the user wishes to make them.
- Once accepted, store this content in the Manuscript class object. If Title is not given for the section, provide it as well.

STEP 6. Continue to Next Section:

- Once the content for the current section is approved, move on to the next section and repeat steps 3-5 until all sections have been covered.

STEP 7. Finalize Manuscript:

- After all sections have been completed, call the methods in the Manuscript class to save all the content to a Markdown (.md) and JSON files.

STEP 8. Download the Markdown File:

 - Provide the user with an option to download the finalized Markdown file AND JSON file containing the complete manuscript.

By following these steps, the process of reading the prompt, generating and reviewing content section-by-section, and finally saving it to a Markdown file will be accomplished.

The JSON file should adhere to a specific structure to be compatible with the Manuscript class. Here is the format description:

JSON Structure

title: The main title of the manuscript. (String)
subtitle: The subtitle for the manuscript, providing additional context or focus. (String)
author: Name of the author(s). (String)
disclaimer: Phrase the intention of the manuscript generation. (String)
guidelines: A dictionary containing guidelines for writing the manuscript.
constraints: A dictionary detailing any constraints on the manuscript.
sections: An array of dictionaries, each describing a section of the manuscript.
  - title: The title of the section. (String)
  - prompt: The writing prompt for that section. (String)
  - sections: (Optional) An array of sub-section dictionaries, recursively following the same structure as a section.
  - content: (Optional) To be generated. (String)

JSON Example

Here's a simplified example:

{
    "title": "The Interplay of Quantum Computing and Artificial Intelligence",
    "subtitle": "Unlocking New Frontiers in Technology",
    "author": "Marko T. Manninen",
	"disclaimer": "Content is A.I. generated by the given prompts. Facts are not checked. This document is for conceptual research purposes only.",
    "guidelines": {
        "format": "Academic Paper",
        "general": "Aim for clarity and conciseness;",
		"section_length": "3000-5000 characters"
    },
    "constraints": {
        "structure": "Do not write headings;",
        "blacklist_phrases": "In conclusion; Obviously; Basically; Anticipate; Foreshadow; Mystery;"
    },
    "sections": [
        {
            "title": "Introduction",
            "prompt": "Introduce the concept of The Interplay of Quantum Computing and Artificial Intelligence and its significance."
        },
        {
            "title": "Historical Perspective",
            "prompt": "Provide historical background or context for The Interplay of Quantum Computing and Artificial Intelligence."
        },
        {
            "title": "Technological Foundations",
            "prompt": "Discuss the core technologies in Quantum Computing and Artificial Intelligence.",
            "sections": [
                {
                    "title": "Quantum Mechanics",
                    "prompt": "Explain the principles of quantum mechanics that enable Quantum Computing."
                },
                {
                    "title": "Machine Learning Algorithms",
                    "prompt": "Describe the algorithms that are fundamental to Artificial Intelligence."
                }
            ]
        },
        {
            "title": "Challenges, Limitations, and Future Potential",
            "prompt": "Outline the challenges and limitations in marrying Quantum Computing with Artificial Intelligence. Conclude with future potential."
        }
    ]
}

-----

Start from STEP 1. Use Quick reply buttons/action suggestions when applicable.
