โ† Open Source

A structured template for building robust generative AI applications.

AI EngineeringAccess modelsPrompt & ScaffoldPython
Momentum
+0stars in 24 hours0.0%
1.05k
Stars
457
Forks
+-1
This week
1
Contributors
Created 2025-01-08 ยท Updated 2026-11-30 ยท #14794 today
Top developers
honestsoul
README

Generative AI Project Template

A structured template for building robust generative AI applications, with modular organization and best practices built-in.

๐ŸŒŸ Features

  • Modular project structure for scalability
  • Pre-configured support for multiple LLM providers (Claude, GPT)
  • Built-in prompt engineering utilities
  • Rate limiting and token management
  • Robust error handling
  • Caching mechanism for API responses
  • Example implementations and notebooks

๐Ÿ“ Project Structure

generative_ai_project/
โ”œโ”€โ”€ config/                  # Configuration directory
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ model_config.yaml    # Model-specific configurations
โ”‚   โ”œโ”€โ”€ prompt_templates.yaml # Prompt templates
โ”‚   โ””โ”€โ”€ logging_config.yaml  # Logging settings
โ”‚
โ”œโ”€โ”€ src/                     # Source code
โ”‚   โ”œโ”€โ”€ llm/                # LLM clients
โ”‚   โ”‚   โ”œโ”€โ”€ base.py         # Base LLM client
โ”‚   โ”‚   โ”œโ”€โ”€ claude_client.py # Anthropic Claude client
โ”‚   โ”‚   โ”œโ”€โ”€ gpt_client.py   # OpenAI GPT client
โ”‚   โ”‚   โ””โ”€โ”€ utils.py        # Shared utilities
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ prompt_engineering/ # Prompt engineering tools
โ”‚   โ”‚   โ”œโ”€โ”€ templates.py    # Template management
โ”‚   โ”‚   โ”œโ”€โ”€ few_shot.py    # Few-shot prompt utilities
โ”‚   โ”‚   โ””โ”€โ”€ chain.py       # Prompt chaining logic
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ utils/             # Utility functions
โ”‚   โ”‚   โ”œโ”€โ”€ rate_limiter.py # API rate limiting
โ”‚   โ”‚   โ”œโ”€โ”€ token_counter.py # Token counting
โ”‚   โ”‚   โ”œโ”€โ”€ cache.py       # Response caching
โ”‚   โ”‚   โ””โ”€โ”€ logger.py      # Logging utilities
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ handlers/          # Error handling
โ”‚       โ””โ”€โ”€ error_handler.py
โ”‚
โ”œโ”€โ”€ data/                   # Data directory
โ”‚   โ”œโ”€โ”€ cache/             # Cache storage
โ”‚   โ”œโ”€โ”€ prompts/           # Prompt storage
โ”‚   โ”œโ”€โ”€ outputs/           # Output storage
โ”‚   โ””โ”€โ”€ embeddings/        # Embedding storage
โ”‚
โ”œโ”€โ”€ examples/              # Example implementations
โ”‚   โ”œโ”€โ”€ basic_completion.py
โ”‚   โ”œโ”€โ”€ chat_session.py
โ”‚   โ””โ”€โ”€ chain_prompts.py
โ”‚
โ””โ”€โ”€ notebooks/            # Jupyter notebooks
    โ”œโ”€โ”€ prompt_testing.ipynb
    โ”œโ”€โ”€ response_analysis.ipynb
    โ””โ”€โ”€ model_experimentation.ipynb

๐Ÿš€ Getting Started

  1. Clone the repository:
git clone https://github.com/yourusername/generative_ai_project.git
cd generative_ai_project
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure your environment:

    • Copy config/model_config.yaml.example to config/model_config.yaml
    • Add your API keys and configurations
  2. Review the examples in examples/ directory

  3. Start with the notebooks in notebooks/ for experimentation

๐Ÿ“˜ Documentation

Configuration

  • model_config.yaml: Configure API keys and model parameters
  • prompt_templates.yaml: Define reusable prompt templates
  • logging_config.yaml: Configure logging behavior

Key Components

  1. LLM Clients (src/llm/)

    • Base client with common functionality
    • Specific implementations for different providers
    • Utility functions for token counting and rate limiting
  2. Prompt Engineering (src/prompt_engineering/)

    • Template management system
    • Few-shot prompt utilities
    • Prompt chaining capabilities
  3. Utilities (src/utils/)

    • Rate limiting for API calls
    • Token counting
    • Response caching
    • Logging

๐Ÿ› ๏ธ Development

Best Practices

  1. Keep configuration in YAML files
  2. Implement proper error handling
  3. Use rate limiting for APIs
  4. Maintain separation between model clients
  5. Cache results when appropriate
  6. Document your code
  7. Use notebooks for experimentation

Tips

  • Follow modular design principles
  • Write tests for new components
  • Use proper version control
  • Keep documentation updated
  • Monitor API usage and limits

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ‘ค Author

  • Brij Kishore Pandey

๐Ÿ“ง Contact

For any queries, reach out to:


โญ If you find this template useful, please consider giving it a star!

Nearby in the ranking
Similar items

AI Rank for iPhone

Follow AI model rankings

Download on the App Store