flowengine 0.3.1 → 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/Brewfile +28 -0
- data/README.md +348 -888
- data/docs/PROJECT_STRUCTURE.md +64 -0
- data/docs/flowengine-processing.png +0 -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/lefthook.yml +16 -0
- data/lib/flowengine/llm/adapters/anthropic_adapter.rb +17 -0
- data/lib/flowengine/llm/adapters/gemini_adapter.rb +17 -0
- data/lib/flowengine/llm/adapters/openai_adapter.rb +17 -0
- data/lib/flowengine/version.rb +1 -1
- metadata +43 -2
- /data/docs/{floweingine-architecture.png → flowengine-architecture.png} +0 -0
data/examples/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Examples from `bin/tax-estimate` script
|
|
2
|
+
|
|
3
|
+
This folder does not have examples of the DSL (for that see the
|
|
4
|
+
gem sources for `flowengine-cli`).
|
|
5
|
+
|
|
6
|
+
The script does not use the DSL and instead relies on a detailed system
|
|
7
|
+
prompt and an LLM to figure out what questions to answer, and uses
|
|
8
|
+
it's understanding of the TTY::Prompt library to turn questions into
|
|
9
|
+
ASCII-text based UI (TUI) type single/multi-select widgets, checkboxes
|
|
10
|
+
or radio buttons.
|
|
11
|
+
|
|
12
|
+
It's also an example of invoking LLM in a loop until the finishing
|
|
13
|
+
condition is satisfied.
|
|
14
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[
|
|
2
|
+
{"role":"llm","content":"What is your filing status?"},
|
|
3
|
+
{"role":"user","content":"Married Filing Jointly"},
|
|
4
|
+
{"role":"llm","content":"How many dependents are you claiming on your return?"},
|
|
5
|
+
{"role":"user","content":"1"},
|
|
6
|
+
{"role":"llm","content":"In how many states do you need to file a state tax return?"},
|
|
7
|
+
{"role":"user","content":"1 state"},
|
|
8
|
+
{"role":"llm","content":"What are your sources of income? (Select all that apply)"},
|
|
9
|
+
{"role":"user","content":["W-2 (wages from employer)"]},
|
|
10
|
+
{"role":"llm","content":"How many W-2s (employers) do you have in total between you and your spouse?"},
|
|
11
|
+
{"role":"user","content":"2"},
|
|
12
|
+
{"role":"llm","content":"Do you plan to itemize deductions, or will you take the standard deduction? Also, do you have any of the following credits or deductions? (Select all that apply)"},
|
|
13
|
+
{"role":"user","content":["Itemized deductions (mortgage interest, charitable contributions, etc.)","Child/dependent care credit"]},
|
|
14
|
+
{"role":"llm","content":"Do you have any of the following special situations? (Select all that apply)"},
|
|
15
|
+
{"role":"user","content":["Cryptocurrency transactions","Amended return needed"]},
|
|
16
|
+
{"role":"llm","content":"How would you describe your cryptocurrency transactions and records?"},
|
|
17
|
+
{"role":"user","content":"Moderate transactions (11-50), mostly organized"},
|
|
18
|
+
{"role":"llm","content":"Are you a new or returning client, and how would you describe the overall organization of your tax documents?"},
|
|
19
|
+
{"role":"user","content":"New client – documents somewhat disorganized"},
|
|
20
|
+
{"role":"llm","content":"Is there a deadline or rush requirement for your return?"},
|
|
21
|
+
{"role":"user","content":"No rush – standard timeline"}
|
|
22
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"role":"llm","content":"Let's start with the basics. What is your filing status?"},{"role":"user","content":"Single"},{"role":"llm","content":"How many dependents are you claiming on your return?"},{"role":"user","content":"0"},{"role":"llm","content":"How many states do you need to file a return in?"},{"role":"user","content":"1 state"},{"role":"llm","content":"How many W-2s do you have, and do you have any other sources of income? (Select all that apply)"},{"role":"user","content":["W-2 (one employer)"]},{"role":"llm","content":"Do you have any of the following deductions or special tax situations? (Select all that apply)"},{"role":"user","content":[]},{"role":"llm","content":"Almost done! Do you have any of the following special situations or circumstances?"},{"role":"user","content":[]}]
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
filing_status: Single
|
|
3
|
+
dependents: 0
|
|
4
|
+
states_required: 3 or more
|
|
5
|
+
|
|
6
|
+
income_sources:
|
|
7
|
+
w2s: Multiple W-2s (2–3 employers)
|
|
8
|
+
self_employment: Yes (Schedule C)
|
|
9
|
+
business_entity: S-Corp or Partnership (separate entity return required)
|
|
10
|
+
capital_gains_stocks: Yes
|
|
11
|
+
rsu_iso_espp: Yes
|
|
12
|
+
cryptocurrency: Yes
|
|
13
|
+
|
|
14
|
+
deductions_and_credits:
|
|
15
|
+
itemized_deductions: Yes (mortgage interest, charitable contributions, etc.)
|
|
16
|
+
business_expenses: Yes (home office, vehicle, meals, etc.)
|
|
17
|
+
foreign_income_or_accounts: Yes (FBAR / FATCA reporting required)
|
|
18
|
+
child_dependent_care_credits: Yes
|
|
19
|
+
irs_notices_or_amended_return: Yes
|
|
20
|
+
|
|
21
|
+
business_factors:
|
|
22
|
+
entity_type: S-Corp or Partnership
|
|
23
|
+
depreciation_schedule: Yes
|
|
24
|
+
high_transaction_volume: Yes (50+ transactions)
|
|
25
|
+
|
|
26
|
+
document_readiness:
|
|
27
|
+
records_status: Disorganized or incomplete (additional follow-up expected)
|
|
28
|
+
client_type: Not specified
|
|
29
|
+
|
|
30
|
+
complexity_assessment:
|
|
31
|
+
score: 9.5 / 10
|
|
32
|
+
rationale: >
|
|
33
|
+
This return is extremely complex. It involves multiple states (3+), a separate
|
|
34
|
+
S-Corp or Partnership entity return, self-employment with high transaction volume
|
|
35
|
+
and depreciation, stock compensation (RSUs/ISOs/ESPP), cryptocurrency transactions,
|
|
36
|
+
capital gains, foreign income/FBAR/FATCA obligations, itemized deductions, business
|
|
37
|
+
expenses, an IRS notice or amended return, and disorganized records requiring
|
|
38
|
+
significant additional follow-up. Nearly every complexity factor is present.
|
|
39
|
+
|
|
40
|
+
cost_estimate:
|
|
41
|
+
low: $4,500
|
|
42
|
+
high: $8,500
|
|
43
|
+
notes: >
|
|
44
|
+
The wide range reflects uncertainty due to disorganized records and the scope of
|
|
45
|
+
the S-Corp/Partnership entity return. The individual return alone (multi-state,
|
|
46
|
+
crypto, RSUs, FBAR, amended return) would typically run $2,500–$4,500. The
|
|
47
|
+
separate entity return (S-Corp or Partnership) adds $1,500–$3,000+. Disorganized
|
|
48
|
+
records and IRS notice resolution can add $500–$1,000 or more. Rush/deadline
|
|
49
|
+
fees may apply. A firm consultation is strongly recommended for a precise quote.
|
|
50
|
+
|
|
51
|
+
recommendations:
|
|
52
|
+
- Engage a CPA or tax attorney experienced in international tax and equity compensation.
|
|
53
|
+
- Organize all records (bank statements, brokerage 1099s, crypto transaction logs)
|
|
54
|
+
before the engagement to minimize billable hours.
|
|
55
|
+
- File for an extension if needed to avoid rush fees.
|
|
56
|
+
- Ensure FBAR (FinCEN 114) and Form 8938 deadlines are tracked separately.
|
|
57
|
+
- Confirm whether the S-Corp/Partnership requires its own extension and estimated
|
|
58
|
+
tax payments.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
client_profile:
|
|
3
|
+
filing_status: Single
|
|
4
|
+
dependents: 0
|
|
5
|
+
states_required: 1
|
|
6
|
+
|
|
7
|
+
income_sources:
|
|
8
|
+
w2_employers: 1
|
|
9
|
+
self_employment: false
|
|
10
|
+
rental_income: false
|
|
11
|
+
investment_income: false
|
|
12
|
+
retirement_distributions: false
|
|
13
|
+
foreign_income: false
|
|
14
|
+
|
|
15
|
+
deductions_and_credits:
|
|
16
|
+
itemized_deductions: false
|
|
17
|
+
business_expenses: false
|
|
18
|
+
education_credits: false
|
|
19
|
+
energy_credits: false
|
|
20
|
+
child_dependent_care_credits: false
|
|
21
|
+
|
|
22
|
+
special_situations:
|
|
23
|
+
stock_options: false
|
|
24
|
+
cryptocurrency: false
|
|
25
|
+
foreign_accounts: false
|
|
26
|
+
prior_year_carryforwards: false
|
|
27
|
+
amended_return: false
|
|
28
|
+
irs_notices: false
|
|
29
|
+
|
|
30
|
+
complexity_assessment:
|
|
31
|
+
score: 1
|
|
32
|
+
out_of: 10
|
|
33
|
+
rationale: >
|
|
34
|
+
This is a straightforward return. Single filer, no dependents, one W-2 from a
|
|
35
|
+
single employer, one state return, no itemized deductions, no special income
|
|
36
|
+
sources, and no special situations. This is about as simple as a tax return
|
|
37
|
+
can get.
|
|
38
|
+
|
|
39
|
+
cost_estimate:
|
|
40
|
+
low: $150
|
|
41
|
+
high: $300
|
|
42
|
+
average: $200
|
|
43
|
+
currency: USD
|
|
44
|
+
notes: >
|
|
45
|
+
Cost reflects a simple federal Form 1040 with a single W-2 and one state
|
|
46
|
+
return. Pricing may vary slightly based on the tax preparer's base rates and
|
|
47
|
+
whether the client is new or returning. Rush fees may apply if filing close
|
|
48
|
+
to the deadline.
|
|
49
|
+
|
|
50
|
+
estimated_time_to_complete: 1-2 hours
|
data/lefthook.yml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
pre-commit:
|
|
2
|
+
parallel: true
|
|
3
|
+
jobs:
|
|
4
|
+
- name: format
|
|
5
|
+
glob: "*.{js,ts,tsx}"
|
|
6
|
+
run: npx biome format --write {staged_files}
|
|
7
|
+
stage_fixed: true
|
|
8
|
+
|
|
9
|
+
- name: rubocop
|
|
10
|
+
glob: "*.{rb,rake}"
|
|
11
|
+
run: bundle exec rubocop -a --format progress {staged_files}
|
|
12
|
+
staged_fixed: true
|
|
13
|
+
|
|
14
|
+
- name: rspecs
|
|
15
|
+
glob: "spec/**/*_spec.rb"
|
|
16
|
+
run: bundle exec rspec --format progress
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module FlowEngine
|
|
4
|
+
module LLM
|
|
5
|
+
module Adapters
|
|
6
|
+
class AnthropicAdapter < Adapter
|
|
7
|
+
def self.api_key_var_name
|
|
8
|
+
"ANTHROPIC_API_KEY"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.default_model
|
|
12
|
+
"claude-sonnet-4-6"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module FlowEngine
|
|
4
|
+
module LLM
|
|
5
|
+
module Adapters
|
|
6
|
+
class GeminiAdapter < Adapter
|
|
7
|
+
def self.api_key_var_name
|
|
8
|
+
"GEMINI_API_KEY"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.default_model
|
|
12
|
+
"gemini-2.5-flash"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module FlowEngine
|
|
4
|
+
module LLM
|
|
5
|
+
module Adapters
|
|
6
|
+
class OpenAIAdapter < Adapter
|
|
7
|
+
def self.api_key_var_name
|
|
8
|
+
"OPENAI_API_KEY"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.default_model
|
|
12
|
+
"gpt-5-mini"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/flowengine/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: flowengine
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Konstantin Gredeskoul
|
|
@@ -23,6 +23,34 @@ dependencies:
|
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: tty-box
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: tty-prompt
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
26
54
|
- !ruby/object:Gem::Dependency
|
|
27
55
|
name: zeitwerk
|
|
28
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -120,14 +148,24 @@ files:
|
|
|
120
148
|
- ".env.example"
|
|
121
149
|
- ".envrc"
|
|
122
150
|
- ".rubocop_todo.yml"
|
|
151
|
+
- Brewfile
|
|
123
152
|
- LICENSE.txt
|
|
124
153
|
- README.md
|
|
125
154
|
- Rakefile
|
|
155
|
+
- docs/PROJECT_STRUCTURE.md
|
|
126
156
|
- docs/badges/coverage_badge.svg
|
|
127
|
-
- docs/
|
|
157
|
+
- docs/flowengine-architecture.png
|
|
128
158
|
- docs/flowengine-example.png
|
|
159
|
+
- docs/flowengine-processing.png
|
|
160
|
+
- docs/tty-prompt.md
|
|
161
|
+
- examples/README.md
|
|
162
|
+
- examples/chat_history__complex.yml
|
|
163
|
+
- examples/chat_history__simple.yml
|
|
164
|
+
- examples/final_estimate__complex.yml
|
|
165
|
+
- examples/final_estimate__simple.yml
|
|
129
166
|
- exe/flowengine
|
|
130
167
|
- justfile
|
|
168
|
+
- lefthook.yml
|
|
131
169
|
- lib/flowengine.rb
|
|
132
170
|
- lib/flowengine/clarification_result.rb
|
|
133
171
|
- lib/flowengine/definition.rb
|
|
@@ -144,6 +182,9 @@ files:
|
|
|
144
182
|
- lib/flowengine/llm.rb
|
|
145
183
|
- lib/flowengine/llm/adapter.rb
|
|
146
184
|
- lib/flowengine/llm/adapters.rb
|
|
185
|
+
- lib/flowengine/llm/adapters/anthropic_adapter.rb
|
|
186
|
+
- lib/flowengine/llm/adapters/gemini_adapter.rb
|
|
187
|
+
- lib/flowengine/llm/adapters/openai_adapter.rb
|
|
147
188
|
- lib/flowengine/llm/auto_client.rb
|
|
148
189
|
- lib/flowengine/llm/client.rb
|
|
149
190
|
- lib/flowengine/llm/intake_prompt_builder.rb
|
|
File without changes
|