activeagent 0.6.3 → 1.0.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.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +240 -2
  3. data/README.md +15 -24
  4. data/lib/active_agent/base.rb +389 -39
  5. data/lib/active_agent/concerns/callbacks.rb +251 -0
  6. data/lib/active_agent/concerns/observers.rb +147 -0
  7. data/lib/active_agent/concerns/parameterized.rb +292 -0
  8. data/lib/active_agent/concerns/provider.rb +120 -0
  9. data/lib/active_agent/concerns/queueing.rb +36 -0
  10. data/lib/active_agent/concerns/rescue.rb +64 -0
  11. data/lib/active_agent/concerns/streaming.rb +282 -0
  12. data/lib/active_agent/concerns/tooling.rb +23 -0
  13. data/lib/active_agent/concerns/view.rb +150 -0
  14. data/lib/active_agent/configuration.rb +442 -20
  15. data/lib/active_agent/generation.rb +141 -47
  16. data/lib/active_agent/providers/_base_provider.rb +420 -0
  17. data/lib/active_agent/providers/anthropic/_types.rb +63 -0
  18. data/lib/active_agent/providers/anthropic/options.rb +53 -0
  19. data/lib/active_agent/providers/anthropic/request.rb +163 -0
  20. data/lib/active_agent/providers/anthropic/transforms.rb +353 -0
  21. data/lib/active_agent/providers/anthropic_provider.rb +254 -0
  22. data/lib/active_agent/providers/common/messages/_types.rb +160 -0
  23. data/lib/active_agent/providers/common/messages/assistant.rb +57 -0
  24. data/lib/active_agent/providers/common/messages/base.rb +17 -0
  25. data/lib/active_agent/providers/common/messages/system.rb +20 -0
  26. data/lib/active_agent/providers/common/messages/tool.rb +21 -0
  27. data/lib/active_agent/providers/common/messages/user.rb +20 -0
  28. data/lib/active_agent/providers/common/model.rb +361 -0
  29. data/lib/active_agent/providers/common/response.rb +13 -0
  30. data/lib/active_agent/providers/common/responses/_types.rb +51 -0
  31. data/lib/active_agent/providers/common/responses/base.rb +199 -0
  32. data/lib/active_agent/providers/common/responses/embed.rb +33 -0
  33. data/lib/active_agent/providers/common/responses/format.rb +31 -0
  34. data/lib/active_agent/providers/common/responses/message.rb +3 -0
  35. data/lib/active_agent/providers/common/responses/prompt.rb +42 -0
  36. data/lib/active_agent/providers/common/usage.rb +385 -0
  37. data/lib/active_agent/providers/concerns/exception_handler.rb +72 -0
  38. data/lib/active_agent/providers/concerns/instrumentation.rb +263 -0
  39. data/lib/active_agent/providers/concerns/previewable.rb +150 -0
  40. data/lib/active_agent/providers/log_subscriber.rb +178 -0
  41. data/lib/active_agent/providers/mock/_types.rb +77 -0
  42. data/lib/active_agent/providers/mock/embedding_request.rb +17 -0
  43. data/lib/active_agent/providers/mock/messages/_types.rb +103 -0
  44. data/lib/active_agent/providers/mock/messages/assistant.rb +26 -0
  45. data/lib/active_agent/providers/mock/messages/base.rb +63 -0
  46. data/lib/active_agent/providers/mock/messages/user.rb +18 -0
  47. data/lib/active_agent/providers/mock/options.rb +30 -0
  48. data/lib/active_agent/providers/mock/request.rb +38 -0
  49. data/lib/active_agent/providers/mock_provider.rb +311 -0
  50. data/lib/active_agent/providers/ollama/_types.rb +5 -0
  51. data/lib/active_agent/providers/ollama/chat/_types.rb +44 -0
  52. data/lib/active_agent/providers/ollama/chat/request.rb +249 -0
  53. data/lib/active_agent/providers/ollama/chat/transforms.rb +135 -0
  54. data/lib/active_agent/providers/ollama/embedding/_types.rb +44 -0
  55. data/lib/active_agent/providers/ollama/embedding/request.rb +190 -0
  56. data/lib/active_agent/providers/ollama/embedding/transforms.rb +160 -0
  57. data/lib/active_agent/providers/ollama/options.rb +27 -0
  58. data/lib/active_agent/providers/ollama_provider.rb +94 -0
  59. data/lib/active_agent/providers/open_ai/_base.rb +59 -0
  60. data/lib/active_agent/providers/open_ai/_types.rb +5 -0
  61. data/lib/active_agent/providers/open_ai/chat/_types.rb +56 -0
  62. data/lib/active_agent/providers/open_ai/chat/request.rb +161 -0
  63. data/lib/active_agent/providers/open_ai/chat/transforms.rb +364 -0
  64. data/lib/active_agent/providers/open_ai/chat_provider.rb +219 -0
  65. data/lib/active_agent/providers/open_ai/embedding/_types.rb +56 -0
  66. data/lib/active_agent/providers/open_ai/embedding/request.rb +53 -0
  67. data/lib/active_agent/providers/open_ai/embedding/transforms.rb +88 -0
  68. data/lib/active_agent/providers/open_ai/options.rb +74 -0
  69. data/lib/active_agent/providers/open_ai/responses/_types.rb +44 -0
  70. data/lib/active_agent/providers/open_ai/responses/request.rb +129 -0
  71. data/lib/active_agent/providers/open_ai/responses/transforms.rb +228 -0
  72. data/lib/active_agent/providers/open_ai/responses_provider.rb +200 -0
  73. data/lib/active_agent/providers/open_ai_provider.rb +94 -0
  74. data/lib/active_agent/providers/open_router/_types.rb +71 -0
  75. data/lib/active_agent/providers/open_router/options.rb +141 -0
  76. data/lib/active_agent/providers/open_router/request.rb +249 -0
  77. data/lib/active_agent/providers/open_router/requests/_types.rb +197 -0
  78. data/lib/active_agent/providers/open_router/requests/messages/_types.rb +56 -0
  79. data/lib/active_agent/providers/open_router/requests/messages/content/_types.rb +97 -0
  80. data/lib/active_agent/providers/open_router/requests/messages/content/file.rb +43 -0
  81. data/lib/active_agent/providers/open_router/requests/messages/content/files/_types.rb +61 -0
  82. data/lib/active_agent/providers/open_router/requests/messages/content/files/details.rb +37 -0
  83. data/lib/active_agent/providers/open_router/requests/plugin.rb +41 -0
  84. data/lib/active_agent/providers/open_router/requests/plugins/_types.rb +46 -0
  85. data/lib/active_agent/providers/open_router/requests/plugins/pdf_config.rb +51 -0
  86. data/lib/active_agent/providers/open_router/requests/prediction.rb +34 -0
  87. data/lib/active_agent/providers/open_router/requests/provider_preferences/_types.rb +44 -0
  88. data/lib/active_agent/providers/open_router/requests/provider_preferences/max_price.rb +64 -0
  89. data/lib/active_agent/providers/open_router/requests/provider_preferences.rb +105 -0
  90. data/lib/active_agent/providers/open_router/requests/response_format.rb +77 -0
  91. data/lib/active_agent/providers/open_router/transforms.rb +134 -0
  92. data/lib/active_agent/providers/open_router_provider.rb +62 -0
  93. data/lib/active_agent/providers/openai_provider.rb +2 -0
  94. data/lib/active_agent/providers/openrouter_provider.rb +2 -0
  95. data/lib/active_agent/railtie.rb +8 -6
  96. data/lib/active_agent/schema_generator.rb +333 -166
  97. data/lib/active_agent/version.rb +1 -1
  98. data/lib/active_agent.rb +112 -36
  99. data/lib/generators/active_agent/agent/USAGE +78 -0
  100. data/lib/generators/active_agent/{agent_generator.rb → agent/agent_generator.rb} +14 -4
  101. data/lib/generators/active_agent/install/USAGE +25 -0
  102. data/lib/generators/active_agent/{install_generator.rb → install/install_generator.rb} +1 -19
  103. data/lib/generators/active_agent/templates/agent.rb.tt +7 -3
  104. data/lib/generators/active_agent/templates/application_agent.rb.tt +0 -2
  105. data/lib/generators/erb/agent_generator.rb +31 -16
  106. data/lib/generators/erb/templates/instructions.md.erb.tt +3 -0
  107. data/lib/generators/erb/templates/instructions.md.tt +3 -0
  108. data/lib/generators/erb/templates/instructions.text.tt +1 -0
  109. data/lib/generators/erb/templates/message.md.erb.tt +5 -0
  110. data/lib/generators/erb/templates/schema.json.tt +10 -0
  111. data/lib/generators/test_unit/agent_generator.rb +1 -1
  112. data/lib/generators/test_unit/templates/functional_test.rb.tt +4 -2
  113. metadata +182 -71
  114. data/lib/active_agent/action_prompt/action.rb +0 -13
  115. data/lib/active_agent/action_prompt/base.rb +0 -623
  116. data/lib/active_agent/action_prompt/message.rb +0 -126
  117. data/lib/active_agent/action_prompt/prompt.rb +0 -136
  118. data/lib/active_agent/action_prompt.rb +0 -19
  119. data/lib/active_agent/callbacks.rb +0 -33
  120. data/lib/active_agent/generation_provider/anthropic_provider.rb +0 -163
  121. data/lib/active_agent/generation_provider/base.rb +0 -55
  122. data/lib/active_agent/generation_provider/base_adapter.rb +0 -19
  123. data/lib/active_agent/generation_provider/error_handling.rb +0 -167
  124. data/lib/active_agent/generation_provider/log_subscriber.rb +0 -92
  125. data/lib/active_agent/generation_provider/message_formatting.rb +0 -107
  126. data/lib/active_agent/generation_provider/ollama_provider.rb +0 -66
  127. data/lib/active_agent/generation_provider/open_ai_provider.rb +0 -279
  128. data/lib/active_agent/generation_provider/open_router_provider.rb +0 -385
  129. data/lib/active_agent/generation_provider/parameter_builder.rb +0 -119
  130. data/lib/active_agent/generation_provider/response.rb +0 -75
  131. data/lib/active_agent/generation_provider/responses_adapter.rb +0 -44
  132. data/lib/active_agent/generation_provider/stream_processing.rb +0 -58
  133. data/lib/active_agent/generation_provider/tool_management.rb +0 -142
  134. data/lib/active_agent/generation_provider.rb +0 -67
  135. data/lib/active_agent/log_subscriber.rb +0 -44
  136. data/lib/active_agent/parameterized.rb +0 -75
  137. data/lib/active_agent/prompt_helper.rb +0 -19
  138. data/lib/active_agent/queued_generation.rb +0 -12
  139. data/lib/active_agent/rescuable.rb +0 -34
  140. data/lib/active_agent/sanitizers.rb +0 -40
  141. data/lib/active_agent/streaming.rb +0 -34
  142. data/lib/active_agent/test_case.rb +0 -125
  143. data/lib/generators/USAGE +0 -47
  144. data/lib/generators/active_agent/USAGE +0 -56
  145. data/lib/generators/erb/install_generator.rb +0 -44
  146. data/lib/generators/erb/templates/layout.html.erb.tt +0 -1
  147. data/lib/generators/erb/templates/layout.json.erb.tt +0 -1
  148. data/lib/generators/erb/templates/layout.text.erb.tt +0 -1
  149. data/lib/generators/erb/templates/view.html.erb.tt +0 -5
  150. data/lib/generators/erb/templates/view.json.erb.tt +0 -16
  151. /data/lib/active_agent/{preview.rb → concerns/preview.rb} +0 -0
  152. /data/lib/generators/erb/templates/{view.text.erb.tt → message.text.erb.tt} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a07262fb92e03b08ab0abaad0cf2c9b6575a4aa1f6988899c9d0b2d9b081589c
