flowengine 0.3.0 → 0.4.0

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.
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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul
@@ -23,6 +23,48 @@ 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'
54
+ - !ruby/object:Gem::Dependency
55
+ name: zeitwerk
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
26
68
  - !ruby/object:Gem::Dependency
27
69
  name: rspec
28
70
  requirement: !ruby/object:Gem::Requirement
@@ -106,31 +148,41 @@ files:
106
148
  - ".env.example"
107
149
  - ".envrc"
108
150
  - ".rubocop_todo.yml"
151
+ - Brewfile
109
152
  - LICENSE.txt
110
153
  - README.md
111
154
  - Rakefile
155
+ - docs/PROJECT_STRUCTURE.md
112
156
  - docs/badges/coverage_badge.svg
113
- - docs/floweingine-architecture.png
157
+ - docs/flowengine-architecture.png
114
158
  - docs/flowengine-example.png
159
+ - docs/flowengine-processing.png
115
160
  - exe/flowengine
116
161
  - justfile
162
+ - lefthook.yml
117
163
  - lib/flowengine.rb
164
+ - lib/flowengine/clarification_result.rb
118
165
  - lib/flowengine/definition.rb
119
166
  - lib/flowengine/dsl.rb
120
167
  - lib/flowengine/dsl/flow_builder.rb
121
168
  - lib/flowengine/dsl/rule_helpers.rb
122
169
  - lib/flowengine/dsl/step_builder.rb
123
170
  - lib/flowengine/engine.rb
171
+ - lib/flowengine/engine/state_serializer.rb
124
172
  - lib/flowengine/errors.rb
125
173
  - lib/flowengine/evaluator.rb
126
174
  - lib/flowengine/graph/mermaid_exporter.rb
127
175
  - lib/flowengine/introduction.rb
128
176
  - lib/flowengine/llm.rb
129
177
  - lib/flowengine/llm/adapter.rb
130
- - lib/flowengine/llm/anthropic_adapter.rb
178
+ - lib/flowengine/llm/adapters.rb
179
+ - lib/flowengine/llm/adapters/anthropic_adapter.rb
180
+ - lib/flowengine/llm/adapters/gemini_adapter.rb
181
+ - lib/flowengine/llm/adapters/openai_adapter.rb
182
+ - lib/flowengine/llm/auto_client.rb
131
183
  - lib/flowengine/llm/client.rb
132
- - lib/flowengine/llm/gemini_adapter.rb
133
- - lib/flowengine/llm/openai_adapter.rb
184
+ - lib/flowengine/llm/intake_prompt_builder.rb
185
+ - lib/flowengine/llm/provider.rb
134
186
  - lib/flowengine/llm/sensitive_data_filter.rb
135
187
  - lib/flowengine/llm/system_prompt_builder.rb
136
188
  - lib/flowengine/node.rb
@@ -146,6 +198,7 @@ files:
146
198
  - lib/flowengine/validation/adapter.rb
147
199
  - lib/flowengine/validation/null_adapter.rb
148
200
  - lib/flowengine/version.rb
201
+ - resources/models.yml
149
202
  - resources/prompts/generic-dsl-intake.j2
150
203
  - sig/flowengine.rbs
151
204
  homepage: https://github.com/kigster/flowengine
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "ruby_llm"
4
-
5
- module FlowEngine
6
- module LLM
7
- # Anthropic adapter using the ruby_llm gem. Configures the API key
8
- # and delegates chat calls to RubyLLM's conversation interface.
9
- class AnthropicAdapter < Adapter
10
- DEFAULT_MODEL = "claude-sonnet-4-20250514"
11
-
12
- # @param api_key [String, nil] Anthropic API key; falls back to ANTHROPIC_API_KEY env var
13
- # @raise [LLMError] if no API key is available
14
- def initialize(api_key: nil)
15
- super()
16
- @api_key = api_key || ENV.fetch("ANTHROPIC_API_KEY", nil)
17
- raise LLMError, "Anthropic API key not provided and ANTHROPIC_API_KEY not set" unless @api_key
18
- end
19
-
20
- # @param system_prompt [String] system instructions
21
- # @param user_prompt [String] user's text
22
- # @param model [String] Anthropic model identifier
23
- # @return [String] response content from the LLM
24
- def chat(system_prompt:, user_prompt:, model: DEFAULT_MODEL)
25
- configure_ruby_llm!
26
- conversation = RubyLLM.chat(model: model)
27
- response = conversation.with_instructions(system_prompt).ask(user_prompt)
28
- response.content
29
- end
30
-
31
- private
32
-
33
- def configure_ruby_llm!
34
- RubyLLM.configure do |config|
35
- config.anthropic_api_key = @api_key
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "ruby_llm"
4
-
5
- module FlowEngine
6
- module LLM
7
- # Google Gemini adapter using the ruby_llm gem. Configures the API key
8
- # and delegates chat calls to RubyLLM's conversation interface.
9
- class GeminiAdapter < Adapter
10
- DEFAULT_MODEL = "gemini-2.0-flash"
11
-
12
- # @param api_key [String, nil] Gemini API key; falls back to GEMINI_API_KEY env var
13
- # @raise [LLMError] if no API key is available
14
- def initialize(api_key: nil)
15
- super()
16
- @api_key = api_key || ENV.fetch("GEMINI_API_KEY", nil)
17
- raise LLMError, "Gemini API key not provided and GEMINI_API_KEY not set" unless @api_key
18
- end
19
-
20
- # @param system_prompt [String] system instructions
21
- # @param user_prompt [String] user's text
22
- # @param model [String] Gemini model identifier
23
- # @return [String] response content from the LLM
24
- def chat(system_prompt:, user_prompt:, model: DEFAULT_MODEL)
25
- configure_ruby_llm!
26
- conversation = RubyLLM.chat(model: model)
27
- response = conversation.with_instructions(system_prompt).ask(user_prompt)
28
- response.content
29
- end
30
-
31
- private
32
-
33
- def configure_ruby_llm!
34
- RubyLLM.configure do |config|
35
- config.gemini_api_key = @api_key
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "ruby_llm"
4
-
5
- module FlowEngine
6
- module LLM
7
- # OpenAI adapter using the ruby_llm gem. Configures the API key
8
- # and delegates chat calls to RubyLLM's conversation interface.
9
- class OpenAIAdapter < Adapter
10
- # @param api_key [String, nil] OpenAI API key; falls back to OPENAI_API_KEY env var
11
- # @raise [LLMError] if no API key is available
12
- def initialize(api_key: nil)
13
- super()
14
- @api_key = api_key || ENV.fetch("OPENAI_API_KEY", nil)
15
- raise LLMError, "OpenAI API key not provided and OPENAI_API_KEY not set" unless @api_key
16
- end
17
-
18
- # @param system_prompt [String] system instructions
19
- # @param user_prompt [String] user's text
20
- # @param model [String] OpenAI model identifier
21
- # @return [String] response content from the LLM
22
- def chat(system_prompt:, user_prompt:, model: "gpt-4o-mini")
23
- configure_ruby_llm!
24
- conversation = RubyLLM.chat(model: model)
25
- response = conversation.with_instructions(system_prompt).ask(user_prompt)
26
- response.content
27
- end
28
-
29
- private
30
-
31
- def configure_ruby_llm!
32
- RubyLLM.configure do |config|
33
- config.openai_api_key = @api_key
34
- end
35
- end
36
- end
37
- end
38
- end