Giter Site home page Giter Site logo

matiasvlevi / gptdoc Goto Github PK

View Code? Open in Web Editor NEW
21.0 2.0 1.0 167 KB

Generate documentation comments with OpenAI models.

Home Page: https://www.npmjs.com/package/gptdoc

License: MIT License

JavaScript 4.19% TypeScript 95.81%
documentation gpt-3 jsdoc openai gpt-35-turbo gpt-4 typedoc documentation-generator documentation-tool tsdoc

gptdoc's Introduction

GPTDoc logo

Generate documentation comments with OpenAI models

InstallDocumentationLicense

Preview

Functions labeled with /** @gpt */ get an autogenerated doc comment

Before After
/** @gpt */
function Greet(name) {
    console.log(`Hello ${name}`);
}
/**
 * @autogenerated
 * @summary Generates a greeting to the passed in name
 * @param {string} name - The name to greet
 */
function Greet(name) {
    console.log(`Hello ${name}`);
}

Install in project

Install gptdoc as a dev dependency

npm i --save-dev gptdoc 

Execute

node node_modules/gptdoc [args]

Config

You can specify a configuration file:

node node_modules/gptdoc -c .myconfig

If none provided, the script will look for .gptdoc

Sample Config file

{
    "DEBUG": false,
    "framework": "JSDOC",
    "language": "JS",
    "files": {
        "src": "./src",
        "dest": "./gpt"
    },
    "openai": {
        "temperature": 0.7,
        "top_p": 1,
        "max_tokens": 256,
        "model": "text-davinci-003"
    }
}

Find more info about the config here

API Key

Add a .env file in your root directory with OPENAI_API_KEY

or set the OPENAI_API_KEY as a system environement variable.

find your API key here

Document this project

Running docself in the cloned repo will document source files in ./src/

npm run docself

Running test in the cloned repo will document ./example/example.js

npm run test

Contributing

Constructive criticism, Issues and PRs are more than welcome!


License MIT

gptdoc's People

Contributors

matiasvlevi avatar noaether avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

noaether

gptdoc's Issues

Nice idea, couple of small issues

Love the idea! Will test it out again when I have some more time.

Thought I'd leave a comment with a couple of issues in case you weren't aware of them.

  1. There's an error if .gptdoc isn't present or explicitly define (which may be intentional) -- but it isn't included by default in the repo to run the docself task or tests, so I thought I'd mention it.

Screenshot 2023-03-31 at 7 37 00 PM

  1. This seems to rely on built-in fetch API, so it doesn't work in Node < v18

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.