4
- data.tar.gz: '0619435e72d1a4e368c330956aa1295059c98c94a4c885e02b7781e82ba56260'
3
+ metadata.gz: 330c02d2e1ac16e72413f22401dbc6899f652b794d34090b0f499a37b901fbaf
4
+ data.tar.gz: a492f5c88db1f217fe47f9de1477f195c6b150b5dc5ce5791c66fe0f63b0b028
5
5
  SHA512:
6
- metadata.gz: 3c7277d51950db30434643a67379467886cf40e2a100e4ada54556b88cafd4a92e314e02f06d2a94572b686c7064a28d1da94c3176e207452611b3d340d7d455
7
- data.tar.gz: e14ae5c030fe0ce4b7c47915f4728dfa9474b7a465695ab9c0e2cb244136eb024bf8c1f6657b2178282091c98af4171b549927f55a38d195023d9d4f540979e1
6
+ metadata.gz: d8dac6789ba1f3685c24d711aace46ad5b681e9c795a975e61f07ee3c7d9a9bc44c2fd0568fabcabd739df5efd13b222c5fa6e954384bacb8bbcfdaaab0d7182
7
+ data.tar.gz: 8a0f61b2b5a9375c8f1b090bca29af077384079ba008622a1a510d8190acdff034c7f6b8065c1c752a2cee00dabd35d00f017db28954aacc17386fb06be63d50
data/CHANGELOG.md CHANGED
@@ -5,6 +5,244 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.0] - 2025-11-21
9
+
10
+ Major refactor with breaking changes. Complete provider rewrite. New modular architecture.
11
+
12
+ **Requirements:** Ruby 3.1+, Rails 7.0+/8.0+/8.1+
13
+
14
+ ### Breaking Changes
15
+
16
+ #### 1. Update Provider Gems
17
+
18
+ ```ruby
19
+ # Gemfile - Remove unofficial gems
20
+ gem "ruby-openai"
21
+ gem "ruby-anthropic"
22
+
23
+ # Add official provider SDKs
24
+ gem "openai" # Official OpenAI SDK
25
+ gem "anthropic" # Official Anthropic SDK
26
+ ```
27
+
28
+ Run `bundle install` after updating.
29
+
30
+ #### 2. Update Base Class
31
+
32
+ ```ruby
33
+ # Before
34
+ class MyAgent < ActiveAgent::ActionPrompt::Base
35
+ end
36
+
37
+ # After
38
+ class MyAgent < ActiveAgent::Base
39
+ end
40
+ ```
41
+
42
+ #### 3. Configure Providers
43
+
44
+ ```ruby
45
+ # Before - options wrapped in options key
46
+ class MyAgent < ActiveAgent::Base
47
+ def chat
48
+ prompt(message: "Hello", options: { temperature: 0.7 })
49
+ end
50
+ end
51
+
52
+ # After - options passed directly (at class or call level)
53
+ class MyAgent < ActiveAgent::Base
54
+ generate_with :openai, model: "gpt-4o-mini", temperature: 0.7
55
+
56
+ def chat
57
+ prompt("Hello") # Uses class-level config
58
+ end
59
+
60
+ def chat_creative
61
+ prompt("Hello", temperature: 1.0) # Override per-call
62
+ end
63
+ end
64
+ ```
65
+
66
+ #### 4. Update Custom Providers (if any)
67
+
68
+ ```ruby
69
+ # Before
70
+ module ActiveAgent::GenerationProvider
71
+ class CustomProvider < Base
72
+ end
73
+ end
74
+
75
+ # After
76
+ module ActiveAgent::Providers
77
+ class CustomProvider < BaseProvider
78
+ end
79
+ end
80
+ ```
81
+
82
+ #### 5. Update Generator Commands
83
+
84
+ ```bash
85
+ # Before
86
+ rails g active_agent MyAgent action
87
+
88
+ # After
89
+ rails g active_agent:agent MyAgent action
90
+ ```
91
+
92
+ #### 6. Remove Framework Retry Config
93
+
94
+ ```ruby
95
+ # Remove from config/initializers/activeagent.rb
96
+ ActiveAgent.configure do |config|
97
+ config.retries = true
98
+ config.retries_count = 5
99
+ end
100
+
101
+ # Use provider-specific settings in config/active_agent.yml
102
+ openai:
103
+ service: "OpenAI"
104
+ max_retries: 5
105
+ timeout: 600.0
106
+ ```
107
+
108
+ Template paths:
109
+ - `app/views/agents/{agent}/instructions.md` (no `.erb` extension by default for instructions)
110
+ - `app/views/agents/{agent}/{action}.md.erb`
111
+
112
+ ### Added
113
+
114
+ **Mock Provider for Testing**
115
+ ```ruby
116
+ class MyAgent < ActiveAgent::Base
117
+ generate_with :mock
118
+ end
119
+
120
+ response = MyAgent.prompt("Test").generate_now
121
+ # Returns predictable responses without API calls
122
+ ```
123
+
124
+ **Mixed Provider Support**
125
+ ```ruby
126
+ class MyAgent < ActiveAgent::Base
127
+ generate_with :openai, model: "gpt-4o-mini"
128
+ embed_with :anthropic, model: "claude-3-5-sonnet-20241022"
129
+ end
130
+ ```
131
+
132
+ **Prompt Previews**
133
+ ```ruby
134
+ preview = MyAgent.prompt("Hello").prompt_preview
135
+ # Shows instructions, messages, tools before execution
136
+ ```
137
+
138
+ **Callback Lifecycle**
139
+ - `before_generation`, `after_generation`, `around_generation`
140
+ - `before_prompt`, `after_prompt`, `around_prompt`
141
+ - `before_embed`, `after_embed`, `around_embed`
142
+ - `on_stream_open`, `on_stream`, `on_stream_close`
143
+ - Rails-style callback control: `prepend_*`, `skip_*`, `append_*`
144
+
145
+ **Multi-Input Embeddings**
146
+ ```ruby
147
+ response = MyAgent.embed(inputs: ["Text 1", "Text 2"]).embed_now
148
+ vectors = response.data.map { |d| d[:embedding] }
149
+ ```
150
+
151
+ **Normalized Usage Statistics**
152
+ ```ruby
153
+ response = MyAgent.prompt("Hello").generate_now
154
+
155
+ # Works across all providers
156
+ response.usage.input_tokens
157
+ response.usage.output_tokens
158
+ response.usage.total_tokens
159
+
160
+ # Provider-specific fields when available
161
+ response.usage.cached_tokens # OpenAI, Anthropic
162
+ response.usage.reasoning_tokens # OpenAI o1 models
163
+ response.usage.service_tier # Anthropic
164
+ ```
165
+
166
+ **Enhanced Instrumentation for APM Integration**
167
+ - Unified event structure: `prompt.active_agent` and `embed.active_agent` (top-level) plus `prompt.provider.active_agent` and `embed.provider.active_agent` (per-API-call)
168
+ - Event payloads include comprehensive data for monitoring tools (New Relic, DataDog, etc.):
169
+ - Request parameters: `model`, `temperature`, `max_tokens`, `top_p`, `stream`, `message_count`, `has_tools`
170
+ - Usage data: `input_tokens`, `output_tokens`, `total_tokens`, `cached_tokens`, `reasoning_tokens`, `audio_tokens`, `cache_creation_tokens` (critical for cost tracking)
171
+ - Response metadata: `finish_reason`, `response_model`, `response_id`, `embedding_count`
172
+ - Top-level events report cumulative usage across all API calls in multi-turn conversations
173
+ - Provider-level events report per-call usage for granular tracking
174
+
175
+ **Multi-Turn Usage Tracking**
176
+ - `response.usage` now returns cumulative token counts across all API calls during tool calling
177
+ - New `response.usages` array contains individual usage objects from each API call
178
+ - `Usage` objects support addition: `usage1 + usage2` for combining statistics
179
+
180
+ **Provider Enhancements**
181
+ - OpenAI Responses API: `api: :responses` or `api: :chat`
182
+ - Anthropic JSON object mode with automatic extraction
183
+ - OpenRouter: quantization, provider preferences, web search
184
+ - Flexible naming: `:openai` or `:open_ai`, `:openrouter` or `:open_router`
185
+
186
+ **Rails 8.1 Support**
187
+
188
+ **Comprehensive Documentation**
189
+ - VitePress site at docs.activeagents.ai
190
+ - All examples tested and validated
191
+
192
+ ### Changed
193
+
194
+ **Provider Architecture**
195
+ - Unified `BaseProvider` interface across all providers
196
+ - Retry logic moved to provider SDKs (automatic exponential backoff)
197
+ - Migrated to official SDKs: `openai` gem and `anthropic` gem
198
+ - Type-safe options with per-provider definitions
199
+
200
+ **Configuration**
201
+ - Options configurable at class level, instance level, or per-call
202
+ - Simplified parameter handling pattern
203
+
204
+ **Requirements**
205
+ - Ruby 3.1+ (previously 3.0+)
206
+
207
+ **Testing**
208
+ - Reorganized by feature and provider integration
209
+ - All documentation examples validated
210
+
211
+ ### Fixed
212
+
213
+ **Providers**
214
+ - OpenAI streaming with functions/tools
215
+ - Ollama streaming support
216
+ - Anthropic tool choice modes (`any` and `tool`)
217
+ - OpenRouter model fallback and parameter naming
218
+ - Provider gem loading errors
219
+
220
+ **Framework**
221
+ - Streaming lifecycle with function/tool calls
222
+ - Multi-tool and multi-turn conversation handling
223
+ - Options mutation during generation
224
+ - Template rendering without blocks
225
+ - Schema generator key symbolization
226
+ - Rails 8.0 and 8.1 compatibility
227
+ - Usage extraction across OpenAI/Anthropic response formats
228
+
229
+ ### Removed
230
+
231
+ **Namespaces**
232
+ - `ActiveAgent::ActionPrompt` → use `ActiveAgent::Base`
233
+ - `ActiveAgent::GenerationProvider` → use `ActiveAgent::Providers`
234
+
235
+ **Configuration**
236
+ - `ActiveAgent.configuration.retries` → use provider `max_retries`
237
+ - `ActiveAgent.configuration.retries_count` → use provider `max_retries`
238
+ - `ActiveAgent.configuration.retries_on` → handled by provider SDKs
239
+
240
+ **Modules**
241
+ - `ActiveAgent::QueuedGeneration` → `Queueing` concern
242
+ - `ActiveAgent::Rescuable` → `Rescue` concern
243
+ - `ActiveAgent::Sanitizers` → moved to concerns
244
+ - `ActiveAgent::PromptHelper` → moved to concerns
245
+
8
246
  ## [0.3.2] - 2025-04-15
