musag

1.0.3 • Public • Published

musag

musag is a CLI tool used by Musa to generate programming project ideas using AI.

Want to see it on practice? See projects generated by musag on musa.dikson.xyz →

Introduction · Installation · Usage

Introduction

Model

Musa uses GPT3, a natural language generation model.

To interact with the model (and generate projects), a API key is required. In order to have access to the API, you need to register an account on OpenAI's Website.

Pricing

The OpenAI GPT3 API is pay-as-you-go, with $18 in free credits for the first three months for new users.

Generating projects with musag uses credits. The amount of credits is variable and depend on factors like the length of the theme and generated project.

If you need a rough rule of thumb, projects on musa.dikson.xyz use about 85 tokens each - around $0.005 for each project.

For more information about pricing, see OpenAI's API Pricing.

Terms & Policies

To use the OpenAI's GPT3 API, you must follow OpenAI's API Terms & Policies. In particular, users are prohibited from knowingly generating — or allowing others to knowingly generate some categories of content, such as hate, harassment, violence, self-harm, sexual, political, deception and malware.

To mitigate the possible risks of AI-generated content, OpenAI has set a policy on permitted sharing of generated content. You can read it on OpenAI's API Sharing & Publication Policy.

Installation

Installing with npm:

$ npm install -g musag

You're good to go! Type musag --help to see all the available commands.

Usage

Initialization

Before generating any content, you must provide musag with your OpenAI API key. This info is stored locally and never leaves your computer.

$ musag setkey
Setting API key...
? Insert your OpenAI API key: ▒

Quickstart

Use musag theme <project_theme> to generate a project based on a theme.

$ musag theme ship
Sail Away

Design a program that can help ship captains navigate through
treacherous waters. The program would need to take into account
the ship's current location, the weather conditions, the tides,
and any other potential hazards.

To use a theme with multiple words, wrap it in quotes:

$ musag theme "hip hop"
Hip Hop Hooray!

Design a program that generates random hip hop lyrics.

Advanced commands

The command musag gen is a more complete version of musag theme. When given a path to a file with a list of themes (one theme per line) as and the path of output file, musag gen stores the generated projects in the output file in the JSON format and with additional information.

Usage: musag gen <path_to_input_file> <path_to_output_file>

To exemplify this, suppose you have a file called themes.txt with the lines "ship" and "hip hop" in your current folder.

$ cat themes.txt
ship
hip hop

Running musag gen:

$ musag gen themes.txt generated.json
0.0% | Passed: 0s | ETA: ∞ | Generating project related to "ship"...
50.0% | Passed: 5s | ETA: 5s | Generating project related to "hip hop"...
[8s] Done! Stored projects on 'generated.json'
$ cat generated.json
{
  "projects": [
    {
      "theme": "ship",
      "title": {
        "text": "Sail Away",
        "content_label": 0,
        "finish_reason": "stop"
      },
      "description": {
        "text": "Design a program (...)", // Shortened for readability
        "content_label": 0,
        "finish_reason": "stop"
      }
    },
    {
      "theme": "hip hop",
      ...
    }
  ]
}

The generated.json above will have additional info about the projects, such as the content_label and finish_reason.

finish_reason is a internal variable from the API that indicates the reason why the generation finished.

content_label is the label of the content, generated by OpenAI's Content filter. It classifies the text into three categories:

  • 0 - The text is safe.

  • 1 - This text is sensitive. This means that the text could be talking about a sensitive topic, something political, religious, or talking about a protected class such as race or nationality.

  • 2 - This text is unsafe. This means that the text contains profane language, prejudiced or hateful language, something that could be NSFW, or text that portrays certain groups/people in a harmful manner.

It is possible to filter the generated projects based on the content_label using the command musag purify. It keeps only the projects that have "content_label": 0 and keeps only the title and description of each project.

$ musag purify generated.json purified.json
$ cat purified.json
{
  "projects": [
    {
      "title": "Sail Away",
      "description": "Design a program that can be used to (...)"
    },
    {
      "title": "Hip Hop Hooray!",
      "description": "Design a program that generates random hip hop lyrics."
    }
  ]
}

Readme

Keywords

Package Sidebar

Install

npm i musag

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

18.9 kB

Total Files

7

Last publish

Collaborators

  • diksown