Visual Studio Code extension to quickly generate docstrings for python functions using AI(NLP) technology. This project is forked from graykode/ai-docstring. Main difference is that this version uses a quantized version of Mistral-AI's 7B model and attempts to produce a complete docstring including variable types and descriptions according to the chosen template.
Demo (real time, using Google Colab T4 runtime as backend):
demo.mp4
- Google (default)
- docBlockr
- Numpy
- Sphinx
- Create ngrok and google colab accounts.
- Open the server notebook on google colab.
- Replace
<authtoken>
with your ngrok authtoken in the second cell and uncomment the corresponding line - Run all cells
- Copy the ngrok address (without https) into the extension settings
llmdocstring.ServerEndpoint
- Recommended: Create a new python environment with python version 3.9 and activate
- In the directory
server
, runpip install -r requirements.txt
- Check llama-cpp-python installation page to install llama-cpp-python according to your hardware.
- Run
python llmserver.py
- Copy
127.0.0.1:5000
into the extension settingsllmdocstring.ServerEndpoint
Cursor must be on the line directly below the definition to generate full auto-populated docstring
- Press enter after opening docstring with triple quotes (
"""
or'''
) - Keyboard shortcut:
ctrl+shift+2
orcmd+shift+2
for mac- Can be changed in Preferences -> Keyboard Shortcuts -> extension.generateDocstring
- Command:
Generate Docstring
- Right click menu:
Generate Docstring