fusesell 1.2.0__py3-none-any.whl

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 fusesell might be problematic. Click here for more details.

@@ -0,0 +1,872 @@
1
+ Metadata-Version: 2.4
2
+ Name: fusesell
3
+ Version: 1.2.0
4
+ Summary: Local implementation of FuseSell AI sales automation pipeline
5
+ Author-email: FuseSell Team <team@fusesell.ai>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/rtavytran/fusesell
8
+ Project-URL: Source, https://github.com/rtavytran/fusesell
9
+ Project-URL: Issues, https://github.com/rtavytran/fusesell/issues
10
+ Project-URL: Changelog, https://github.com/rtavytran/fusesell/blob/main/CHANGELOG.md
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Requires-Python: >=3.8
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: openai>=1.0.0
23
+ Requires-Dist: requests>=2.25.0
24
+ Requires-Dist: beautifulsoup4>=4.9.0
25
+ Requires-Dist: lxml>=4.6.0
26
+ Requires-Dist: python-dateutil>=2.8.0
27
+ Requires-Dist: pytz>=2021.1
28
+ Provides-Extra: ocr
29
+ Requires-Dist: pytesseract>=0.3.8; extra == "ocr"
30
+ Requires-Dist: pillow>=8.0.0; extra == "ocr"
31
+ Requires-Dist: easyocr>=1.6.0; extra == "ocr"
32
+ Provides-Extra: pdf
33
+ Requires-Dist: PyPDF2>=3.0.0; extra == "pdf"
34
+ Requires-Dist: PyMuPDF>=1.20.0; extra == "pdf"
35
+ Provides-Extra: gcv
36
+ Requires-Dist: google-cloud-vision>=2.0.0; extra == "gcv"
37
+ Provides-Extra: dev
38
+ Requires-Dist: psutil>=5.8.0; extra == "dev"
39
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
40
+ Dynamic: license-file
41
+
42
+ # FuseSell Local
43
+
44
+ **Complete AI-powered sales automation pipeline that runs entirely on your local machine.**
45
+
46
+ FuseSell Local is a production-ready implementation of the FuseSell AI sales automation system, converted from server-based YAML workflows to a comprehensive Python command-line tool with full data ownership and privacy control.
47
+
48
+ ## 🚀 Complete Pipeline Overview
49
+
50
+ FuseSell Local processes leads through a complete 5-stage AI-powered pipeline:
51
+
52
+ 1. **Data Acquisition** ✅ - Multi-source customer data extraction (websites, business cards, social media)
53
+ 2. **Data Preparation** ✅ - AI-powered customer profiling and pain point analysis
54
+ 3. **Lead Scoring** ✅ - Advanced product-customer fit evaluation with detailed scoring
55
+ 4. **Initial Outreach** ✅ - Intelligent email generation with multiple personalized approaches
56
+ 5. **Follow-up** ✅ - Context-aware follow-up sequences with interaction history analysis
57
+
58
+ **Status: 100% Complete - Production Ready**
59
+
60
+ ## 🚀 Quick Start
61
+
62
+ ### Installation
63
+
64
+ 1. **Install Python dependencies:**
65
+
66
+ ```bash
67
+ cd fusesell-local
68
+ pip install -r requirements.txt
69
+ ```
70
+
71
+ **That's it!** No additional setup required. The system automatically creates all necessary database tables and default configurations on first run.
72
+
73
+ 2. **Test the installation:**
74
+
75
+ ```bash
76
+ python fusesell.py --openai-api-key YOUR_API_KEY \
77
+ --org-id test_org \
78
+ --org-name "Test Company" \
79
+ --input-website "https://example.com" \
80
+ --dry-run
81
+ ```
82
+
83
+ ### First Run (Complete Pipeline)
84
+
85
+ ```bash
86
+ # Full end-to-end sales automation
87
+ python fusesell.py \
88
+ --openai-api-key "sk-your-key" \
89
+ --org-id "mycompany" \
90
+ --org-name "My Company Inc" \
91
+ --input-website "https://targetcompany.com"
92
+ ```
93
+
94
+ This single command will:
95
+ 1. Extract customer data from the website
96
+ 2. Analyze and structure the data using AI
97
+ 3. Score the lead against your products
98
+ 4. Generate personalized email drafts
99
+ 5. Create follow-up sequences
100
+
101
+ ## Library Integration
102
+
103
+ FuseSell Local can now be imported directly so orchestrators like RealtimeX can execute the pipeline without spawning the CLI.
104
+
105
+ 1. Install the package in your Python environment:
106
+
107
+ ```bash
108
+ pip install fusesell
109
+ ```
110
+
111
+ 2. Run the pipeline programmatically with default helpers:
112
+
113
+ ```python
114
+ from fusesell_local import execute_pipeline
115
+
116
+ result = execute_pipeline(
117
+ {
118
+ "openai_api_key": "sk-your-key",
119
+ "org_id": "mycompany",
120
+ "org_name": "My Company Inc",
121
+ "full_input": "Seller: My Company Inc, Customer: Target Corp, Communication: English",
122
+ "input_website": "https://targetcompany.com",
123
+ }
124
+ )
125
+
126
+ print(result["status"])
127
+ ```
128
+
129
+ 3. For finer-grained control (custom logging, shared storage, etc.), compose the lower-level utilities:
130
+
131
+ ```python
132
+ from fusesell_local import (
133
+ build_config,
134
+ configure_logging,
135
+ prepare_data_directory,
136
+ run_pipeline,
137
+ validate_config,
138
+ )
139
+
140
+ options = {
141
+ "openai_api_key": "sk-your-key",
142
+ "org_id": "mycompany",
143
+ "org_name": "My Company Inc",
144
+ "full_input": "Seller: My Company Inc, Customer: Target Corp, Communication: English",
145
+ "input_website": "https://targetcompany.com",
146
+ "customer_timezone": "America/New_York",
147
+ }
148
+
149
+ config = build_config(options)
150
+ prepare_data_directory(config)
151
+ configure_logging(config)
152
+ valid, errors = validate_config(config)
153
+ if not valid:
154
+ raise ValueError(errors)
155
+
156
+ outputs = run_pipeline(config)
157
+ ```
158
+
159
+ When embedding FuseSell inside ephemeral interpreter services, consider supplying a custom `data_dir` scoped per run and set `auto_configure_logging=False` if you prefer stdout logging.
160
+
161
+ 4. Reuse the packaged CLI inside scripts or tests:
162
+
163
+ ```python
164
+ from fusesell_local import FuseSellCLI
165
+
166
+ cli = FuseSellCLI()
167
+ cli.run([
168
+ "--openai-api-key", "sk-your-key",
169
+ "--org-id", "mycompany",
170
+ "--org-name", "My Company Inc",
171
+ "--full-input", "Seller: My Company Inc, Customer: Target Corp, Communication: English",
172
+ "--input-description", "Example Corp lead from automation script",
173
+ "--dry-run",
174
+ ])
175
+ ```
176
+
177
+ ## 📋 Complete Usage Examples
178
+
179
+ ### Example 1: Full Pipeline - Website to Follow-up
180
+
181
+ ```bash
182
+ # Complete end-to-end sales automation
183
+ python fusesell.py \
184
+ --openai-api-key "sk-proj-abc123" \
185
+ --org-id "mycompany" \
186
+ --org-name "My Company Inc" \
187
+ --input-website "https://targetcompany.com"
188
+ ```
189
+
190
+ **Complete Pipeline Execution:**
191
+ 1. **Data Acquisition**: Scrapes website, extracts company information
192
+ 2. **Data Preparation**: AI analysis of company profile and pain points
193
+ 3. **Lead Scoring**: Evaluates product-customer fit with detailed scoring
194
+ 4. **Initial Outreach**: Generates 4 personalized email draft variations
195
+ 5. **Follow-up**: Creates context-aware follow-up sequence strategies
196
+ ### Exa
197
+ mple 2: Multi-Source Data Collection
198
+
199
+ ```bash
200
+ # Combine multiple data sources for comprehensive profiling
201
+ python fusesell.py \
202
+ --openai-api-key "sk-proj-abc123" \
203
+ --org-id "mycompany" \
204
+ --org-name "My Company Inc" \
205
+ --input-website "https://targetcompany.com" \
206
+ --input-business-card "https://example.com/business-card.jpg" \
207
+ --input-linkedin-url "https://linkedin.com/company/targetcompany" \
208
+ --input-facebook-url "https://facebook.com/targetcompany" \
209
+ --input-description "Leading fintech startup in NYC, 50+ employees"
210
+ ```
211
+
212
+ **Multi-Source Processing:**
213
+ - **Website**: Company information, services, team details
214
+ - **Business Card**: Contact information via OCR processing
215
+ - **LinkedIn**: Professional information, company updates, connections
216
+ - **Facebook**: Business information, customer engagement, posts
217
+ - **Description**: Additional context and insights
218
+
219
+ ### Example 3: Email Generation and Management
220
+
221
+ ```bash
222
+ # Generate initial outreach emails only
223
+ python fusesell.py \
224
+ --openai-api-key "sk-proj-abc123" \
225
+ --org-id "mycompany" \
226
+ --org-name "My Company Inc" \
227
+ --input-description "Customer: John Smith at Acme Corp, email: john@acme.com, industry: manufacturing" \
228
+ --stop-after initial_outreach
229
+ ```
230
+
231
+ **Email Generation Features:**
232
+ - **4 Draft Approaches**: Professional Direct, Consultative, Industry Expert, Relationship Building
233
+ - **Personalized Subject Lines**: 4 variations per draft
234
+ - **Personalization Scoring**: 0-100 score based on customer data usage
235
+ - **Draft Comparison**: Side-by-side analysis with recommendations
236
+
237
+ ### Example 4: Email Sending with Smart Scheduling
238
+
239
+ ```bash
240
+ # Send email with optimal timing
241
+ python fusesell.py \
242
+ --action send \
243
+ --selected-draft-id "draft_professional_direct_abc123" \
244
+ --recipient-address "john@acme.com" \
245
+ --recipient-name "John Smith" \
246
+ --org-id "mycompany" \
247
+ --customer-timezone "America/New_York" \
248
+ --business-hours-start "09:00" \
249
+ --business-hours-end "17:00"
250
+ ```
251
+
252
+ **Smart Scheduling Features:**
253
+ - **Timezone Intelligence**: Respects customer's business hours
254
+ - **Optimal Timing**: 2-hour default delay with business hours respect
255
+ - **Weekend Handling**: Automatically schedules for next business day
256
+ - **Database Events**: Creates events for external app processing
257
+
258
+ ### Example 5: Follow-up Email Generation
259
+
260
+ ```bash
261
+ # Generate context-aware follow-up emails
262
+ python fusesell.py \
263
+ --action draft_write \
264
+ --stage follow_up \
265
+ --execution-id "exec_abc123_20241209" \
266
+ --org-id "mycompany"
267
+ ```
268
+
269
+ **Follow-up Intelligence:**
270
+ - **Interaction Analysis**: Analyzes previous email history and engagement
271
+ - **Strategy Selection**: Chooses appropriate follow-up approach (1st, 2nd, 3rd, final)
272
+ - **Context Awareness**: References previous interactions appropriately
273
+ - **Respectful Limits**: Maximum 5 follow-ups with graceful closure
274
+
275
+ ### Example 6: Draft Rewriting and Improvement
276
+
277
+ ```bash
278
+ # Rewrite existing draft based on feedback
279
+ python fusesell.py \
280
+ --action draft_rewrite \
281
+ --selected-draft-id "draft_consultative_xyz789" \
282
+ --reason "Make it more technical and focus on ROI benefits" \
283
+ --org-id "mycompany"
284
+ ```
285
+
286
+ **Draft Rewriting Features:**
287
+ - **LLM-Powered Rewriting**: Uses AI to incorporate feedback
288
+ - **Version Control**: Tracks all rewrites with history
289
+ - **Personalization Maintenance**: Keeps customer-specific details
290
+ - **Improvement Tracking**: Monitors changes and effectiveness
291
+
292
+ ### Example 7: Pipeline Control and Testing
293
+
294
+ ```bash
295
+ # Stop after lead scoring (don't generate emails)
296
+ python fusesell.py \
297
+ --openai-api-key "sk-proj-abc123" \
298
+ --org-id "mycompany" \
299
+ --org-name "My Company Inc" \
300
+ --input-website "https://targetcorp.com" \
301
+ --stop-after lead_scoring
302
+
303
+ # Skip follow-up generation
304
+ python fusesell.py \
305
+ --openai-api-key "sk-proj-abc123" \
306
+ --org-id "mycompany" \
307
+ --org-name "My Company Inc" \
308
+ --input-website "https://targetcorp.com" \
309
+ --skip-stages follow_up
310
+
311
+ # Dry run (no API calls, uses mock data)
312
+ python fusesell.py \
313
+ --openai-api-key "test-key" \
314
+ --org-id "test" \
315
+ --org-name "Test Company" \
316
+ --input-website "https://example.com" \
317
+ --dry-run
318
+
319
+ # Debug mode with detailed logging
320
+ python fusesell.py \
321
+ --openai-api-key "sk-proj-abc123" \
322
+ --org-id "mycompany" \
323
+ --org-name "My Company Inc" \
324
+ --input-website "https://targetcorp.com" \
325
+ --log-level DEBUG
326
+ ```
327
+
328
+ ### Example 8: Process Continuation
329
+
330
+ ```bash
331
+ # First run - stop after data preparation
332
+ python fusesell.py \
333
+ --openai-api-key "sk-proj-abc123" \
334
+ --org-id "mycompany" \
335
+ --org-name "My Company Inc" \
336
+ --input-website "https://targetcorp.com" \
337
+ --execution-id "lead_001" \
338
+ --stop-after data_preparation
339
+
340
+ # Continue from where we left off
341
+ python fusesell.py \
342
+ --openai-api-key "sk-proj-abc123" \
343
+ --org-id "mycompany" \
344
+ --org-name "My Company Inc" \
345
+ --continue-execution "lead_001" \
346
+ --continue-action "approve_and_continue"
347
+ ```
348
+
349
+ ## 📊 Command Reference
350
+
351
+ ### Required Arguments
352
+
353
+ | Argument | Description | Example |
354
+ | ------------------ | -------------------------------------------------------- | ------------------------------------------------------------- |
355
+ | `--openai-api-key` | Your OpenAI API key | `sk-proj-abc123...` |
356
+ | `--org-id` | Organization identifier | `rta` |
357
+ | `--org-name` | Organization name | `"RTA Corp"` |
358
+ | `--full-input` | Full information input (Seller, Customer, Communication) | `"Seller: RTA Corp, Customer: Nagen, Communication: English"` |
359
+
360
+ ### Data Sources (At Least One Required)
361
+
362
+ | Argument | Description | Example |
363
+ | ----------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------ |
364
+ | `--input-website` | Website URL (empty if not provided) | `https://example.com` |
365
+ | `--input-description` | Full customer info (name, phone, email, address, etc.) | `"Customer: Simone Simmons of company Nagen with email: simonesimmons@rta.vn"` |
366
+ | `--input-business-card` | Business card image URL (empty if not provided) | `https://example.com/card.jpg` |
367
+ | `--input-linkedin-url` | LinkedIn profile/business page URL | `https://linkedin.com/company/acme` |
368
+ | `--input-facebook-url` | Facebook profile/business page URL | `https://facebook.com/acme` |
369
+ | `--input-freetext` | Free text input with customer information | `"Contact John at Acme Corp for software solutions"` |
370
+
371
+ ### Optional Context Fields
372
+
373
+ | Argument | Description | Example |
374
+ | --------------- | ----------------------------------------------- | ------------------------------------------- |
375
+ | `--customer-id` | Customer ID for tracking (null if not provided) | `uuid:5b06617a-339e-47c2-b516-6b32de8ec9a7` |
376
+
377
+ ### Pipeline Control
378
+
379
+ | Argument | Description | Example |
380
+ | ---------------------- | --------------------------- | ---------------------------------------- |
381
+ | `--stop-after` | Stop after specific stage | `--stop-after lead_scoring` |
382
+ | `--skip-stages` | Skip specific stages | `--skip-stages follow_up` |
383
+ | `--continue-execution` | Continue previous execution | `--continue-execution exec_123` |
384
+ | `--continue-action` | Action for continuation | `--continue-action approve_and_continue` |
385
+
386
+ ### Output Options
387
+
388
+ | Argument | Description | Example |
389
+ | ----------------- | ------------------------ | ---------------------- |
390
+ | `--output-format` | Output format | `json`, `yaml`, `text` |
391
+ | `--data-dir` | Data directory | `./my_data` |
392
+ | `--execution-id` | Custom execution ID | `my_execution_001` |
393
+ | `--dry-run` | Test mode (no API calls) | `--dry-run` |
394
+
395
+ ### Team & Project Settings
396
+
397
+ | Argument | Description | Example |
398
+ | ---------------- | --------------- | ------------------------------------------- |
399
+ | `--team-id` | Team identifier | `uuid:6dc8faf9-cf04-07eb-846b-a928dddd701c` |
400
+ | `--team-name` | Team name | `"Annuity Products Sales Team"` |
401
+ | `--project-code` | Project code | `C1293` |
402
+
403
+ ### Advanced Options
404
+
405
+ | Argument | Description | Example |
406
+ | ------------------- | ------------------------------- | -------------------------- |
407
+ | `--language` | Processing language | `en`, `vi` |
408
+ | `--llm-temperature` | LLM creativity (0.0-1.0) | `0.7` |
409
+ | `--llm-max-tokens` | Max tokens per request | `2000` |
410
+ | `--serper-api-key` | Serper API key for enhanced web scraping | `your-serper-key` |
411
+ | `--log-level` | Logging level | `DEBUG`, `INFO`, `WARNING` |
412
+
413
+ ### Email Scheduling Options
414
+
415
+ | Argument | Description | Example |
416
+ | ------------------------ | ---------------------------------- | -------------------- |
417
+ | `--send-immediately` | Skip timing optimization, send now | `--send-immediately` |
418
+ | `--customer-timezone` | Customer's timezone | `"America/New_York"` |
419
+ | `--business-hours-start` | Business hours start time | `"09:00"` |
420
+ | `--business-hours-end` | Business hours end time | `"17:00"` |
421
+ | `--delay-hours` | Custom delay before sending | `4` |
422
+
423
+ ### Action-Based Operations
424
+
425
+ | Action | Description | Required Parameters |
426
+ | --------------- | ------------------------- | -------------------------------------------- |
427
+ | `draft_write` | Generate new email drafts | `--org-id`, `--org-name` |
428
+ | `draft_rewrite` | Modify existing draft | `--selected-draft-id`, `--reason` |
429
+ | `send` | Send/schedule email | `--selected-draft-id`, `--recipient-address` |
430
+ | `close` | Close outreach sequence | `--reason` |
431
+
432
+ ### Stage-Specific Operations
433
+
434
+ | Stage | Purpose | Key Parameters |
435
+ | ------------------ | --------------------- | ---------------------------------------- |
436
+ | `data_acquisition` | Extract customer data | `--input-website`, `--input-description` |
437
+ | `data_preparation` | AI customer analysis | Automatic (uses previous stage data) |
438
+ | `lead_scoring` | Product-customer fit | Automatic (uses previous stage data) |
439
+ | `initial_outreach` | Email generation | `--action draft_write` |
440
+ | `follow_up` | Follow-up sequences | `--action draft_write`, `--execution-id` |## 🌐 Enha
441
+ nced Web Scraping with Serper API
442
+
443
+ **Optional but Recommended:** Add `--serper-api-key` for better data collection:
444
+
445
+ ```bash
446
+ # Enhanced scraping capabilities
447
+ python fusesell.py \
448
+ --openai-api-key "sk-proj-abc123" \
449
+ --serper-api-key "your-serper-key" \
450
+ --org-id "mycompany" \
451
+ --org-name "My Company Inc" \
452
+ --input-website "https://targetcompany.com"
453
+ ```
454
+
455
+ **Benefits:**
456
+ - 🌐 **Better Website Scraping**: More reliable content extraction
457
+ - 🔍 **Company Research**: Automatic Google search for company info
458
+ - 📱 **Social Media Access**: Enhanced LinkedIn/Facebook scraping
459
+ - 🚫 **Graceful Fallback**: Works without Serper API (shows warnings)
460
+
461
+ **Get Serper API Key:** Visit [serper.dev](https://serper.dev) → Sign up → Get free API key
462
+
463
+ ## 🔄 Complete Pipeline Stages
464
+
465
+ ### 1. Data Acquisition ✅
466
+
467
+ **Purpose:** Multi-source customer data extraction
468
+
469
+ **Data Sources:**
470
+ - **Website Scraping**: Company information, contact details, business description
471
+ - **Business Card OCR**: Contact extraction from images (Tesseract, EasyOCR, Cloud APIs)
472
+ - **LinkedIn Profiles**: Professional information, company details, connections
473
+ - **Facebook Pages**: Business information, contact details, public posts
474
+ - **Manual Input**: Structured customer descriptions
475
+
476
+ **AI Processing:**
477
+ - LLM-powered information extraction and structuring
478
+ - Multi-source data merging and conflict resolution
479
+ - Company research via search APIs
480
+
481
+ **Output:** Comprehensive customer profile with contact information
482
+
483
+ ### 2. Data Preparation ✅
484
+
485
+ **Purpose:** AI-powered customer profiling and analysis
486
+
487
+ **AI Analysis:**
488
+ - **Customer Profiling**: Structured company information extraction
489
+ - **Pain Point Identification**: Categorized business challenges and priorities
490
+ - **Financial Analysis**: Revenue estimation, growth potential, funding sources
491
+ - **Technology Assessment**: Digital maturity and technology stack analysis
492
+ - **Competitive Analysis**: Market positioning and competitive landscape
493
+ - **Development Planning**: Growth plans, timeline estimates, resource requirements
494
+
495
+ **Output:** Enriched customer profile with pain points and business insights
496
+
497
+ ### 3. Lead Scoring ✅
498
+
499
+ **Purpose:** Advanced product-customer fit evaluation
500
+
501
+ **Scoring Framework:**
502
+ - **5 Weighted Criteria**: Industry fit, company size, pain points, technology, budget
503
+ - **ROI Analysis**: Payback period estimation and financial impact assessment
504
+ - **Implementation Feasibility**: Technical complexity and resource requirements
505
+ - **Competitive Positioning**: Market advantage and differentiation analysis
506
+ - **Feature Alignment**: Product capabilities vs. customer needs matching
507
+ - **Scalability Assessment**: Growth potential and expansion opportunities
508
+
509
+ **Output:** Detailed scoring breakdown with product recommendations and justifications
510
+
511
+ ### 4. Initial Outreach ✅
512
+
513
+ **Purpose:** Intelligent email generation and draft management
514
+
515
+ **Email Generation:**
516
+ - **4 Approach Variations**: Professional Direct, Consultative, Industry Expert, Relationship Building
517
+ - **Personalized Subject Lines**: 4 variations per draft with company-specific messaging
518
+ - **Advanced Personalization**: 0-100 scoring based on customer data usage
519
+ - **Call-to-Action Optimization**: Automatic CTA extraction and optimization
520
+
521
+ **Draft Management:**
522
+ - **Comparison System**: Side-by-side draft analysis with recommendations
523
+ - **Version Control**: Track original drafts and all rewrites with history
524
+ - **Selection Algorithms**: Configurable criteria-based best draft selection
525
+ - **Customer Readiness**: Outreach readiness scoring with improvement recommendations
526
+
527
+ **Output:** Multiple personalized email drafts with management tools
528
+
529
+ ### 5. Follow-up ✅
530
+
531
+ **Purpose:** Context-aware follow-up sequences with interaction analysis
532
+
533
+ **Interaction Analysis:**
534
+ - **History Tracking**: Days since last interaction, total attempts, engagement patterns
535
+ - **Sentiment Detection**: Customer response analysis and engagement level scoring
536
+ - **Sequence Intelligence**: Automatic progression through follow-up stages
537
+ - **Respectful Limits**: Maximum 5 follow-ups with graceful closure handling
538
+
539
+ **Follow-up Strategies:**
540
+ - **Gentle Reminder** (1st): Friendly check-in with soft approach
541
+ - **Value-Add** (2nd): Industry insights, resources, and helpful information
542
+ - **Alternative Approach** (3rd): Different angle, case studies, social proof
543
+ - **Final Attempt** (4th): Respectful closure with future opportunity maintenance
544
+ - **Graceful Farewell** (5th): Professional relationship preservation
545
+
546
+ **Smart Features:**
547
+ - **Timing Intelligence**: Minimum 3-day intervals between follow-ups
548
+ - **Context Awareness**: References previous interactions appropriately
549
+ - **Engagement Adaptation**: Adjusts tone and approach based on customer behavior
550
+
551
+ **Output:** Context-aware follow-up emails with sequence management## 🔍 M
552
+ anaging Multiple Sales Processes
553
+
554
+ When running multiple sales processes, use the querying tools:
555
+
556
+ ```bash
557
+ # List all recent sales processes
558
+ python query_sales_processes.py --list
559
+
560
+ # Get complete details for a specific process
561
+ python query_sales_processes.py --details "fusesell_20251010_141010_3fe0e655"
562
+
563
+ # Find processes by customer name
564
+ python query_sales_processes.py --customer "Target Corp"
565
+
566
+ # Get specific stage results
567
+ python query_sales_processes.py --stage-result "task_id" "lead_scoring"
568
+ ```
569
+
570
+ **📚 Complete querying guide: [QUERYING_GUIDE.md](QUERYING_GUIDE.md)**
571
+
572
+ ## 📁 Data Storage & Configuration
573
+
574
+ All data is stored locally in the `fusesell_data` directory with **100% server-compatible schema**:
575
+
576
+ ```
577
+ fusesell_data/
578
+ ├── fusesell.db # SQLite database
579
+ ├── config/ # Configuration files
580
+ │ ├── prompts.json # LLM prompts
581
+ │ ├── scoring_criteria.json
582
+ │ └── email_templates.json
583
+ ├── drafts/ # Generated email drafts
584
+ └── logs/ # Execution logs
585
+ ```
586
+
587
+ ### Database Tables
588
+
589
+ - `executions` - Execution records and metadata
590
+ - `customers` - Customer profiles and information
591
+ - `lead_scores` - Lead scoring results and breakdowns
592
+ - `email_drafts` - Generated email drafts and variations
593
+ - `stage_results` - Intermediate results from each stage
594
+
595
+ ### 🏗️ Server-Compatible Database Schema
596
+
597
+ FuseSell Local uses **exact server table names** for seamless integration:
598
+
599
+ - **`llm_worker_task`**: Task management (matches server exactly)
600
+ - **`llm_worker_operation`**: Stage execution tracking (matches server exactly)
601
+ - **`gs_customer_llmtask`**: Customer data storage (matches server exactly)
602
+ - **`executions`**: Backward compatibility VIEW that maps to `llm_worker_task`
603
+
604
+ ### Configuration Files
605
+
606
+ #### Custom Prompts (`config/prompts.json`)
607
+
608
+ Customize LLM prompts for different stages:
609
+
610
+ ```json
611
+ {
612
+ "data_preparation": {
613
+ "customer_analysis": "Your custom prompt for customer analysis...",
614
+ "pain_point_identification": "Your custom prompt for pain points..."
615
+ },
616
+ "lead_scoring": {
617
+ "product_evaluation": "Your custom scoring prompt..."
618
+ }
619
+ }
620
+ ```
621
+
622
+ #### Scoring Criteria (`config/scoring_criteria.json`)
623
+
624
+ Customize lead scoring weights and criteria:
625
+
626
+ ```json
627
+ {
628
+ "criteria": {
629
+ "industry_fit": { "weight": 25, "description": "Industry alignment" },
630
+ "company_size": { "weight": 20, "description": "Company size fit" },
631
+ "pain_points": { "weight": 30, "description": "Pain point match" },
632
+ "technology": { "weight": 15, "description": "Technology compatibility" },
633
+ "budget": { "weight": 10, "description": "Budget indicators" }
634
+ }
635
+ }
636
+ ```
637
+
638
+ ## 🎯 Key Features
639
+
640
+ ### ✅ Complete AI-Powered Sales Automation
641
+
642
+ - **Multi-Source Data Collection**: Websites, business cards (OCR), LinkedIn, Facebook
643
+ - **AI Customer Profiling**: Pain point analysis, company research, financial assessment
644
+ - **Intelligent Lead Scoring**: Product-customer fit evaluation with detailed breakdowns
645
+ - **Personalized Email Generation**: 4 different approaches with subject line variations
646
+ - **Context-Aware Follow-ups**: Smart sequence management with interaction history analysis
647
+
648
+ ### ✅ 100% Local Execution & Privacy
649
+
650
+ - **Complete Data Ownership**: All customer data stays on your machine
651
+ - **No External Dependencies**: Except OpenAI API for LLM processing
652
+ - **SQLite Database**: Local data storage with full CRUD operations
653
+ - **Event-Based Scheduling**: Database events for external app integration
654
+ - **Comprehensive Logging**: Detailed execution tracking and debugging
655
+
656
+ ### ✅ Production-Ready Architecture
657
+
658
+ - **Action-Based Routing**: draft_write, draft_rewrite, send, close operations
659
+ - **Error Handling**: Graceful degradation with fallback templates
660
+ - **Draft Management**: Comparison, versioning, and selection utilities
661
+ - **Timezone Intelligence**: Optimal email timing with business hours respect
662
+ - **Extensible Design**: Easy customization and integration
663
+
664
+ ### ✅ Advanced Intelligence Features
665
+
666
+ - **Personalization Scoring**: 0-100 scoring based on customer data usage
667
+ - **Engagement Analysis**: Customer interaction patterns and sentiment detection
668
+ - **Readiness Assessment**: Outreach readiness scoring with recommendations
669
+ - **Sequence Management**: Automatic follow-up progression (1st → 2nd → 3rd → final)
670
+ - **Respectful Automation**: Smart limits and graceful closure handling## 🛠️ Trou
671
+ bleshooting
672
+
673
+ ### Common Issues
674
+
675
+ #### 1. "No such file or directory: requirements.txt"
676
+
677
+ **Solution:** Make sure you're in the `fusesell-local` directory:
678
+
679
+ ```bash
680
+ cd fusesell-local
681
+ pip install -r requirements.txt
682
+ ```
683
+
684
+ #### 2. "OpenAI API key not provided"
685
+
686
+ **Solution:** Ensure your API key is correct and has sufficient credits:
687
+
688
+ ```bash
689
+ python fusesell.py --openai-api-key "sk-proj-your-actual-key" ...
690
+ ```
691
+
692
+ #### 3. "No data could be collected from any source"
693
+
694
+ **Solution:** Ensure the website URL is accessible and valid:
695
+
696
+ ```bash
697
+ # Test with a known working website
698
+ python fusesell.py ... --input-website "https://google.com" --dry-run
699
+ ```
700
+
701
+ #### 4. "Permission denied" errors
702
+
703
+ **Solution:** Use user installation or virtual environment:
704
+
705
+ ```bash
706
+ pip install --user -r requirements.txt
707
+ # OR
708
+ python -m venv venv
709
+ source venv/bin/activate # Linux/Mac
710
+ venv\Scripts\activate # Windows
711
+ pip install -r requirements.txt
712
+ ```
713
+
714
+ ### Debug Mode
715
+
716
+ Enable detailed logging to troubleshoot issues:
717
+
718
+ ```bash
719
+ python fusesell.py \
720
+ --openai-api-key "sk-proj-abc123" \
721
+ --org-id "test" \
722
+ --org-name "Test Company" \
723
+ --input-website "https://example.com" \
724
+ --log-level DEBUG \
725
+ --dry-run
726
+ ```
727
+
728
+ ### Dry Run Testing
729
+
730
+ Test the system without making API calls:
731
+
732
+ ```bash
733
+ python fusesell.py \
734
+ --openai-api-key "test-key" \
735
+ --org-id "test" \
736
+ --org-name "Test Company" \
737
+ --input-website "https://example.com" \
738
+ --dry-run
739
+ ```
740
+
741
+ **📚 Complete troubleshooting guide: [TROUBLESHOOTING.md](TROUBLESHOOTING.md)**
742
+
743
+ ## 🏆 Production Status
744
+
745
+ **FuseSell Local is 100% complete and production-ready!**
746
+
747
+ ### ✅ All Components Complete:
748
+
749
+ - **CLI Interface**: 25+ configuration options with comprehensive validation
750
+ - **Pipeline Engine**: Complete 5-stage orchestration with business logic
751
+ - **Data Layer**: SQLite database with full CRUD operations and event scheduling
752
+ - **AI Integration**: OpenAI GPT-4o-mini with structured response parsing
753
+ - **Stage Implementations**: All 5 stages production-ready (7,400+ lines of code)
754
+ - **Documentation**: Complete user guides, technical docs, and troubleshooting
755
+
756
+ ### ✅ Stage Implementation Status:
757
+
758
+ | Stage | Status | Lines | Key Features |
759
+ | -------------------- | ----------- | ------ | ---------------------------------------------- |
760
+ | **Data Acquisition** | ✅ Complete | 1,422 | Multi-source extraction, OCR, social media |
761
+ | **Data Preparation** | ✅ Complete | 1,201 | AI profiling, pain point analysis |
762
+ | **Lead Scoring** | ✅ Complete | 1,426 | Product-customer fit evaluation |
763
+ | **Initial Outreach** | ✅ Complete | 1,600+ | Intelligent email generation, draft management |
764
+ | **Follow-up** | ✅ Complete | 1,800+ | Context-aware sequences, interaction analysis |
765
+
766
+ ## 📁 Directory Structure
767
+
768
+ ```
769
+ fusesell-local/
770
+ ├── fusesell.py # Main CLI entry point
771
+ ├── requirements.txt # Python dependencies
772
+ ├── README.md # This file
773
+ ├── fusesell_local/ # Main package
774
+ │ ├── __init__.py
775
+ │ ├── pipeline.py # Pipeline orchestrator
776
+ │ ├── stages/ # Pipeline stages
777
+ │ │ ├── __init__.py
778
+ │ │ ├── base_stage.py # Base stage interface
779
+ │ │ ├── data_acquisition.py
780
+ │ │ ├── data_preparation.py
781
+ │ │ ├── lead_scoring.py
782
+ │ │ ├── initial_outreach.py
783
+ │ │ └── follow_up.py
784
+ │ ├── utils/ # Utilities
785
+ │ │ ├── __init__.py
786
+ │ │ ├── data_manager.py # SQLite database manager
787
+ │ │ ├── llm_client.py # OpenAI API client
788
+ │ │ ├── validators.py # Input validation
789
+ │ │ └── logger.py # Logging configuration
790
+ │ └── config/ # Configuration
791
+ │ └── __init__.py
792
+ └── fusesell_data/ # Local data storage
793
+ ├── config/ # Configuration files
794
+ │ ├── prompts.json # LLM prompts
795
+ │ ├── scoring_criteria.json
796
+ │ └── email_templates.json
797
+ ├── drafts/ # Generated email drafts
798
+ └── logs/ # Execution logs
799
+ ```
800
+
801
+ ## 🔒 Security & Privacy
802
+
803
+ - **Complete data ownership**: All customer data stays on your machine
804
+ - **API key security**: Keys are only used for LLM calls, never stored
805
+ - **Input validation**: Prevents injection attacks and validates all inputs
806
+ - **Local processing**: No external dependencies except for LLM API calls
807
+
808
+ ## 📚 Additional Documentation
809
+
810
+ ### User Documentation
811
+ - **[QUERYING_GUIDE.md](QUERYING_GUIDE.md)** - Managing multiple sales processes
812
+ - **[TROUBLESHOOTING.md](TROUBLESHOOTING.md)** - Common issues and solutions
813
+
814
+ ### Developer Documentation
815
+ - **[DEVELOPER_GUIDE.md](DEVELOPER_GUIDE.md)** - Customization and extension guide
816
+ - **[API_DOCUMENTATION.md](API_DOCUMENTATION.md)** - Technical API reference
817
+ - **[TECHNICAL.md](TECHNICAL.md)** - Architecture and technical details
818
+ - **[DATABASE.md](DATABASE.md)** - Database schema reference
819
+
820
+ ### Reference Documentation
821
+ - **[business_logic.md](business_logic.md)** - Business logic and orchestration rules
822
+ - **[CHANGELOG.md](CHANGELOG.md)** - Version history and updates
823
+
824
+ ## 🚀 Ready for Production Use
825
+
826
+ - **End-to-End Pipeline**: Complete sales automation workflow
827
+ - **Local Data Ownership**: Full privacy and control
828
+ - **AI-Powered Intelligence**: Personalized and context-aware
829
+ - **Integration Ready**: Database events for external app integration
830
+ - **Comprehensive Testing**: Dry-run mode and extensive error handling
831
+
832
+ ## 💡 Performance Tips
833
+
834
+ ### 1. Use Dry Run for Testing
835
+
836
+ Always test with `--dry-run` first to validate your configuration.
837
+
838
+ ### 2. Optimize API Usage
839
+
840
+ - Use appropriate `--llm-temperature` (0.2-0.8)
841
+ - Set reasonable `--llm-max-tokens` limits
842
+ - Consider stopping after specific stages for testing
843
+
844
+ ### 3. Batch Processing
845
+
846
+ For multiple leads, use different `--execution-id` values:
847
+
848
+ ```bash
849
+ python fusesell.py ... --execution-id "lead_001"
850
+ python fusesell.py ... --execution-id "lead_002"
851
+ ```
852
+
853
+ ### 4. Data Directory Management
854
+
855
+ Use custom data directories for different projects:
856
+
857
+ ```bash
858
+ python fusesell.py ... --data-dir "./project_a_data"
859
+ python fusesell.py ... --data-dir "./project_b_data"
860
+ ```
861
+
862
+ ## 🤝 Support
863
+
864
+ For issues, questions, or contributions:
865
+ - Check the troubleshooting guide for common issues
866
+ - Review the technical documentation for advanced usage
867
+ - Refer to the business logic documentation for workflow details
868
+ - Contact the development team for custom requirements
869
+
870
+ ---
871
+
872
+ **FuseSell Local - Complete AI Sales Automation, 100% Local, 100% Private** 🚀