Skip to content

Commit 4830f19

Browse files
committed
Update README and add env.example file
1 parent f5ccb77 commit 4830f19

File tree

4 files changed

+279
-32
lines changed

4 files changed

+279
-32
lines changed

.env.example

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# LLM API Keys
2+
ANTHROPIC_API_KEY=your_anthropic_api_key_here
3+
OPENAI_API_KEY=your_openai_api_key_here
4+
GOOGLE_APPLICATION_CREDENTIALS=path_to_your_google_credentials.json
5+
AZURE_OPENAI_API_KEY=your_azure_openai_api_key_here
6+
AZURE_OPENAI_ENDPOINT=your_azure_openai_endpoint_here
7+
8+
# Model Configuration
9+
DEFAULT_MODEL=claude-3-opus-20240229 # For Anthropic
10+
# DEFAULT_MODEL=gpt-4-turbo-preview # For OpenAI
11+
# DEFAULT_MODEL=gemini-pro # For Google
12+
# DEFAULT_MODEL=gpt-4 # For Azure OpenAI
13+
14+
# API Configuration
15+
MAX_RETRIES=3
16+
REQUEST_TIMEOUT=30
17+
TEMPERATURE=0.7
18+
MAX_TOKENS=1000
19+
20+
# Logging Configuration
21+
LOG_LEVEL=INFO
22+
LOG_FILE=llm_patterns.log

.gitignore

+60-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,60 @@
1-
.DS_Store
1+
# Cursor Logs
2+
.cursorlogs
3+
4+
# macOS
5+
.DS_Store
6+
7+
# Python
8+
__pycache__/
9+
*.py[cod]
10+
*$py.class
11+
*.so
12+
.Python
13+
build/
14+
develop-eggs/
15+
dist/
16+
downloads/
17+
eggs/
18+
.eggs/
19+
lib/
20+
lib64/
21+
parts/
22+
sdist/
23+
var/
24+
wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
29+
# Virtual Environment
30+
venv/
31+
env/
32+
ENV/
33+
.env
34+
.venv
35+
36+
# IDE
37+
.idea/
38+
.vscode/
39+
*.swp
40+
*.swo
41+
42+
# Environment Variables
43+
.env
44+
.env.local
45+
.env.*.local
46+
47+
# Logs
48+
*.log
49+
logs/
50+
.cursorlogs
51+
52+
# Testing
53+
.coverage
54+
htmlcov/
55+
.pytest_cache/
56+
.tox/
57+
nosetests.xml
58+
coverage.xml
59+
*.cover
60+
.hypothesis/

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Coderplex Tech
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+176-31
Original file line numberDiff line numberDiff line change
@@ -15,55 +15,189 @@ This repository provides:
1515

1616
### Building Blocks
1717

18-
- **Augmented LLM**: Basic LLM integration with retrieval, tools, and memory
19-
- **Tool Integration**: Patterns for designing and implementing LLM tools
18+
-**Augmented LLM**: Basic LLM integration with retrieval, tools, and memory
19+
- Web search, calculator, and weather tools
20+
- Memory management
21+
- Tool integration framework
2022

2123
### Workflows
2224

23-
- **Prompt Chaining**: Sequential LLM calls with intermediate processing
24-
- **Routing**: Input classification and specialized handling
25-
- **Parallelization**: Concurrent LLM processing with sectioning and voting
26-
- **Orchestrator-Workers**: Dynamic task decomposition and delegation
27-
- **Evaluator-Optimizer**: Iterative improvement through feedback loops
25+
-**Prompt Chaining**: Sequential LLM calls with intermediate processing
26+
27+
- Text analysis example
28+
- Chain building and execution
29+
- Context management
30+
31+
-**Routing**: Input classification and specialized handling
32+
33+
- Support ticket routing example
34+
- Dynamic route selection
35+
- Fallback handling
36+
37+
-**Parallelization**: Concurrent LLM processing with sectioning and voting
38+
39+
- Content moderation example
40+
- Multiple voting strategies
41+
- Result combination
42+
43+
-**Orchestrator-Workers**: Dynamic task decomposition and delegation
44+
45+
- Document processing example
46+
- Task distribution
47+
- Worker management
48+
49+
-**Evaluator-Optimizer**: Iterative improvement through feedback loops
50+
- Code optimization example
51+
- Multiple optimization strategies
52+
- Progress tracking
2853

2954
### Agents
3055

31-
- **Autonomous Agents**: Self-directed systems with planning and execution
32-
- **Domain-Specific Agents**: Implementations for customer support, coding, etc.
56+
-**Autonomous Agents**: Self-directed systems with planning and execution
57+
58+
- Research assistant example
59+
- Dynamic planning
60+
- Tool utilization
61+
62+
-**Domain-Specific Agents**: Implementations for specialized domains
63+
- Medical diagnosis example
64+
- Domain knowledge integration
65+
- Constraint enforcement
3366

3467
## Getting Started
3568

36-
Each pattern includes:
69+
### Prerequisites
3770

