Skip to content

Pro-GenAI/gen-ai-template-python

Repository files navigation

Project logo

🚀 Generative AI Project Template — Python

Production-oriented starter template to build Generative AI projects instantly, with best practices and structured modules.

AI LLMs Python star

✨ Features:

  • FastAPI server with an OpenAI-compatible chat completions endpoint
  • LangChain + OpenAI-compatible clients
  • Optional RAG utilities (Vector Database, embeddings, and reranking)
  • Sensible defaults: logging, env loading, lazy initialization (no import-time crashes)
  • Docker Compose: Complete containerized deployment with Milvus vector database

📁 Project Structure

my_project/         # Main application package
    __init__.py       # Package initialization
    api_server.py     # FastAPI server with OpenAI-compatible endpoints
    settings.py       # Configuration and environment variable loading
    utils/            # Utility modules
        cache.py        # Caching utilities
        llm.py          # LLM client and interaction utilities
        logger.py       # Logging configuration
        rag/            # Retrieval-Augmented Generation utilities
            converter_utils.py    # Document conversion utilities
            ingestion.py         # Data ingestion for vector database
            llm_rag_utils.py     # RAG-specific LLM utilities
            retrieval_utils.py   # Vector retrieval and reranking
docs/               # Documentation files
tests/              # Unit and integration tests
    test_api_server.py    # Tests for the API server
examples/           # Example usage scripts
    call_llm.py       # Example of calling LLMs
    host_models.py    # Example of hosting models
notebooks/          # Jupyter notebooks for experimentation
    experiment.ipynb  # Experimental notebook
Dockerfile          # Docker container configuration
docker-compose.yml  # Multi-service container orchestration
.env.example        # Environment variables template
LICENSE             # Project license
pyproject.toml      # Python project configuration and dependencies
README.md           # This file - project documentation
assets/             # Static assets (images, etc.)

📖 Usage

See USAGE.md for detailed usage instructions, API documentation, and examples.

📚 Documentation

Detailed documentation for each file is available in the docs/ folder:

  • docs/Dockerfile.md - Container configuration
  • docs/pyproject.toml.md - Project dependencies
  • docs/my_project_api_server.py.md - API server details
  • And more...

🚀 Production Deployment

For production:

  1. Use external managed databases instead of local containers
  2. Configure proper secrets management
  3. Set up monitoring and logging
  4. Configure load balancing
  5. Use production-grade reverse proxy (nginx, traefik)

🤝 Contributing

Contributions are encouraged! Please open issues and submit pull requests for any features, bug fixes, or improvements.

📄 License

This project is licensed under the CC0 License to promote usage of the template. Refer the LICENSE file for details.

Please ⭐ star the repository if you found it useful!

About

Template for Generative AI projects — create and run your projects instantly

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published