Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,7 @@ cython_debug/
Pipfile
/testing
*.lock
examples/.DS_Store
process_builder.py.backup
src/.DS_Store
src/processbuilder/.DS_Store
47 changes: 45 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,42 @@ A tool for building structured process definitions through interactive interview
- Editing existing steps
- Adding new steps
- Managing process flow
- Debug and verbose mode:
- Toggle detailed logging for troubleshooting
- View OpenAI API responses and request details
- Monitor API key validation and warnings

## Configuration

### Verbose Mode

Process Builder includes a verbose mode for detailed logging and debugging:

```python
# Enable verbose mode at the class level
from processbuilder import ProcessBuilder
ProcessBuilder.set_verbose_mode(True)

# Enable verbose mode for a specific instance
builder = ProcessBuilder("My Process", verbose=True)
```

When verbose mode is enabled:

- Debug-level logs are displayed, showing detailed process information
- OpenAI API request and response details are logged
- Warning messages are always displayed regardless of verbose mode
- API key validation is logged and visible in the console

Example debug output with verbose mode enabled:

```
DEBUG - ProcessBuilder initialized with verbose=True
WARNING - No OpenAI API key found. AI features will be disabled.
DEBUG - Warning about missing API key has been logged
DEBUG - Sending OpenAI prompt for first step suggestion
DEBUG - Received OpenAI first step suggestion: 'Collect Customer Information'
```

## Installation

Expand All @@ -35,11 +71,14 @@ pip install processbuilder

1. Run the process builder:
```bash
# Basic usage
processbuilder

# Run with verbose mode enabled
processbuilder --verbose
```

2. Enter the process name when prompted.

3. For each step, you'll be guided through:
- Step title (with AI suggestion for first step)
- Step description (with AI suggestion)
Expand Down Expand Up @@ -111,7 +150,11 @@ The process flow is validated after each edit to ensure consistency.

2. Run the process builder with CSV files:
```bash
# Basic import
processbuilder --steps-csv path/to/steps.csv --notes-csv path/to/notes.csv

# Import with verbose mode enabled
processbuilder --steps-csv path/to/steps.csv --notes-csv path/to/notes.csv --verbose
```

3. The process will be loaded and you'll enter the interactive menu where you can:
Expand Down Expand Up @@ -169,12 +212,12 @@ Common error codes include:
- RETRY_EXCEEDED

## Dependencies

- Python 3.8+
- OpenAI API (for AI suggestions)
- python-dotenv (for environment variables)
- pandas (for CSV handling)
- mermaid-cli (for diagram generation)
- logging (for verbose mode and debug output)

## License

