Package: doc-comments-ai
Code documentation generation with LLMsFocus on writing your code, let LLMs write the documentation for you.With just a few keystrokes in your terminal by using OpenAI or 100% local LLMs without any data leaks.Built withlangchain,treesitter,lama.cppandollama✨ Features📝  Generate documentation comment blocks for all methods in a filee.g. Javadoc, JSDoc, Docstring, Rustdoc etc.✍️   Generate inline documentation comments in method bodies🌳  Treesitter integration💻  Local LLM support🌐  Azure OpenAI support[!NOTE]Documentations will only be added to files without unstaged changes, so nothing is overwritten.🚀 UsageCreate documentations for any method in a file specified by<RELATIVE_FILE_PATH>with GPT-3.5-Turbo model:aicomment <RELATIVE_FILE_PATH>Create also documentation comments in the method body:aicomment <RELATIVE_FILE_PATH> --inlineGuided mode, confirm documentation generation for each method:aicomment <RELATIVE_FILE_PATH> --guidedUse GPT-4 model:aicomment <RELATIVE_FILE_PATH> --gpt4Use GPT-3.5-Turbo-16k model:aicomment <RELATIVE_FILE_PATH> --gpt3_5-16kUse Azure OpenAI:aicomment <RELATIVE_FILE_PATH> --azure-deployment <DEPLOYMENT_NAME>Use local Llama.cpp:aicomment <RELATIVE_FILE_PATH> --local_model <MODEL_PATH>Use local Ollama:aicomment <RELATIVE_FILE_PATH> --ollama-model <OLLAMA_MODEL>[!NOTE]How to download models from huggingface for local usage seeLocal LLM usage[!NOTE]If very extensive and descriptive documentations are needed, consider using GPT-4/GPT-3.5 Turbo 16k or a similar local model.[!IMPORTANT]The results by using a local LLM will highly be affected by your selected model. To get similar results compared to GPT-3.5/4 you need to select very large models which require a powerful hardware.📚 Supported LanguagesPythonTypescriptJavascriptJavaRustKotlinGoC++CC#Haskell📋 RequirementsPython >= 3.9📦 InstallationInstall in an isolated environment withpipx:pipx install doc-comments-aiIf you are facing issues using pipx uou can also install directly from source through PyPI withpip install doc-comments-aiHowever, it is recommended to use pipx instead to benefit from isolated environments for the dependencies.For further help visit theTroubleshootingsection.1. OpenAI usageCreate your personal OpenAI API key and add it as$OPENAI_API_KEYto your environment with:exportOPENAI_API_KEY=<YOUR_API_KEY>2. Azure OpenAI usageAdd the following variables to your environment:exportAZURE_API_BASE="https://<your-endpoint.openai.azure.com/"exportAZURE_API_KEY=<YOUR_AZURE_OPENAI_API_KEY>exportAZURE_API_VERSION="2023-05-15"3. Local LLM usage with Llama.cppWhen using a local LLM no API key is required. On first usage of--local_modelyou will be asked for confirmation to intallllama-cpp-pythonwith its dependencies.
The installation process will take care of the hardware-accelerated build tailored to your hardware and OS. For further details see:installation-with-hardware-accelerationTo download a model from huggingface for local usage the most convenient way is using thehuggingface-cli:huggingface-cli download TheBloke/CodeLlama-13B-Python-GGUF codellama-13b-python.Q5_K_M.ggufThis will download thecodellama-13b-python.Q5_K_Mmodel to~/.cache/huggingface/.
After the download has finished the absolute path of the.gguffile is printed to the console which can be used as the value for--local_model.[!IMPORTANT]Sincellama.cppis used the model must be in the.ggufformat.🛟 TroubleshootingDuring installation withpipxpip failed to build package: tiktoken

Some possibly relevant errors from pip install:
  error: subprocess-exited-with-error
  error: can't find Rust compilerMake sure the rust compiler is installed on your system fromhere.🌟 ContributingIf you are missing a feature or facing a bug don't hesitate to open an issue or raise a PR.
Any kind of contribution is highly appreciated!