{"id":14155445,"url":"https://github.com/fynnfluegge/doc-comments-ai","last_synced_at":"2025-05-15T20:02:34.585Z","repository":{"id":190645987,"uuid":"679904662","full_name":"fynnfluegge/doc-comments-ai","owner":"fynnfluegge","description":"LLM-powered code documentation generation","archived":false,"fork":false,"pushed_at":"2025-03-06T03:39:56.000Z","size":654,"stargazers_count":236,"open_issues_count":15,"forks_count":38,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-12T08:14:18.466Z","etag":null,"topics":["docstring","documentation-tool","gpt-35-turbo","gpt-4","javadoc","jsdoc","llm","ollama","openai","rustdoc"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fynnfluegge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-17T22:21:55.000Z","updated_at":"2025-05-08T07:11:30.000Z","dependencies_parsed_at":"2023-08-25T19:24:35.974Z","dependency_job_id":"e6594359-a343-4631-b7b9-de4fba8f7172","html_url":"https://github.com/fynnfluegge/doc-comments-ai","commit_stats":{"total_commits":75,"total_committers":7,"mean_commits":"10.714285714285714","dds":0.2666666666666667,"last_synced_commit":"907c890c923b037f9f357092c8aab5846962acd7"},"previous_names":["fynnfluegge/doc-comments.ai"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fynnfluegge%2Fdoc-comments-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fynnfluegge%2Fdoc-comments-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fynnfluegge%2Fdoc-comments-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fynnfluegge%2Fdoc-comments-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fynnfluegge","download_url":"https://codeload.github.com/fynnfluegge/doc-comments-ai/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414477,"owners_count":22067270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docstring","documentation-tool","gpt-35-turbo","gpt-4","javadoc","jsdoc","llm","ollama","openai","rustdoc"],"created_at":"2024-08-17T08:03:19.448Z","updated_at":"2025-05-15T20:02:33.761Z","avatar_url":"https://github.com/fynnfluegge.png","language":"Python","funding_links":[],"categories":["Python","openai"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Code documentation generation with LLMs\n\n[![Build](https://github.com/fynnfluegge/doc-comments.ai/actions/workflows/build.yaml/badge.svg)](https://github.com/fynnfluegge/doc-comments.ai/actions/workflows/build.yaml)\n[![Publish](https://github.com/fynnfluegge/doc-comments.ai/actions/workflows/publish.yaml/badge.svg)](https://github.com/fynnfluegge/doc-comments.ai/actions/workflows/publish.yaml)\n\u003cimg src=\"https://img.shields.io/badge/License-MIT-green.svg\"/\u003e\n\u003c/a\u003e\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\nFocus on writing your code, let LLMs write the documentation for you.  \nWith just a few keystrokes in your terminal by using OpenAI or 100% local LLMs without any data leaks.\n\nBuilt with [langchain](https://github.com/langchain-ai/langchain), [treesitter](https://github.com/tree-sitter/tree-sitter), [lama.cpp](https://github.com/ggerganov/llama.cpp) and [ollama](https://github.com/jmorganca/ollama)\n\n![doc_comments_ai_demo](https://github.com/fynnfluegge/doc-comments-ai/assets/16321871/664bc581-a2a0-49ea-87f9-343f49f05e97)\n\n\u003c/div\u003e\n\n## ✨ Features\n\n- 📝 \u0026nbsp;Generate documentation comment blocks for all methods in a file\n  - e.g. Javadoc, JSDoc, Docstring, Rustdoc etc.\n- ✍️ \u0026nbsp; Generate inline documentation comments in method bodies\n- 🌳\u0026nbsp; Treesitter integration\n- 💻\u0026nbsp; Local LLM support\n- 🌐\u0026nbsp; Azure OpenAI support\n\n\u003e [!NOTE]  \n\u003e Documentation will only be added to files without unstaged changes, so nothing is overwritten.\n\n## 🚀 Usage\n\nCreate documentations for any method in a file specified by `\u003cRELATIVE_FILE_PATH\u003e` with GPT-3.5-Turbo model:\n```\naicomment \u003cRELATIVE_FILE_PATH\u003e\n```\n\nCreate also documentation comments in the method body:\n```\naicomment \u003cRELATIVE_FILE_PATH\u003e --inline\n```\nGuided mode, confirm documentation generation for each method:\n```\naicomment \u003cRELATIVE_FILE_PATH\u003e --guided\n```\n\nUse GPT-4 model:\n```\naicomment \u003cRELATIVE_FILE_PATH\u003e --gpt4\n```\n\nUse GPT-3.5-Turbo-16k model:\n```\naicomment \u003cRELATIVE_FILE_PATH\u003e --gpt3_5-16k\n```\n\nUse Azure OpenAI:\n```\naicomment \u003cRELATIVE_FILE_PATH\u003e --azure-deployment \u003cDEPLOYMENT_NAME\u003e\n```\n\nUse local Llama.cpp:\n```\naicomment \u003cRELATIVE_FILE_PATH\u003e --local_model \u003cMODEL_PATH\u003e\n```\nUse local Ollama:\n```\naicomment \u003cRELATIVE_FILE_PATH\u003e --ollama-model \u003cOLLAMA_MODEL\u003e\n```\n\n\u003e [!NOTE]  \n\u003e How to download models from huggingface for local usage see [Local LLM usage](https://github.com/fynnfluegge/doc-comments-ai#3-local-llm-usage)\n\n\u003e [!NOTE]  \n\u003e If very extensive and descriptive documentations are needed, consider using GPT-4/GPT-3.5 Turbo 16k or a similar local model.\n\n\u003e [!IMPORTANT]  \n\u003e 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.\n\n## 📚 Supported Languages\n\n- [x] Python\n- [x] Typescript\n- [x] Javascript\n- [x] Java\n- [x] Rust\n- [x] Kotlin\n- [x] Go\n- [x] C++\n- [x] C\n- [x] C#\n- [x] Haskell\n\n## 📋 Requirements\n\n- Python \u003e= 3.9\n\n## 📦 Installation\n\nInstall in an isolated environment with `pipx`:\n```\npipx install doc-comments-ai\n```\nIf you are facing issues using pipx uou can also install directly from source through PyPI with\n```\npip install doc-comments-ai\n```\nHowever, it is recommended to use pipx instead to benefit from isolated environments for the dependencies.  \nFor further help visit the [Troubleshooting](https://github.com/fynnfluegge/doc-comments-ai?tab=readme-ov-file#-troubleshooting) section.\n\n### 1. OpenAI usage\n\nCreate your personal OpenAI API key and add it as `$OPENAI_API_KEY` to your environment with:\n\n```bash\nexport OPENAI_API_KEY = \u003cYOUR_API_KEY\u003e\n```\n\n### 2. Azure OpenAI usage\n\nAdd the following variables to your environment:\n\n```bash\nexport AZURE_API_BASE = \"https://\u003cyour-endpoint.openai.azure.com/\"\nexport AZURE_API_KEY = \u003cYOUR_AZURE_OPENAI_API_KEY\u003e\nexport AZURE_API_VERSION = \"2023-05-15\"\n```\n\n### 3. Local LLM usage with Llama.cpp\n\nWhen using a local LLM no API key is required. On first usage of `--local_model` you will be asked for confirmation to intall `llama-cpp-python` with its dependencies.\nThe installation process will take care of the hardware-accelerated build tailored to your hardware and OS. For further details see:\n[installation-with-hardware-acceleration](https://github.com/abetlen/llama-cpp-python#installation-with-hardware-acceleration)\n\nTo download a model from huggingface for local usage the most convenient way is using the `huggingface-cli`:\n\n```\nhuggingface-cli download TheBloke/CodeLlama-13B-Python-GGUF codellama-13b-python.Q5_K_M.gguf\n```\n\nThis will download the `codellama-13b-python.Q5_K_M` model to `~/.cache/huggingface/`.\nAfter the download has finished the absolute path of the `.gguf` file is printed to the console which can be used as the value for `--local_model`.\n\n\u003e [!IMPORTANT]  \n\u003e Since `llama.cpp` is used the model must be in the `.gguf` format.\n\n## 🛟 Troubleshooting\n- #### During installation with `pipx`\n  ```\n  pip failed to build package: tiktoken\n\n  Some possibly relevant errors from pip install:\n    error: subprocess-exited-with-error\n    error: can't find Rust compiler\n  ```\n  Make sure the rust compiler is installed on your system from [here](https://www.rust-lang.org/tools/install).\n\n## 🌟 Contributing\n\nIf you are missing a feature or facing a bug don't hesitate to open an issue or raise a PR.\nAny kind of contribution is highly appreciated!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffynnfluegge%2Fdoc-comments-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffynnfluegge%2Fdoc-comments-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffynnfluegge%2Fdoc-comments-ai/lists"}