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.
- Host: GitHub
- URL: https://github.com/matiasvlevi/gptdoc
- Owner: matiasvlevi
- License: mit
- Created: 2023-03-04T20:56:48.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-04-15T20:48:21.000Z (about 2 years ago)
- Last Synced: 2025-04-23T04:03:32.106Z (about 2 months ago)
- Topics: documentation, documentation-generator, documentation-tool, gpt-3, gpt-35-turbo, gpt-4, jsdoc, openai, tsdoc, typedoc
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/gptdoc
- Size: 163 KB
- Stars: 20
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
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