flowengine 0.4.0 → 0.4.1
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.
- checksums.yaml +4 -4
- data/.envrc +1 -0
- data/README.md +86 -0
- data/docs/tty-prompt.md +1746 -0
- data/examples/README.md +14 -0
- data/examples/chat_history__complex.yml +22 -0
- data/examples/chat_history__simple.yml +1 -0
- data/examples/final_estimate__complex.yml +58 -0
- data/examples/final_estimate__simple.yml +50 -0
- data/lib/flowengine/version.rb +1 -1
- metadata +7 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 44af196ec2b3b9611c304c0ad30c8bbd600d679657e9e91990a17c23a10ca13c
|
|
4
|
+
data.tar.gz: 69234ea59516677cde345b7e90fd2f253b98819e1d07c8c0286cf3ffc9c4a2bd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 05d907c2ddac65e926e3685030738e21043c685193bd0cf62f36612686a28be9a8028e0eef0cd9edf4548e0617f7d0cc74ee0a2fe5d03df7a2138c19cf38a894
|
|
7
|
+
data.tar.gz: 4a7d114b6507dae87bbcc760308d4af32eff632aad373d409869f9a04fe114e9c40e9881d0135f2c925389a25bff5ab7812bf58166727fdf7596bf16af404551
|
data/.envrc
CHANGED
data/README.md
CHANGED
|
@@ -485,6 +485,92 @@ The core has **zero UI logic**, **zero DB logic**, and **zero framework dependen
|
|
|
485
485
|
| `LLM::SensitiveDataFilter` | Rejects text containing SSN, ITIN, EIN patterns |
|
|
486
486
|
| `Graph::MermaidExporter` | Exports flow as a Mermaid diagram |
|
|
487
487
|
|
|
488
|
+
## Beyond the DSL: LLM-Driven Tools
|
|
489
|
+
|
|
490
|
+
The declarative DSL is the primary way to define flows, but it is not the only way to use FlowEngine. The gem's LLM integration layer — adapters, client, and sensitive data filter — can power conversational tools that don't use the DSL at all.
|
|
491
|
+
|
|
492
|
+
### `bin/tax-estimate` (Experimental)
|
|
493
|
+
|
|
494
|
+
An interactive CLI tool that estimates tax return complexity and preparation cost entirely through LLM-driven conversation. Instead of defining steps in the DSL, the LLM decides what to ask, generates Ruby code for rich terminal prompts (`TTY::Prompt`), and produces a final YAML estimate when it has enough information.
|
|
495
|
+
|
|
496
|
+
```bash
|
|
497
|
+
bin/tax-estimate
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
How it works:
|
|
501
|
+
|
|
502
|
+
1. A system prompt describes tax complexity factors (filing status, income sources, deductions, special situations)
|
|
503
|
+
2. The LLM returns JSON containing a natural-language question and a `question_eval` field with Ruby code that uses `TTY::Prompt` for multi-select, radio buttons, text input, etc.
|
|
504
|
+
3. The generated code is evaluated to collect the user's answer, which is appended to the chat history
|
|
505
|
+
4. The loop continues until the LLM produces a `final_estimate` — a YAML object with complexity score, cost range, and explanation
|
|
506
|
+
|
|
507
|
+
This approach trades the safety and predictability of a predefined flow graph for maximum flexibility — the LLM adapts its questions based on prior answers without any step definitions.
|
|
508
|
+
|
|
509
|
+
```ruby
|
|
510
|
+
# The only FlowEngine dependency is the LLM client
|
|
511
|
+
client = FlowEngine::LLM.auto_client
|
|
512
|
+
response = client.adapter.chat(
|
|
513
|
+
system_prompt: tax_system_prompt,
|
|
514
|
+
user_prompt: "Chat history: #{chat_history.to_json}",
|
|
515
|
+
model: client.model
|
|
516
|
+
)
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
Here is an example of the final YAML estimate for a simple single-filer return:
|
|
520
|
+
|
|
521
|
+
```yaml
|
|
522
|
+
---
|
|
523
|
+
client_profile:
|
|
524
|
+
filing_status: Single
|
|
525
|
+
dependents: 0
|
|
526
|
+
states_required: 1
|
|
527
|
+
|
|
528
|
+
income_sources:
|
|
529
|
+
w2_employers: 1
|
|
530
|
+
self_employment: false
|
|
531
|
+
rental_income: false
|
|
532
|
+
investment_income: false
|
|
533
|
+
retirement_distributions: false
|
|
534
|
+
foreign_income: false
|
|
535
|
+
|
|
536
|
+
deductions_and_credits:
|
|
537
|
+
itemized_deductions: false
|
|
538
|
+
business_expenses: false
|
|
539
|
+
education_credits: false
|
|
540
|
+
energy_credits: false
|
|
541
|
+
child_dependent_care_credits: false
|
|
542
|
+
|
|
543
|
+
special_situations:
|
|
544
|
+
stock_options: false
|
|
545
|
+
cryptocurrency: false
|
|
546
|
+
foreign_accounts: false
|
|
547
|
+
prior_year_carryforwards: false
|
|
548
|
+
amended_return: false
|
|
549
|
+
irs_notices: false
|
|
550
|
+
|
|
551
|
+
complexity_assessment:
|
|
552
|
+
score: 1
|
|
553
|
+
out_of: 10
|
|
554
|
+
rationale: >
|
|
555
|
+
This is a straightforward return. Single filer, no dependents,
|
|
556
|
+
one W-2 from a single employer, one state return, no itemized
|
|
557
|
+
deductions, no special income sources, and no special situations.
|
|
558
|
+
|
|
559
|
+
cost_estimate:
|
|
560
|
+
low: $150
|
|
561
|
+
high: $300
|
|
562
|
+
average: $200
|
|
563
|
+
currency: USD
|
|
564
|
+
notes: >
|
|
565
|
+
Cost reflects a simple federal Form 1040 with a single W-2 and
|
|
566
|
+
one state return. Rush fees may apply if filing close to the
|
|
567
|
+
deadline.
|
|
568
|
+
|
|
569
|
+
estimated_time_to_complete: 1-2 hours
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
See `examples/` for more sample outputs including complex multi-income scenarios.
|
|
573
|
+
|
|
488
574
|
## Ecosystem
|
|
489
575
|
|
|
490
576
|
| Gem | Purpose |
|