9
247
 
10
248
  ### Added
@@ -13,5 +251,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
251
  - Enhance streaming to support tool calls during stream. Previously, streaming mode blocked tool call execution.
14
252
  - Fix layout rendering bug when no block is passed and views now render correctly without requiring a block.
15
253
 
16
- ### Removed
17
- - Generation Provider module and Action Prompt READMEs have been removed, but will be updated along with the main README in the next release.
254
+ ### Removed
255
+ - Generation Provider module and Action Prompt READMEs have been removed, but will be updated along with the main README in the next release.
data/README.md CHANGED
@@ -29,16 +29,16 @@ Add the generation provider gem you want to use:
29
29
 
30
30
  ```bash
31
31
  # OpenAI
32
- bundle add ruby-openai
32
+ bundle add openai
33
33
 
34
34
  # Anthropic
35
- bundle add ruby-anthropic
35
+ bundle add anthropic
36
36
 
37
37
  # Ollama (uses OpenAI-compatible API)
38
- bundle add ruby-openai
38
+ bundle add openai
39
39
 
40
40
  # OpenRouter (uses OpenAI-compatible API)
41
- bundle add ruby-openai
41
+ bundle add openai
42
42
  ```
43
43
 
44
44
  ### Setup
@@ -51,8 +51,7 @@ rails generate active_agent:install
51
51
 
