lakshmanok/generative-ai-design-patterns
A catalog of design patterns when building generative AI applications
What it solves
This repository provides a comprehensive library of 32 design patterns for building Generative AI applications. It addresses common challenges in LLM development, such as controlling content style, reducing hallucinations, managing knowledge integration (RAG), extending model capabilities through reasoning, and optimizing for cost and latency.
How it works
The project organizes patterns into several functional categories:
- Content Style: Uses techniques like logits masking, grammar constraints, and style transfer to ensure output conforms to specific rules or tones.
- Knowledge Addition: Implements various RAG (Retrieval-Augmented Generation) strategies, including semantic indexing and deep search, to ground models in external data.
- Model Capabilities: Employs reasoning patterns like Chain of Thought (CoT) and Tree of Thoughts (ToT) to improve multi-step logic.
- Reliability & Action: Uses LLM-as-Judge, reflection, and tool calling to create agents that can execute software APIs and verify their own work.
- Constraints & Safeguards: Implements prompt caching, inference optimization, and guardrails to manage GPU resources and ensure security/privacy.
Who it’s for
AI engineers and software developers who are building production-ready GenAI applications and need a standardized set of architectural patterns to solve recurring problems.
Highlights
- Extensive Pattern Library: Covers 32 distinct patterns ranging from basic RAG to complex multi-agent collaboration.
- Practical Examples: Includes working code examples for every pattern described.
- Broad Scope: Addresses the entire lifecycle from data preparation (Evol-Instruct) to inference optimization and degradation testing.
- Safety-First Approach: Dedicated patterns for guardrails, self-checking for hallucinations, and template generation for high-risk communications.
관련
- 프로젝트
- 프로젝트
- 프로젝트
- 프로젝트
- Dispatch