ad-agent_architecture 0.0.16 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36f0e448c4167f6005e670d87536fdbf51664be35644e7ec667e1a547f49d54b
4
- data.tar.gz: 2b7dc92027c5e36c3dfc64fa4334e5c929b30964d5543a45a34cb7a438898f81
3
+ metadata.gz: dac798e05760933625c449dbe26204f844588554476dd8d6ce32c443081881a9
4
+ data.tar.gz: 6b3fb54a748dbcf5a33b56e6de0c80b910ea429f67e31fbeaf7bf46c7dbb1de8
5
5
  SHA512:
6
- metadata.gz: c66c9313f00f3ef147c522dc53f986a22fdca14fdce46edca9b29bed5a3afce18b755c0984bc2b55b04839e36060c1cf0161fd457ee9f078e899d235bc974f32
7
- data.tar.gz: 53456edd88e0673b80e49625631baf52b96ec394f24c2aa1efc4b350716c401a7e69fba5d0e5462a6406c09481fe2b2ae77be5c88ad32425cfadf3dfd843c1e0
6
+ metadata.gz: 7b959b1130a64ef8956c35e98745bea434b6639b04c5796e53cb6ba8d91f2871377e45d5a439f024c0236e31d367d8d21ad3622b9641b8c5ad4eb4bddafafe34
7
+ data.tar.gz: b1d59d4aa15a2b85005c50098d42fef5d2ce32b08cb2b19183df0bc8f7e7f8299f8fb1a8bab311b329818c9f0679f95965fd8c3efc236561d27c7da2d47a8501
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [0.0.17](https://github.com/appydave/ad-agent_architecture/compare/v0.0.16...v0.0.17) (2024-07-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * cops ([36d85fc](https://github.com/appydave/ad-agent_architecture/commit/36d85fc622eaf609c12bbf2c2d81fd25daa17915))
7
+ * update project plan ([eaf460d](https://github.com/appydave/ad-agent_architecture/commit/eaf460d5c12ec1383f47fd38ab76135f3d844b54))
8
+
9
+ ## [0.0.16](https://github.com/appydave/ad-agent_architecture/compare/v0.0.15...v0.0.16) (2024-07-03)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * update project plan ([d7591e2](https://github.com/appydave/ad-agent_architecture/commit/d7591e2332aa659961cc5ddc30fec95f772f588e))
15
+
1
16
  ## [0.0.15](https://github.com/appydave/ad-agent_architecture/compare/v0.0.14...v0.0.15) (2024-07-03)
2
17
 
3
18
 
@@ -38,21 +38,21 @@ module Ad
38
38
  end
39
39
 
40
40
  def save
41
- Ad::AgentArchitecture::Dsl::Actions::SaveDatabase.new(@workflow.workflow).save
41
+ Ad::AgentArchitecture::Dsl::Actions::SaveDatabase.new(@workflow.data).save
42
42
 
43
43
  self
44
44
  end
45
45
 
46
46
  def save_json(file_name = nil)
47
47
  full_file_name = file_name || 'workflow.json'
48
- Ad::AgentArchitecture::Dsl::Actions::SaveJson.new(@workflow.workflow).save(full_file_name)
48
+ Ad::AgentArchitecture::Dsl::Actions::SaveJson.new(@workflow.data).save(full_file_name)
49
49
 
50
50
  self
51
51
  end
52
52
 
53
53
  def save_yaml(file_name = nil)
54
54
  full_file_name = file_name || 'workflow.yaml'
55
- Ad::AgentArchitecture::Dsl::Actions::SaveYaml.new(@workflow.workflow).save(full_file_name)
55
+ Ad::AgentArchitecture::Dsl::Actions::SaveYaml.new(@workflow.data).save(full_file_name)
56
56
 
57
57
  self
58
58
  end
@@ -8,17 +8,17 @@ module Ad
8
8
  def attribute(name, type:, is_array: false)
9
9
  raise ArgumentError, 'Attribute name must be a string or symbol' unless name.is_a?(String) || name.is_a?(Symbol)
10
10
 
11
- workflow[:attributes][name] = { name: name, type: type, is_array: is_array }
11
+ attributes[name] = { name: name, type: type, is_array: is_array }
12
12
  end
13
13
 
14
14
  def infer_attribute(name)
15
15
  raise ArgumentError, 'Attribute name must be a string or symbol' unless name.is_a?(String) || name.is_a?(Symbol)
16
16
 
17
- return if workflow[:attributes].key?(name)
17
+ return if attributes.key?(name)
18
18
 
19
19
  # May want to add more sophisticated type inference here
20
20
  type = name.to_s.end_with?('s') ? 'array' : 'string'
21
- workflow[:attributes][name] = { name: name, type: type, is_array: type == 'array' }
21
+ attributes[name] = { name: name, type: type, is_array: type == 'array' }
22
22
  end
23
23
  end
24
24
  end
@@ -5,10 +5,15 @@ module Ad
5
5
  module Dsl
6
6
  # This is the base class for all child DSLs
7
7
  class ChildDsl
8
+ include DataAccessors
8
9
  attr_reader :workflow
9
10
 
10
- def initialize(workflow)
11
- @workflow = workflow
11
+ def initialize(workflow_dsl)
12
+ @workflow = workflow_dsl
13
+ end
14
+
15
+ def data
16
+ @workflow.data
12
17
  end
13
18
  end
14
19
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ad
4
+ module AgentArchitecture
5
+ module Dsl
6
+ # Helper methods for accessing data in the workflow DSL
7
+ module DataAccessors
8
+ def settings
9
+ data[:settings]
10
+ end
11
+
12
+ def sections
13
+ data[:sections]
14
+ end
15
+
16
+ def get_setting(name)
17
+ settings[name.to_sym] || settings[name.to_s]
18
+ end
19
+
20
+ def attributes
21
+ data[:attributes]
22
+ end
23
+
24
+ def get_attribute(name)
25
+ attributes[name.to_sym] || attributes[name.to_s]
26
+ end
27
+
28
+ def prompts
29
+ data[:prompts]
30
+ end
31
+
32
+ def get_prompt(name)
33
+ prompts[name.to_sym] || prompts[name.to_s]
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -8,11 +8,11 @@ module Ad
8
8
  def prompt(name, path: nil, content: nil)
9
9
  raise ArgumentError, 'Prompt name must be a string or symbol' unless name.is_a?(String) || name.is_a?(Symbol)
10
10
 
11
- workflow[:prompts][name] = { name: name, content: content }
11
+ prompts[name] = { name: name, content: content }
12
12
  end
13
13
 
14
14
  def prompt_file(file)
15
- prompt_path = workflow[:settings][:prompt_path]
15
+ prompt_path = settings[:prompt_path]
16
16
  raise 'Prompt path not defined in settings. Set "prompt_path" to the path where you are keping prompts' unless prompt_path
17
17
 
18
18
  full_path = File.join(prompt_path, file)
@@ -9,7 +9,7 @@ module Ad
9
9
  super(workflow)
10
10
 
11
11
  @section = { name: name, order: order, steps: [] }
12
- @workflow[:sections] << @section
12
+ sections << @section
13
13
  @current_step_order = 1
14
14
  end
15
15
 
@@ -7,7 +7,7 @@ module Ad
7
7
  class SettingsDsl < ChildDsl
8
8
  def method_missing(name, *args, &block)
9
9
  if args.length == 1 && block.nil?
10
- workflow[:settings][name] = args.first
10
+ data[:settings][name] = args.first
11
11
  else
12
12
  super
13
13
  end
@@ -35,6 +35,7 @@ module Ad
35
35
  end
36
36
 
37
37
  def prompt(prompt, **_opts)
38
+ # lookup_prompt = workflow.get_prompt(prompt)
38
39
  @step[:prompt] = prompt
39
40
  end
40
41
 
@@ -5,33 +5,35 @@ module Ad
5
5
  module Dsl
6
6
  # This class is responsible for defining the workflow DSL
7
7
  class WorkflowDsl
8
- attr_reader :workflow
8
+ include DataAccessors
9
+
10
+ attr_reader :data
9
11
 
10
12
  def initialize(name)
11
- @workflow = { name: name, sections: [], attributes: {}, prompts: {}, settings: {} }
13
+ @data = { name: name, sections: [], attributes: {}, prompts: {}, settings: {} }
12
14
  @current_section_order = 1
13
15
  end
14
16
 
15
17
  def settings(&block)
16
- dsl = SettingsDsl.new(@workflow)
18
+ dsl = SettingsDsl.new(self)
17
19
  dsl.instance_eval(&block) if block_given?
18
20
  dsl
19
21
  end
20
22
 
21
23
  def attributes(&block)
22
- dsl = AttributeDsl.new(@workflow)
24
+ dsl = AttributeDsl.new(self)
23
25
  dsl.instance_eval(&block) if block_given?
24
26
  dsl
25
27
  end
26
28
 
27
29
  def prompts(&block)
28
- dsl = PromptDsl.new(@workflow)
30
+ dsl = PromptDsl.new(self)
29
31
  dsl.instance_eval(&block) if block_given?
30
32
  dsl
31
33
  end
32
34
 
33
35
  def section(name, &block)
34
- dsl = SectionDsl.new(@workflow, name, @current_section_order)
36
+ dsl = SectionDsl.new(self, name, @current_section_order)
35
37
  @current_section_order += 1
36
38
  dsl.instance_eval(&block) if block_given?
37
39
  dsl
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ad
4
4
  module AgentArchitecture
5
- VERSION = '0.0.16'
5
+ VERSION = '0.0.18'
6
6
  end
7
7
  end
@@ -13,6 +13,7 @@ Ad::AgentArchitecture::Database::CreateSchema.new(DB).execute
13
13
 
14
14
  require 'ad/agent_architecture/database/models'
15
15
  require 'ad/agent_architecture/database/sql_query'
16
+ require 'ad/agent_architecture/dsl/data_accessors'
16
17
  require 'ad/agent_architecture/dsl/child_dsl'
17
18
  require 'ad/agent_architecture/dsl/attribute_dsl'
18
19
  require 'ad/agent_architecture/dsl/prompt_dsl'
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "ad-agent_architecture",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "ad-agent_architecture",
9
- "version": "0.0.16",
9
+ "version": "0.0.18",
10
10
  "devDependencies": {
11
11
  "@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
12
12
  "@semantic-release/changelog": "^6.0.3",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ad-agent_architecture",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "Architecture/Schema for AI Agents",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ad-agent_architecture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-03 00:00:00.000000000 Z
11
+ date: 2024-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: k_log
@@ -96,6 +96,7 @@ files:
96
96
  - lib/ad/agent_architecture/dsl/agent_dsl.rb
97
97
  - lib/ad/agent_architecture/dsl/attribute_dsl.rb
98
98
  - lib/ad/agent_architecture/dsl/child_dsl.rb
99
+ - lib/ad/agent_architecture/dsl/data_accessors.rb
99
100
  - lib/ad/agent_architecture/dsl/prompt_dsl.rb
100
101
  - lib/ad/agent_architecture/dsl/section_dsl.rb
101
102
  - lib/ad/agent_architecture/dsl/settings_dsl.rb