Expand Down
Binary file modified examples/.DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions examples/make_a_sandwich/process_notes.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Note ID,Content,Related Step ID
Note1,"For a basic sandwich gather: 2 slices bread (white or wheat), 1-2 slices cheese (cheddar recommended), 2-3 leaves of fresh lettuce, 2-3 slices of tomato, mayo and mustard. Optional: deli meat ham or turkey, salt and pepper to taste.",Gather Ingredients
Note2,"To save time check multiple nearby stores with online inventory tools before leaving. Focus on supermarkets rather than convenience stores for better quality and selection. Consider frozen bread as a backup option if fresh bread is unavailable.",Go to Store
Note3,"Fresh bread should be soft to touch without visible mold spots. Check the expiration date on the packaging. Store bread properly (sealed tight in cool dry place) to maintain freshness longer. If bread is slightly stale but not moldy, toasting can improve texture.",Check Bread Freshness
Note4,"The optimal layering order: bread slice → condiments → cheese → meat (if using) → lettuce → tomato → condiments → bread slice. This prevents soggy bread by creating barriers between moisture-heavy ingredients and the bread. Pat tomato slices dry with paper towel before adding.",Add Main Ingredients
Note5,"Professional presentation includes: diagonal cut which displays layers attractively, arrangement on a clean plate with garnish (pickle spear, chips, or small side salad), wiping any drips from plate edges, and ensuring all layers are visible from the side. Consider a sandwich pick to hold taller sandwiches together.",Serve Sandwich
16 changes: 16 additions & 0 deletions examples/make_a_sandwich/process_steps.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Step ID,Description,Decision,Success Outcome,Failure Outcome,Linked Note ID,Next Step (Success),Next Step (Failure),Validation Rules,Error Codes,Retry Logic
Gather Ingredients,Check if all required ingredients are available,Are all ingredients available?,All ingredients are ready for sandwich preparation,Missing one or more ingredients,Note1,Check Bread Freshness,Go to Store,Verify bread slices (2), cheese slices (1), lettuce, tomato, mayo, mustard,ERR-001: Missing ingredients,None
Go to Store,Go to the nearest store to purchase missing ingredients,Were you able to purchase all missing ingredients?,All ingredients acquired and ready for sandwich preparation,Could not find all ingredients,Note2,Check Bread Freshness,End,Ensure store has fresh produce section,ERR-002: Store inventory issue,Try different store if first attempt fails
Check Bread Freshness,Examine bread to ensure it's fresh,Is the bread fresh and without mold?,Bread is suitable for sandwich making,Bread is stale or moldy,Note3,Prepare Base,Replace Bread,Visual inspection and smell test; bread should be soft without discoloration,ERR-003: Bread quality issue,None
Replace Bread,Get new bread from pantry or store,Was fresh bread obtained?,Fresh bread acquired,No fresh bread available,None,Prepare Base,End,Verify bread is within expiration date,ERR-004: No backup bread available,Check other types of bread as alternative
Prepare Base,Apply condiments to bread slices,Are condiments spread evenly?,Base is ready for ingredients,Condiments application failed,None,Add Main Ingredients,Clean Up and Restart,Even coverage on bread; appropriate amount without saturation,ERR-005: Excessive condiment application,Scrape excess condiment if needed
Add Main Ingredients,Layer cheese lettuce and tomato on bread,Are ingredients arranged properly?,Ingredients added in optimal order,Ingredients poorly arranged or falling out,Note4,Final Assembly,Rearrange Ingredients,Cheese should touch bread; lettuce provides barrier between bread and tomatoes,ERR-006: Structural integrity issue,Adjust ingredient placement
Rearrange Ingredients,Fix the arrangement of ingredients,Is the arrangement now stable?,Ingredients properly arranged,Cannot achieve stable arrangement,None,Final Assembly,Start Over,Ensure even distribution and proper layering,ERR-007: Unstable ingredient structure,Maximum 2 attempts before starting over
Final Assembly,Place top slice of bread and press gently,Is the sandwich properly assembled?,Sandwich is complete and stable,Sandwich falls apart,None,Cut Sandwich,Fix Assembly,Bread aligns properly with even pressure applied,ERR-008: Assembly failure,Try once more with gentler pressure
Fix Assembly,Readjust the sandwich components,Is the sandwich now stable?,Sandwich successfully reassembled,Cannot stabilize the sandwich,None,Cut Sandwich,Start Over,Check for protruding ingredients; ensure even distribution,ERR-009: Persistent assembly issue,Maximum 1 attempt
Cut Sandwich,Cut sandwich diagonally or straight across,Is the cut clean and even?,Sandwich cut successfully,Cut is uneven or sandwich structure compromised,None,Serve Sandwich,Adjust Cut,Use sharp knife and moderate pressure,ERR-010: Cutting error,Try different knife if available
Adjust Cut,Realign the sandwich and make a new cut,Is the new cut acceptable?,Cut is acceptable,Cut still problematic,None,Serve Sandwich,Serve Sandwich Uncut,Use sawing motion rather than pressing,ERR-011: Secondary cutting error,None
Serve Sandwich,Place sandwich on plate with presentation,Is the presentation appetizing?,Sandwich served successfully,Presentation needs improvement,Note5,End,Improve Presentation,Centered on plate with any extras (chips/pickle) arranged neatly,ERR-012: Presentation issue,None
Improve Presentation,Adjust the appearance and plating,Is the appearance now satisfactory?,Presentation successfully improved,Cannot achieve desired presentation,None,End,End,Ensure clean plate edges; consider garnish,ERR-013: Persistent presentation issue,None
Start Over,Discard current attempt and restart process,Decision to restart confirmed?,Process restarted with fresh ingredients,Too many ingredients wasted,None,Gather Ingredients,End,Evaluate cost/benefit of starting over vs. serving imperfect sandwich,ERR-014: Resource waste concern,None

Loading