An open API service indexing awesome lists of open source software.

https://github.com/matiasvlevi/gptdoc

Generate documentation comments with OpenAI models.
https://github.com/matiasvlevi/gptdoc

documentation documentation-generator documentation-tool gpt-3 gpt-35-turbo gpt-4 jsdoc openai tsdoc typedoc

Last synced: about 2 months ago
JSON representation

Generate documentation comments with OpenAI models.

Awesome Lists containing this project

README

        


GPTDoc logo

Generate documentation comments with OpenAI models


Install
Documentation
License

## Preview

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

Before After

```ts
/** @gpt */
function Greet(name) {
console.log(`Hello ${name}`);
}
```

```ts
/**
* @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

```sh
npm i --save-dev gptdoc
```

Execute

```sh
node node_modules/gptdoc [args]
```

## Config

You can specify a configuration file:

```sh
node node_modules/gptdoc -c .myconfig
```

If none provided, the script will look for `.gptdoc`

### Sample Config file

```json
{
"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](./CONFIG.md)

## 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](https://platform.openai.com/account/api-keys)

### Document this project

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

```sh
npm run docself
```

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

```sh
npm run test
```

## Contributing

Constructive criticism, Issues and PRs are more than welcome!

---

License MIT