38-
- Architectural overview
39-
- Implementation examples using different LLM providers:
40-
- Anthropic Claude
41-
- OpenAI GPT
42-
- Google Vertex AI
43-
- Azure OpenAI
44-
- Test cases and example outputs
45-
- Best practices and common pitfalls
71+
- Python 3.8+
72+
- API keys for the LLM provider(s) you want to use
73+
- Git for version control
4674

47-
## Usage
75+
### Installation
4876

49-
Navigate to the specific pattern you're interested in:
77+
1. Clone the repository:
5078

5179
```bash
52-
examples/
53-
workflows/prompt-chaining/ # For prompt chaining examples
54-
agents/autonomous-agent/ # For autonomous agent examples
80+
git clone https://github.com/coderplex-tech/building-with-llms.git
81+
cd building-with-llms
5582
```
5683

57-
Each example contains a standalone implementation that you can run with your API keys.
84+
2. Create and activate a virtual environment:
5885

59-
## Prerequisites:
86+
```bash
87+
python -m venv venv
88+
source venv/bin/activate # On Windows: venv\Scripts\activate
89+
```
6090

61-
- Python 3.8+
62-
- API keys for the LLM provider(s) you want to use
91+
3. Install dependencies:
92+
93+
```bash
94+
pip install -r requirements.txt
95+
```
96+
97+
4. Set up environment variables:
98+
99+
```bash
100+
cp .env.example .env
101+
# Edit .env with your API keys and configuration
102+
```
103+
104+
### Running Examples
105+
106+
Each pattern includes standalone examples that demonstrate its usage. Here's how to run them:
107+
108+
1. **Building Blocks**:
109+
110+
```bash
111+
# Augmented LLM example
112+
python -m building-block.augmented-llm.examples.basic_usage
113+
```
114+
115+
2. **Workflows**:
116+
117+
```bash
118+
# Prompt Chaining
119+
python -m workflows.prompt-chaining.examples.text_analysis
120+
121+
# Routing
122+
python -m workflows.routing.examples.support_routing
123+
124+
# Parallelization
125+
python -m workflows.parallelization.examples.content_moderation
126+
127+
# Orchestrator-Workers
128+
python -m workflows.orchestrator-workers.examples.document_processing
129+
130+
# Evaluator-Optimizer
131+
python -m workflows.evaluator-optimizer.examples.code_optimization
132+
```
133+
134+
3. **Agents**:
135+
136+
```bash
137+
# Autonomous Agent
138+
python -m agents.autonomous-agent.examples.research_assistant
139+
140+
# Domain-Specific Agent
141+
python -m agents.domain-specific.examples.medical_assistant
142+
```
143+
144+
### Directory Structure
145+
146+
```
147+
├── building-block/
148+
│ └── augmented-llm/ # Basic LLM integration
149+
├── workflows/
150+
│ ├── prompt-chaining/ # Sequential processing
151+
│ ├── routing/ # Input classification
152+
│ ├── parallelization/ # Concurrent processing
153+
│ ├── orchestrator-workers/ # Task decomposition
154+
│ └── evaluator-optimizer/ # Iterative improvement
155+
├── agents/
156+
│ ├── autonomous-agent/ # Self-directed systems
157+
│ └── domain-specific/ # Specialized agents
158+
├── requirements.txt # Project dependencies
159+
├── .env.example # Example environment variables
160+
└── README.md # This file
161+
```
162+
163+
## Implementation Details
164+
165+
Each pattern is implemented with:
166+
167+
- Core classes and interfaces
168+
- Example implementations
169+
- Comprehensive documentation
170+
- Unit tests (coming soon)
171+
- Best practices and usage guidelines
172+
173+
### Current Features
174+
175+
- Multiple LLM provider support (Anthropic, OpenAI, etc.)
176+
- Async/await for efficient processing
177+
- Type hints and Pydantic models
178+
- Error handling and retries
179+
- Detailed logging
180+
- Configuration management
181+
182+
### Coming Soon
183+
184+
- Additional examples for each pattern
185+
- Integration tests
186+
- Performance benchmarks
187+
- CI/CD pipeline
188+
- Docker containerization
189+
- API documentation
63190

64191
## Contributing
65192

66-
We welcome contributions! Please see our Contributing Guide for details.
193+
We welcome contributions! Here's how you can help:
194+
195+
1. Fork the repository
196+
2. Create a feature branch
197+
3. Make your changes
198+
4. Submit a pull request
199+
200+
Please ensure your code follows our style guide and includes appropriate tests and documentation.
67201

68202
## Why Native Implementations?
69203

@@ -76,6 +210,17 @@ While frameworks like LangChain can be useful, we believe building directly with
76210

77211
## Resources
78212

79-
- Architecture Decision Records
80-
- Pattern Documentation
81-
- Implementation Guides
213+
- 📚 [Pattern Documentation](./docs)
214+
- 🔧 [Implementation Guides](./guides)
215+
- 📊 [Architecture Decision Records](./adr)
216+
- 🧪 [Example Collection](./examples)
217+
218+
## License
219+
220+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
221+
222+
## Acknowledgments
223+
224+
- Thanks to all contributors
225+
- Inspired by software architecture patterns and LLM best practices
226+
- Built with modern Python async/await patterns

0 commit comments

Comments
 (0)