monkeyspaw 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b67b97f684213086c17471f075dde93921f0d4a1eee84a45ced514c3898e8560
4
- data.tar.gz: 4cfab7ee1409f7c26b022ce5309c732b9926eb10b4e2ac0352463b011bb7d676
3
+ metadata.gz: 8917d88dcbb7e34b3be7316d861d2aaf07028260d3730bae77cd42ed612e9c51
4
+ data.tar.gz: 5b1a8a66500bc03e06768ebdbe33dc0b1472a1507d7f96623468389e2868a419
5
5
  SHA512:
6
- metadata.gz: a0c21ece19b4917de4efb25647f957e973eb9206c40bd5f5b46d1dc6f88f31cbc51dadcdeb9becedaddd4b13ce2568ce0e0ab362d87f3527992c5256df6f64be
7
- data.tar.gz: bf75e89ca31dc48dea52e2570d65cd97109239af28b4eb91d04fea4f07acd1a0b5d244221e126377126ba67d8c35a9d990679fc1d01d85688feaf467e306606c
6
+ metadata.gz: cca6f5c4eeea39c2bc5685fb72d0456daed0bba82a7c6c00fc5d6efef7453c5c7d562a94c3f7d2fb9db773807ca901487505efeb50a55436198f189e71a4e3ee
7
+ data.tar.gz: ca67bd7b528e6de78f77f08cd6558dfd49d048cdc3ef03e60059864f117277000169b7ddcd878d033a0ec82bb1c15ce14f20f02aa4a52aac3f16131bfe9c7162
data/README.md CHANGED
@@ -30,24 +30,50 @@ Or bind it directly:
30
30
  $ gem install monkeyspaw
31
31
  ```
32
32
 
33
- ## AI Provider
33
+ ## AI Provider Configuration
34
34
 
35
- MonkeysPaw is currently set up to only commune with Gemini by default. Other AI
36
- entities will be supported shortly.
35
+ MonkeysPaw can channel various AI entities to manifest your wishes. Configure your chosen provider:
37
36
 
38
- To use Gemini set up your environment variable:
37
+ ### Environment Variables
39
38
 
40
- OSX/Linux:
39
+ Set up your API keys based on your chosen provider:
40
+
41
+ MacOS/Linux:
41
42
  ```bash
42
43
  export GEMINI_API_KEY=your_gemini_api_key
44
+ export ANTHROPIC_API_KEY=your_anthropic_api_key
45
+ export OPENAI_API_KEY=your_openai_api_key
43
46
  ```
44
47
 
45
48
  Windows:
46
-
47
49
  ```bash
48
50
  Set-Item -Path env:GEMINI_API_KEY -Value "YourKeyHere"
51
+ Set-Item -Path env:ANTHROPIC_API_KEY -Value "YourKeyHere"
52
+ Set-Item -Path env:OPENAI_API_KEY -Value "YourKeyHere"
49
53
  ```
50
54
 
55
+ ### Selecting Your AI Provider
56
+
57
+ You can configure your AI provider in two ways:
58
+
59
+ **Method 1: Using the `use` method**
60
+ ```ruby
61
+ # Choose your entity and model
62
+ MonkeysPaw.use :gemini, model: 'your-gemini-model'
63
+ MonkeysPaw.use :claude, model: 'your-claude-model'
64
+ MonkeysPaw.use :openai, model: 'your-openai-model'
65
+ ```
66
+
67
+ **Method 2: Using the configure block**
68
+ ```ruby
69
+ MonkeysPaw.configure do |config|
70
+ config.ai_provider = :gemini # :gemini, :claude, or :openai
71
+ config.ai_model = 'your-model-name'
72
+ end
73
+ ```
74
+
75
+ Default provider is Gemini.
76
+
51
77
  ## Making Your First Wish
52
78
 
53
79
  Create a simple manifestation with just a few incantations:
@@ -119,28 +145,28 @@ Configure the terms of your pact:
119
145
 
120
146
  ```ruby
121
147
  MonkeysPaw.configure do |config|
148
+ # Server settings
122
149
  config.port = 4567
123
150
  config.host = 'localhost'
151
+
152
+ # AI provider settings
153
+ config.ai_provider = :gemini
154
+ config.ai_model = 'your-model-name'
155
+
156
+ # Caching (enabled by default)
157
+ config.caching_enabled = true # Set to false to disable caching
124
158
  end
125
159
  ```
126
160
 
127
- ## Mystical Entities Available for Summoning (TODO)
161
+ ## Available AI Providers
128
162
 
129
- MonkeysPaw can channel various AI entities:
163
+ MonkeysPaw supports multiple AI providers. Simply specify your provider and the model string that provider expects:
130
164
 
131
- ```ruby
132
- # The Gemini Spirit
133
- MonkeysPaw.use :gemini, model: :gemini_2_0_flash
134
-
135
- # The OpenAI Oracle
136
- MonkeysPaw.use :openai, model: :gpt_4
165
+ - **Gemini** - Google's AI models
166
+ - **Claude** - Anthropic's AI models
167
+ - **OpenAI** - OpenAI's GPT models
137
168
 