52
52
  This creates:
53
53
  - `config/active_agent.yml`: Configuration file for generation providers
54
- - `app/agents`: Directory for your agent classes
55
- - `app/views/agent_*`: Directory for agent prompt/view templates
54
+ - `app/agents/application_agent.rb`: Base agent class
56
55
 
57
56
  ### Quick Example
58
57
 
@@ -60,19 +59,16 @@ Define an application agent:
60
59
 
61
60
  ```ruby
62
61
  class ApplicationAgent < ActiveAgent::Base
63
- generate_with :openai,
64
- instructions: "You are a helpful assistant.",
65
- model: "gpt-4o-mini",
66
- temperature: 0.7
62
+ generate_with :openai, model: "gpt-4o-mini"
67
63
  end
68
64
  ```
69
65
 
70
66
  Use your agent:
71
67
 
72
68
  ```ruby
73
- message = "Test Application Agent"
74
- prompt = ApplicationAgent.with(message: message).prompt_context
75
- response = prompt.generate_now
69
+ response = ApplicationAgent.prompt(message: "Hello, world!").generate_now
70
+ puts response.message
71
+ # => "Hello! How can I help you today?"
76
72
  ```
77
73
 
78
74
  ### Your First Agent
@@ -112,20 +108,17 @@ Configure generation providers in `config/active_agent.yml`:
112
108
  development:
