A structured project template with best practices for private-first and scalable Generative AI applications.
- 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/nnthanh101/ai-engineering.git
cd ai-engineering- 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
- 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
- Follow modular design principles
- Write tests for new components
- Use proper version control
- Keep documentation updated
- Monitor API usage and limits