138
- # The Anthropic Sage
139
- MonkeysPaw.use :anthropic, model: :claude_3_opus
140
-
141
- # The Mistral Wind
142
- MonkeysPaw.use :mistral, model: :mistral_large
143
- ```
169
+ Each provider regularly updates their available models. Check your provider's documentation for the latest model identifiers.
144
170
 
145
171
  ## Words of Caution
146
172
 
@@ -33,6 +33,7 @@ module MonkeysPaw
33
33
 
34
34
  def pick_up!(**options)
35
35
  setup_directories
36
+ apply_ai_configuration
36
37
 
37
38
  @router ||= Router.new(self)
38
39
 
@@ -70,5 +71,21 @@ module MonkeysPaw
70
71
  dir.mkpath unless dir.exist?
71
72
  end
72
73
  end
74
+
75
+ def apply_ai_configuration
76
+ provider_class = case config.ai_provider
77
+ when :gemini, 'gemini'
78
+ Sublayer::Providers::Gemini
79
+ when :claude, 'claude', :anthropic, 'anthropic'
80
+ Sublayer::Providers::Claude
81
+ when :openai, 'openai'
82
+ Sublayer::Providers::OpenAI
83
+ else
84
+ raise "Unknown AI provider: #{config.ai_provider}"
85
+ end
86
+
87
+ Sublayer.configuration.ai_provider = provider_class
88
+ Sublayer.configuration.ai_model = config.ai_model
89
+ end
73
90
  end
74
91
  end
@@ -1,7 +1,7 @@
1
1
  module MonkeysPaw
2
2
  class Config
3
- attr_accessor :provider,
4
- :model,
3
+ attr_accessor :ai_provider,
4
+ :ai_model,
5
5
  :pages_dir,
6
6
  :components_dir,
7
7
  :assets_dir,
@@ -10,8 +10,8 @@ module MonkeysPaw
10
10
  :caching_enabled
11
11
 
12
12
  def initialize
13
- @provider = nil
14
- @model = nil
13
+ @ai_provider = :gemini
14
+ @ai_model = 'gemini-2.0-flash-exp'
15
15
  @pages_dir = 'wishes'
16
16
  @components_dir = 'components'
17
17
  @assets_dir = 'assets'
@@ -13,7 +13,7 @@ module MonkeysPaw
13
13
  def generate
14
14
  max_retries = 3
15
15
  retry_count = 0
16
-
16
+
17
17
  begin
18
18
  super
19
19
  rescue => e
@@ -58,14 +58,14 @@ module MonkeysPaw
58
58
  #{style_section}
59
59
 
60
60
  Take a deep breath and think step by step before you start coding. Ensure the HTML is well-formed and valid.
61
-
61
+
62
62
  The three components work together as follows:
63
63
  1. The page description provides the specific content and features this page should have
64
64
  2. The layout requirements define the structural organization and placement of elements
65
65
  3. The style guidelines inform the visual presentation and aesthetic choices
66
-
66
+
67
67
  Harmonize these elements to create a cohesive and effective web page that fulfills the intended purpose.
68
68
  PROMPT
69
69
  end
70
70
  end
71
- end
71
+ end
@@ -1,3 +1,3 @@
1
1
  module MonkeysPaw
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/monkeyspaw.rb CHANGED
@@ -11,9 +11,6 @@ require "monkeyspaw/cache_manager"
11
11
  Dir[File.expand_path("../monkeyspaw/generators/*.rb", __FILE__)].each { |f| require f }
12
12
 
13
13
  module MonkeysPaw
14
- Sublayer.configuration.ai_provider = Sublayer::Providers::Gemini
15
- Sublayer.configuration.ai_model = "gemini-2.0-flash"
16
-
17
14
  class << self
18
15
  def application
19
16
  @application ||= Application.new
@@ -23,6 +20,11 @@ module MonkeysPaw
23
20
  application.configure(&block)
24
21
  end
25
22
 
23
+ def use(provider, model: nil)
24
+ application.config.ai_provider = provider
25
+ application.config.ai_model = model if model
26
+ end
27
+
26
28
  def root
27
29
  application.root
28
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monkeyspaw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Werner
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  requirements: []
151
- rubygems_version: 3.6.7
151
+ rubygems_version: 3.6.9
152
152
  specification_version: 4
153
153
  summary: A prompt-driven web framework for Ruby - be careful what you wish for
154
154
  test_files: []