113
109
  openai:
114
110
  service: "OpenAI"
115
- api_key: <%= Rails.application.credentials.dig(:openai, :api_key) %>
111
+ access_token: <%= Rails.application.credentials.dig(:openai, :access_token) %>
116
112
  model: "gpt-4o-mini"
117
- embeddings_model: "text-embedding-3-small"
118
113
 
119
114
  anthropic:
120
115
  service: "Anthropic"
121
- api_key: <%= Rails.application.credentials.dig(:anthropic, :api_key) %>
122
- model: "claude-3-5-sonnet"
116
+ access_token: <%= Rails.application.credentials.dig(:anthropic, :access_token) %>
117
+ model: "claude-sonnet-4.5"
123
118
 
124
119
  ollama:
125
120
  service: "Ollama"
126
121
  model: "llama3.2"
127
- embeddings_model: "nomic-embed-text"
128
- host: "http://localhost:11434"
129
122
  ```
130
123
 
131
124
  ## Features
@@ -146,9 +139,8 @@ Extract structured data from images, PDFs, and text:
146
139
 
147
140
  ```ruby
148
141
  prompt = DataExtractionAgent.with(
149
- output_schema: :chart_schema,
150
142
  image_path: Rails.root.join("sales_chart.png")
151
- ).parse_content
143
+ ).parse_content.generate_now
152
144
  ```
153
145
 
154
146
  ### Translation
@@ -156,7 +148,7 @@ Translate text between languages:
156
148
 
157
149
  ```ruby
158
150
  response = TranslationAgent.with(
159
- message: "Hi, I'm Justin",
151
+ message: "Hi, I'm Justin",
160
152
  locale: "japanese"
161
153
  ).translate.generate_now
162
154
  ```
@@ -166,8 +158,7 @@ Agents can use tools to perform actions:
166
158
 
167
159
  ```ruby
168
160
  # Agent with tool support
169
- message = "Show me a cat"
170
- prompt = SupportAgent.with(message: message).prompt_context
161
+ prompt = SupportAgent.prompt(message: "Show me a cat")
171
162
  response = prompt.generate_now
172
163
  # Response includes tool call results
173
164
  ```