Skip to content

khoama246/fast_standard_docstring_code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fast Standard Code Comment

A FastAPI-based web service that automatically generates standardized documentation comments for code blocks using a local LLM (Ollama). It detects the programming language, references the appropriate comment convention (JSDoc, TSDoc, PEP 257, etc.), and returns the original code enriched with professional inline documentation.

Tech Stack

  • Python 3.14
  • FastAPI + Uvicorn — REST API server
  • LangChain + langchain-ollama — LLM agent orchestration
  • Ollama — local LLM runtime (default model: qwen2.5:7b)
  • codelang-detect — automatic programming language detection
  • docling — web crawling for convention reference URLs
  • Pydantic — request/response validation

How to Build and Run

  1. Install Ollama and pull the model:

    ollama pull qwen2.5:7b
  2. Install dependencies (using uv or pip):

    uv sync
    # or
    pip install -e .
  3. Start the server:

    python main.py

    The server listens on http://127.0.0.1:8085.

  4. Send a code block for commenting via POST /invoke:

    curl -X POST http://127.0.0.1:8085/invoke \
      -H "Content-Type: application/json" \
      -d '{"code_block": "def add(a, b):\n    return a + b"}'

    The response contains the original code with generated documentation comments.

About

Docstring code by python ollama

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages