A structured template for building robust generative AI applications, with modular organization and best practices built-in.
- 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
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
- Clone the repository:
git clone https://github.com/yourusername/generative_ai_project.git
cd generative_ai_project- Install dependencies:
pip install -r requirements.txt-
Configure your environment:
- Copy
config/model_config.yaml.exampletoconfig/model_config.yaml - Add your API keys and configurations
- Copy
-
Review the examples in
examples/directory -
Start with the notebooks in
notebooks/for experimentation
model_config.yaml: Configure API keys and model parametersprompt_templates.yaml: Define reusable prompt templateslogging_config.yaml: Configure logging behavior
-
LLM Clients (
src/llm/)- Base client with common functionality
- Specific implementations for different providers
- Utility functions for token counting and rate limiting
-
Prompt Engineering (
src/prompt_engineering/)- Template management system
- Few-shot prompt utilities
- Prompt chaining capabilities
-
Utilities (
src/utils/)- Rate limiting for API calls
- Token counting
- Response caching
- Logging
- Keep configuration in YAML files
- Implement proper error handling
- Use rate limiting for APIs
- Maintain separation between model clients
- Cache results when appropriate
- Document your code
- Use notebooks for experimentation
- Follow modular design principles
- Write tests for new components
- Use proper version control
- Keep documentation updated
- Monitor API usage and limits
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Brij Kishore Pandey
For any queries, reach out to:
- GitHub: @honestsoul
- Email: brij.pydata@gmail.com
โญ If you find this template useful, please consider giving it a star!
