ai-lls-lib 1.4.0rc3__tar.gz → 1.5.0rc4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ai-lls-lib might be problematic. Click here for more details.
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/PKG-INFO +3 -2
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/README.md +253 -253
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/pyproject.toml +1 -1
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/__init__.py +6 -2
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/auth/__init__.py +4 -4
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/auth/context_parser.py +68 -68
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/cli/__init__.py +3 -3
- ai_lls_lib-1.5.0rc4/src/ai_lls_lib/cli/__main__.py +62 -0
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/cli/aws_client.py +115 -115
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/cli/commands/__init__.py +3 -3
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/cli/commands/admin.py +174 -174
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/cli/commands/cache.py +142 -142
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/cli/commands/stripe.py +381 -377
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/cli/commands/test_stack.py +216 -216
- ai_lls_lib-1.5.0rc4/src/ai_lls_lib/cli/commands/verify.py +204 -0
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/cli/env_loader.py +129 -122
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/core/__init__.py +3 -3
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/core/cache.py +106 -106
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/core/models.py +77 -77
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/core/processor.py +295 -295
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/core/verifier.py +90 -84
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/payment/__init__.py +13 -13
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/payment/credit_manager.py +186 -186
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/payment/models.py +102 -102
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/payment/stripe_manager.py +486 -487
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/payment/webhook_processor.py +215 -215
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/providers/__init__.py +8 -7
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/providers/base.py +28 -28
- ai_lls_lib-1.5.0rc4/src/ai_lls_lib/providers/external.py +151 -0
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/providers/stub.py +48 -48
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/testing/__init__.py +3 -3
- {ai_lls_lib-1.4.0rc3 → ai_lls_lib-1.5.0rc4}/src/ai_lls_lib/testing/fixtures.py +104 -104
- ai_lls_lib-1.4.0rc3/src/ai_lls_lib/cli/__main__.py +0 -30
- ai_lls_lib-1.4.0rc3/src/ai_lls_lib/cli/commands/verify.py +0 -111
- ai_lls_lib-1.4.0rc3/src/ai_lls_lib/providers/external.py +0 -87
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: ai-lls-lib
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0rc4
|
|
4
4
|
Summary: Landline Scrubber core library - phone verification and DNC checking
|
|
5
5
|
Author: LandlineScrubber Team
|
|
6
6
|
Requires-Python: >=3.12,<4.0
|
|
7
7
|
Classifier: Programming Language :: Python :: 3
|
|
8
8
|
Classifier: Programming Language :: Python :: 3.12
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
10
11
|
Requires-Dist: aws-lambda-powertools (>=2.30.0,<3.0.0)
|
|
11
12
|
Requires-Dist: boto3 (>=1.34.0,<2.0.0)
|
|
12
13
|
Requires-Dist: click (>=8.1.0,<9.0.0)
|
|
@@ -1,253 +1,253 @@
|
|
|
1
|
-
# AI LLS Library
|
|
2
|
-
|
|
3
|
-
Core business logic library and CLI tools for Landline Scrubber - phone verification and DNC checking.
|
|
4
|
-
|
|
5
|
-
## Version 2.1.0 - Streaming & Provider Architecture
|
|
6
|
-
|
|
7
|
-
New features:
|
|
8
|
-
- **Streaming support** for large CSV files to reduce memory usage
|
|
9
|
-
- **Provider architecture** for clean separation of verification logic
|
|
10
|
-
- **Contract tests** ensuring all providers behave consistently
|
|
11
|
-
|
|
12
|
-
## Version 2.0.0 - Breaking Changes
|
|
13
|
-
|
|
14
|
-
This is a greenfield rewrite with no backwards compatibility:
|
|
15
|
-
- All file-based CSV processing replaced with text-based methods
|
|
16
|
-
- Removed `_sync` suffix from all methods (everything is sync)
|
|
17
|
-
- `process_csv_sync(file_path)` → `process_csv(csv_text)`
|
|
18
|
-
- `generate_results_csv(...)` now returns CSV string instead of writing to file
|
|
19
|
-
|
|
20
|
-
## Features
|
|
21
|
-
|
|
22
|
-
- Phone number normalization (E.164 format)
|
|
23
|
-
- Line type detection (mobile/landline/voip)
|
|
24
|
-
- DNC (Do Not Call) list checking
|
|
25
|
-
- DynamoDB caching with 30-day TTL
|
|
26
|
-
- Bulk CSV processing
|
|
27
|
-
- Infrastructure-aware CLI for admin operations
|
|
28
|
-
- AWS Lambda PowerTools integration
|
|
29
|
-
|
|
30
|
-
## Installation
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
# Install library with Poetry
|
|
34
|
-
poetry install
|
|
35
|
-
|
|
36
|
-
# Install CLI globally
|
|
37
|
-
pip install -e .
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Library Usage
|
|
41
|
-
|
|
42
|
-
### Single Phone Verification
|
|
43
|
-
|
|
44
|
-
```python
|
|
45
|
-
from ai_lls_lib import PhoneVerifier, DynamoDBCache
|
|
46
|
-
|
|
47
|
-
cache = DynamoDBCache(table_name="phone-cache")
|
|
48
|
-
verifier = PhoneVerifier(cache)
|
|
49
|
-
|
|
50
|
-
result = verifier.verify("+15551234567")
|
|
51
|
-
print(f"Line type: {result.line_type}")
|
|
52
|
-
print(f"DNC: {result.dnc}")
|
|
53
|
-
print(f"From cache: {result.cached}")
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Bulk Processing
|
|
57
|
-
|
|
58
|
-
```python
|
|
59
|
-
from ai_lls_lib import BulkProcessor, PhoneVerifier, DynamoDBCache
|
|
60
|
-
|
|
61
|
-
cache = DynamoDBCache(table_name="phone-cache")
|
|
62
|
-
verifier = PhoneVerifier(cache)
|
|
63
|
-
processor = BulkProcessor(verifier)
|
|
64
|
-
|
|
65
|
-
# Process CSV text content
|
|
66
|
-
csv_text = "name,phone\nJohn,+15551234567\nJane,+15551234568"
|
|
67
|
-
results = processor.process_csv(csv_text)
|
|
68
|
-
|
|
69
|
-
# Generate results CSV
|
|
70
|
-
results_csv = processor.generate_results_csv(csv_text, results)
|
|
71
|
-
print(results_csv) # CSV string with added line_type, dnc, cached columns
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Streaming Large Files
|
|
75
|
-
|
|
76
|
-
For memory-efficient processing of large CSV files:
|
|
77
|
-
|
|
78
|
-
```python
|
|
79
|
-
from ai_lls_lib import BulkProcessor, PhoneVerifier, DynamoDBCache
|
|
80
|
-
|
|
81
|
-
cache = DynamoDBCache(table_name="phone-cache")
|
|
82
|
-
verifier = PhoneVerifier(cache)
|
|
83
|
-
processor = BulkProcessor(verifier)
|
|
84
|
-
|
|
85
|
-
# Process CSV as a stream, yielding batches
|
|
86
|
-
csv_lines = open('large_file.csv').readlines()
|
|
87
|
-
for batch in processor.process_csv_stream(csv_lines, batch_size=100):
|
|
88
|
-
print(f"Processed batch of {len(batch)} phones")
|
|
89
|
-
# Each batch is a list of PhoneVerification objects
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Custom Verification Providers
|
|
93
|
-
|
|
94
|
-
Use different verification providers based on your needs:
|
|
95
|
-
|
|
96
|
-
```python
|
|
97
|
-
from ai_lls_lib import PhoneVerifier, DynamoDBCache
|
|
98
|
-
from ai_lls_lib.providers import StubProvider
|
|
99
|
-
|
|
100
|
-
# Use stub provider for testing
|
|
101
|
-
cache = DynamoDBCache(table_name="phone-cache")
|
|
102
|
-
provider = StubProvider() # Deterministic testing provider
|
|
103
|
-
verifier = PhoneVerifier(cache, provider=provider)
|
|
104
|
-
|
|
105
|
-
# When external APIs are ready, switch to:
|
|
106
|
-
# from ai_lls_lib.providers.external import ExternalAPIProvider
|
|
107
|
-
# provider = ExternalAPIProvider(phone_api_key="...", dnc_api_key="...")
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## CLI Usage
|
|
111
|
-
|
|
112
|
-
The `ai-lls` CLI provides infrastructure-aware administrative tools:
|
|
113
|
-
|
|
114
|
-
### Verification Commands
|
|
115
|
-
```bash
|
|
116
|
-
# Verify single phone
|
|
117
|
-
ai-lls verify phone +15551234567 --stack landline-api
|
|
118
|
-
|
|
119
|
-
# Bulk verify CSV
|
|
120
|
-
ai-lls verify bulk input.csv -o output.csv --stack landline-api
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### Cache Management
|
|
124
|
-
```bash
|
|
125
|
-
# Show cache statistics
|
|
126
|
-
ai-lls cache stats --stack landline-api
|
|
127
|
-
|
|
128
|
-
# Get cached entry
|
|
129
|
-
ai-lls cache get +15551234567 --stack landline-api
|
|
130
|
-
|
|
131
|
-
# Invalidate cache entry
|
|
132
|
-
ai-lls cache invalidate +15551234567 --stack landline-api
|
|
133
|
-
|
|
134
|
-
# Clear old entries
|
|
135
|
-
ai-lls cache clear --older-than 20 --stack landline-api
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Administrative Commands
|
|
139
|
-
```bash
|
|
140
|
-
# Manage user credits
|
|
141
|
-
ai-lls admin user-credits user123 --add 100
|
|
142
|
-
ai-lls admin user-credits user123 --set 500
|
|
143
|
-
|
|
144
|
-
# List API keys
|
|
145
|
-
ai-lls admin api-keys --user user123
|
|
146
|
-
|
|
147
|
-
# Check queue status
|
|
148
|
-
ai-lls admin queue-stats
|
|
149
|
-
|
|
150
|
-
# View secrets (masked)
|
|
151
|
-
ai-lls admin secrets --stack landline-api
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Test Stack Management
|
|
155
|
-
```bash
|
|
156
|
-
# Deploy test stack
|
|
157
|
-
ai-lls test-stack deploy
|
|
158
|
-
|
|
159
|
-
# Check status
|
|
160
|
-
ai-lls test-stack status
|
|
161
|
-
|
|
162
|
-
# Run integration tests
|
|
163
|
-
ai-lls test-stack test
|
|
164
|
-
|
|
165
|
-
# Delete test stack
|
|
166
|
-
ai-lls test-stack delete
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## Project Structure
|
|
170
|
-
|
|
171
|
-
```
|
|
172
|
-
ai-lls-lib/
|
|
173
|
-
├── src/ai_lls_lib/
|
|
174
|
-
│ ├── core/ # Business logic (infrastructure-agnostic)
|
|
175
|
-
│ │ ├── models.py # Pydantic models
|
|
176
|
-
│ │ ├── verifier.py # Phone verification
|
|
177
|
-
│ │ ├── processor.py # Bulk processing
|
|
178
|
-
│ │ └── cache.py # DynamoDB cache
|
|
179
|
-
│ ├── cli/ # Infrastructure-aware CLI
|
|
180
|
-
│ │ ├── __main__.py # Entry point
|
|
181
|
-
│ │ ├── commands/ # Command modules
|
|
182
|
-
│ │ └── aws_client.py # AWS operations
|
|
183
|
-
│ └── testing/ # Test utilities
|
|
184
|
-
│ └── fixtures.py # Test data
|
|
185
|
-
├── tests/
|
|
186
|
-
│ ├── unit/ # Mocked tests
|
|
187
|
-
│ └── integration/ # AWS integration tests
|
|
188
|
-
└── test-stack.yaml # Test infrastructure
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
## Testing
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
# Run unit tests (mocked AWS)
|
|
195
|
-
poetry run pytest tests/unit -v
|
|
196
|
-
|
|
197
|
-
# Deploy test stack for integration tests
|
|
198
|
-
ai-lls test-stack deploy
|
|
199
|
-
|
|
200
|
-
# Run integration tests (requires test stack)
|
|
201
|
-
TEST_STACK_NAME=ai-lls-lib-test poetry run pytest tests/integration -v
|
|
202
|
-
|
|
203
|
-
# All tests with coverage
|
|
204
|
-
poetry run pytest --cov=src --cov-report=html
|
|
205
|
-
|
|
206
|
-
# Clean up
|
|
207
|
-
ai-lls test-stack delete
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## Development
|
|
211
|
-
|
|
212
|
-
### Current Stub Implementation
|
|
213
|
-
|
|
214
|
-
For demo purposes, verification uses stub logic based on last digit:
|
|
215
|
-
- Ends in 3: mobile, not on DNC
|
|
216
|
-
- Ends in 2: landline, not on DNC
|
|
217
|
-
- Ends in 1: mobile, on DNC
|
|
218
|
-
- Ends in 0: landline, on DNC
|
|
219
|
-
- Otherwise: mobile, not on DNC
|
|
220
|
-
|
|
221
|
-
TODO markers indicate where real API integration will be added.
|
|
222
|
-
|
|
223
|
-
### Code Quality
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
# Format code
|
|
227
|
-
poetry run black src/ tests/
|
|
228
|
-
poetry run isort src/ tests/
|
|
229
|
-
|
|
230
|
-
# Type checking
|
|
231
|
-
poetry run mypy src/
|
|
232
|
-
|
|
233
|
-
# Run pre-commit hooks
|
|
234
|
-
pre-commit run --all-files
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
## Environment Variables
|
|
238
|
-
|
|
239
|
-
- `DNC_API_KEY` - DNC verification API key
|
|
240
|
-
- `DNC_CHECK_API_KEY` - Alternative DNC service
|
|
241
|
-
- `PHONE_VERIFY_API_KEY` - Line type verification
|
|
242
|
-
- `AWS_REGION` - AWS region (default: us-east-1)
|
|
243
|
-
- `AWS_PROFILE` - AWS profile for CLI operations
|
|
244
|
-
|
|
245
|
-
## License
|
|
246
|
-
|
|
247
|
-
Proprietary - All rights reserved
|
|
248
|
-
|
|
249
|
-
## Release Process
|
|
250
|
-
|
|
251
|
-
This library uses semantic versioning and publishes to:
|
|
252
|
-
- TestPyPI on dev branch pushes (pre-release versions)
|
|
253
|
-
- PyPI on main branch pushes (stable releases)
|
|
1
|
+
# AI LLS Library
|
|
2
|
+
|
|
3
|
+
Core business logic library and CLI tools for Landline Scrubber - phone verification and DNC checking.
|
|
4
|
+
|
|
5
|
+
## Version 2.1.0 - Streaming & Provider Architecture
|
|
6
|
+
|
|
7
|
+
New features:
|
|
8
|
+
- **Streaming support** for large CSV files to reduce memory usage
|
|
9
|
+
- **Provider architecture** for clean separation of verification logic
|
|
10
|
+
- **Contract tests** ensuring all providers behave consistently
|
|
11
|
+
|
|
12
|
+
## Version 2.0.0 - Breaking Changes
|
|
13
|
+
|
|
14
|
+
This is a greenfield rewrite with no backwards compatibility:
|
|
15
|
+
- All file-based CSV processing replaced with text-based methods
|
|
16
|
+
- Removed `_sync` suffix from all methods (everything is sync)
|
|
17
|
+
- `process_csv_sync(file_path)` → `process_csv(csv_text)`
|
|
18
|
+
- `generate_results_csv(...)` now returns CSV string instead of writing to file
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- Phone number normalization (E.164 format)
|
|
23
|
+
- Line type detection (mobile/landline/voip)
|
|
24
|
+
- DNC (Do Not Call) list checking
|
|
25
|
+
- DynamoDB caching with 30-day TTL
|
|
26
|
+
- Bulk CSV processing
|
|
27
|
+
- Infrastructure-aware CLI for admin operations
|
|
28
|
+
- AWS Lambda PowerTools integration
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Install library with Poetry
|
|
34
|
+
poetry install
|
|
35
|
+
|
|
36
|
+
# Install CLI globally
|
|
37
|
+
pip install -e .
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Library Usage
|
|
41
|
+
|
|
42
|
+
### Single Phone Verification
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from ai_lls_lib import PhoneVerifier, DynamoDBCache
|
|
46
|
+
|
|
47
|
+
cache = DynamoDBCache(table_name="phone-cache")
|
|
48
|
+
verifier = PhoneVerifier(cache)
|
|
49
|
+
|
|
50
|
+
result = verifier.verify("+15551234567")
|
|
51
|
+
print(f"Line type: {result.line_type}")
|
|
52
|
+
print(f"DNC: {result.dnc}")
|
|
53
|
+
print(f"From cache: {result.cached}")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Bulk Processing
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from ai_lls_lib import BulkProcessor, PhoneVerifier, DynamoDBCache
|
|
60
|
+
|
|
61
|
+
cache = DynamoDBCache(table_name="phone-cache")
|
|
62
|
+
verifier = PhoneVerifier(cache)
|
|
63
|
+
processor = BulkProcessor(verifier)
|
|
64
|
+
|
|
65
|
+
# Process CSV text content
|
|
66
|
+
csv_text = "name,phone\nJohn,+15551234567\nJane,+15551234568"
|
|
67
|
+
results = processor.process_csv(csv_text)
|
|
68
|
+
|
|
69
|
+
# Generate results CSV
|
|
70
|
+
results_csv = processor.generate_results_csv(csv_text, results)
|
|
71
|
+
print(results_csv) # CSV string with added line_type, dnc, cached columns
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Streaming Large Files
|
|
75
|
+
|
|
76
|
+
For memory-efficient processing of large CSV files:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from ai_lls_lib import BulkProcessor, PhoneVerifier, DynamoDBCache
|
|
80
|
+
|
|
81
|
+
cache = DynamoDBCache(table_name="phone-cache")
|
|
82
|
+
verifier = PhoneVerifier(cache)
|
|
83
|
+
processor = BulkProcessor(verifier)
|
|
84
|
+
|
|
85
|
+
# Process CSV as a stream, yielding batches
|
|
86
|
+
csv_lines = open('large_file.csv').readlines()
|
|
87
|
+
for batch in processor.process_csv_stream(csv_lines, batch_size=100):
|
|
88
|
+
print(f"Processed batch of {len(batch)} phones")
|
|
89
|
+
# Each batch is a list of PhoneVerification objects
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Custom Verification Providers
|
|
93
|
+
|
|
94
|
+
Use different verification providers based on your needs:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from ai_lls_lib import PhoneVerifier, DynamoDBCache
|
|
98
|
+
from ai_lls_lib.providers import StubProvider
|
|
99
|
+
|
|
100
|
+
# Use stub provider for testing
|
|
101
|
+
cache = DynamoDBCache(table_name="phone-cache")
|
|
102
|
+
provider = StubProvider() # Deterministic testing provider
|
|
103
|
+
verifier = PhoneVerifier(cache, provider=provider)
|
|
104
|
+
|
|
105
|
+
# When external APIs are ready, switch to:
|
|
106
|
+
# from ai_lls_lib.providers.external import ExternalAPIProvider
|
|
107
|
+
# provider = ExternalAPIProvider(phone_api_key="...", dnc_api_key="...")
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## CLI Usage
|
|
111
|
+
|
|
112
|
+
The `ai-lls` CLI provides infrastructure-aware administrative tools:
|
|
113
|
+
|
|
114
|
+
### Verification Commands
|
|
115
|
+
```bash
|
|
116
|
+
# Verify single phone
|
|
117
|
+
ai-lls verify phone +15551234567 --stack landline-api
|
|
118
|
+
|
|
119
|
+
# Bulk verify CSV
|
|
120
|
+
ai-lls verify bulk input.csv -o output.csv --stack landline-api
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Cache Management
|
|
124
|
+
```bash
|
|
125
|
+
# Show cache statistics
|
|
126
|
+
ai-lls cache stats --stack landline-api
|
|
127
|
+
|
|
128
|
+
# Get cached entry
|
|
129
|
+
ai-lls cache get +15551234567 --stack landline-api
|
|
130
|
+
|
|
131
|
+
# Invalidate cache entry
|
|
132
|
+
ai-lls cache invalidate +15551234567 --stack landline-api
|
|
133
|
+
|
|
134
|
+
# Clear old entries
|
|
135
|
+
ai-lls cache clear --older-than 20 --stack landline-api
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Administrative Commands
|
|
139
|
+
```bash
|
|
140
|
+
# Manage user credits
|
|
141
|
+
ai-lls admin user-credits user123 --add 100
|
|
142
|
+
ai-lls admin user-credits user123 --set 500
|
|
143
|
+
|
|
144
|
+
# List API keys
|
|
145
|
+
ai-lls admin api-keys --user user123
|
|
146
|
+
|
|
147
|
+
# Check queue status
|
|
148
|
+
ai-lls admin queue-stats
|
|
149
|
+
|
|
150
|
+
# View secrets (masked)
|
|
151
|
+
ai-lls admin secrets --stack landline-api
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Test Stack Management
|
|
155
|
+
```bash
|
|
156
|
+
# Deploy test stack
|
|
157
|
+
ai-lls test-stack deploy
|
|
158
|
+
|
|
159
|
+
# Check status
|
|
160
|
+
ai-lls test-stack status
|
|
161
|
+
|
|
162
|
+
# Run integration tests
|
|
163
|
+
ai-lls test-stack test
|
|
164
|
+
|
|
165
|
+
# Delete test stack
|
|
166
|
+
ai-lls test-stack delete
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Project Structure
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
ai-lls-lib/
|
|
173
|
+
├── src/ai_lls_lib/
|
|
174
|
+
│ ├── core/ # Business logic (infrastructure-agnostic)
|
|
175
|
+
│ │ ├── models.py # Pydantic models
|
|
176
|
+
│ │ ├── verifier.py # Phone verification
|
|
177
|
+
│ │ ├── processor.py # Bulk processing
|
|
178
|
+
│ │ └── cache.py # DynamoDB cache
|
|
179
|
+
│ ├── cli/ # Infrastructure-aware CLI
|
|
180
|
+
│ │ ├── __main__.py # Entry point
|
|
181
|
+
│ │ ├── commands/ # Command modules
|
|
182
|
+
│ │ └── aws_client.py # AWS operations
|
|
183
|
+
│ └── testing/ # Test utilities
|
|
184
|
+
│ └── fixtures.py # Test data
|
|
185
|
+
├── tests/
|
|
186
|
+
│ ├── unit/ # Mocked tests
|
|
187
|
+
│ └── integration/ # AWS integration tests
|
|
188
|
+
└── test-stack.yaml # Test infrastructure
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Testing
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# Run unit tests (mocked AWS)
|
|
195
|
+
poetry run pytest tests/unit -v
|
|
196
|
+
|
|
197
|
+
# Deploy test stack for integration tests
|
|
198
|
+
ai-lls test-stack deploy
|
|
199
|
+
|
|
200
|
+
# Run integration tests (requires test stack)
|
|
201
|
+
TEST_STACK_NAME=ai-lls-lib-test poetry run pytest tests/integration -v
|
|
202
|
+
|
|
203
|
+
# All tests with coverage
|
|
204
|
+
poetry run pytest --cov=src --cov-report=html
|
|
205
|
+
|
|
206
|
+
# Clean up
|
|
207
|
+
ai-lls test-stack delete
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Development
|
|
211
|
+
|
|
212
|
+
### Current Stub Implementation
|
|
213
|
+
|
|
214
|
+
For demo purposes, verification uses stub logic based on last digit:
|
|
215
|
+
- Ends in 3: mobile, not on DNC
|
|
216
|
+
- Ends in 2: landline, not on DNC
|
|
217
|
+
- Ends in 1: mobile, on DNC
|
|
218
|
+
- Ends in 0: landline, on DNC
|
|
219
|
+
- Otherwise: mobile, not on DNC
|
|
220
|
+
|
|
221
|
+
TODO markers indicate where real API integration will be added.
|
|
222
|
+
|
|
223
|
+
### Code Quality
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
# Format code
|
|
227
|
+
poetry run black src/ tests/
|
|
228
|
+
poetry run isort src/ tests/
|
|
229
|
+
|
|
230
|
+
# Type checking
|
|
231
|
+
poetry run mypy src/
|
|
232
|
+
|
|
233
|
+
# Run pre-commit hooks
|
|
234
|
+
pre-commit run --all-files
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Environment Variables
|
|
238
|
+
|
|
239
|
+
- `DNC_API_KEY` - DNC verification API key
|
|
240
|
+
- `DNC_CHECK_API_KEY` - Alternative DNC service
|
|
241
|
+
- `PHONE_VERIFY_API_KEY` - Line type verification
|
|
242
|
+
- `AWS_REGION` - AWS region (default: us-east-1)
|
|
243
|
+
- `AWS_PROFILE` - AWS profile for CLI operations
|
|
244
|
+
|
|
245
|
+
## License
|
|
246
|
+
|
|
247
|
+
Proprietary - All rights reserved
|
|
248
|
+
|
|
249
|
+
## Release Process
|
|
250
|
+
|
|
251
|
+
This library uses semantic versioning and publishes to:
|
|
252
|
+
- TestPyPI on dev branch pushes (pre-release versions)
|
|
253
|
+
- PyPI on main branch pushes (stable releases)
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"""
|
|
2
|
-
AI LLS Library - Core business logic for Landline Scrubber
|
|
2
|
+
AI LLS Library - Core business logic for Landline Scrubber.
|
|
3
|
+
|
|
4
|
+
This library provides phone verification and DNC checking capabilities.
|
|
5
|
+
|
|
6
|
+
Version 1.5.x includes removal of environment-based Stripe filtering.
|
|
3
7
|
"""
|
|
4
8
|
from ai_lls_lib.core.models import (
|
|
5
9
|
PhoneVerification,
|
|
@@ -13,7 +17,7 @@ from ai_lls_lib.core.verifier import PhoneVerifier
|
|
|
13
17
|
from ai_lls_lib.core.processor import BulkProcessor
|
|
14
18
|
from ai_lls_lib.core.cache import DynamoDBCache
|
|
15
19
|
|
|
16
|
-
__version__ = "1.
|
|
20
|
+
__version__ = "1.5.0-rc.4"
|
|
17
21
|
__all__ = [
|
|
18
22
|
"PhoneVerification",
|
|
19
23
|
"BulkJob",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Auth module for handling authentication and authorization."""
|
|
2
|
-
from .context_parser import get_email_from_event, get_user_from_event
|
|
3
|
-
|
|
4
|
-
__all__ = ["get_user_from_event", "get_email_from_event"]
|
|
1
|
+
"""Auth module for handling authentication and authorization."""
|
|
2
|
+
from .context_parser import get_email_from_event, get_user_from_event
|
|
3
|
+
|
|
4
|
+
__all__ = ["get_user_from_event", "get_email_from_event"]
|