activeagent 0.6.3 → 1.0.0.rc1
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/CHANGELOG.md +210 -2
- data/README.md +15 -24
- data/lib/active_agent/base.rb +389 -39
- data/lib/active_agent/concerns/callbacks.rb +251 -0
- data/lib/active_agent/concerns/observers.rb +147 -0
- data/lib/active_agent/concerns/parameterized.rb +292 -0
- data/lib/active_agent/concerns/provider.rb +120 -0
- data/lib/active_agent/concerns/queueing.rb +36 -0
- data/lib/active_agent/concerns/rescue.rb +64 -0
- data/lib/active_agent/concerns/streaming.rb +282 -0
- data/lib/active_agent/concerns/tooling.rb +23 -0
- data/lib/active_agent/concerns/view.rb +150 -0
- data/lib/active_agent/configuration.rb +442 -20
- data/lib/active_agent/generation.rb +141 -47
- data/lib/active_agent/generation_provider/open_router/types.rb +505 -0
- data/lib/active_agent/generation_provider/xai_provider.rb +144 -0
- data/lib/active_agent/providers/_base_provider.rb +410 -0
- data/lib/active_agent/providers/anthropic/_types.rb +63 -0
- data/lib/active_agent/providers/anthropic/options.rb +53 -0
- data/lib/active_agent/providers/anthropic/request.rb +109 -0
- data/lib/active_agent/providers/anthropic/requests/_types.rb +190 -0
- data/lib/active_agent/providers/anthropic/requests/container_params.rb +19 -0
- data/lib/active_agent/providers/anthropic/requests/content/base.rb +21 -0
- data/lib/active_agent/providers/anthropic/requests/content/sources/base.rb +22 -0
- data/lib/active_agent/providers/anthropic/requests/context_management_config.rb +18 -0
- data/lib/active_agent/providers/anthropic/requests/messages/_types.rb +189 -0
- data/lib/active_agent/providers/anthropic/requests/messages/assistant.rb +23 -0
- data/lib/active_agent/providers/anthropic/requests/messages/base.rb +63 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/_types.rb +143 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/base.rb +21 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/document.rb +26 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/image.rb +23 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/redacted_thinking.rb +21 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/search_result.rb +27 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/sources/_types.rb +171 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/sources/base.rb +22 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/sources/document_base64.rb +25 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/sources/document_file.rb +23 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/sources/document_text.rb +25 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/sources/document_url.rb +23 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/sources/image_base64.rb +27 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/sources/image_file.rb +23 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/sources/image_url.rb +23 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/text.rb +22 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/thinking.rb +23 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/tool_result.rb +24 -0
- data/lib/active_agent/providers/anthropic/requests/messages/content/tool_use.rb +28 -0
- data/lib/active_agent/providers/anthropic/requests/messages/user.rb +21 -0
- data/lib/active_agent/providers/anthropic/requests/metadata.rb +18 -0
- data/lib/active_agent/providers/anthropic/requests/response_format.rb +22 -0
- data/lib/active_agent/providers/anthropic/requests/thinking_config/_types.rb +60 -0
- data/lib/active_agent/providers/anthropic/requests/thinking_config/base.rb +20 -0
- data/lib/active_agent/providers/anthropic/requests/thinking_config/disabled.rb +16 -0
- data/lib/active_agent/providers/anthropic/requests/thinking_config/enabled.rb +20 -0
- data/lib/active_agent/providers/anthropic/requests/tool_choice/_types.rb +78 -0
- data/lib/active_agent/providers/anthropic/requests/tool_choice/any.rb +17 -0
- data/lib/active_agent/providers/anthropic/requests/tool_choice/auto.rb +17 -0
- data/lib/active_agent/providers/anthropic/requests/tool_choice/base.rb +20 -0
- data/lib/active_agent/providers/anthropic/requests/tool_choice/none.rb +16 -0
- data/lib/active_agent/providers/anthropic/requests/tool_choice/tool.rb +20 -0
- data/lib/active_agent/providers/anthropic_provider.rb +211 -0
- data/lib/active_agent/providers/common/messages/_types.rb +124 -0
- data/lib/active_agent/providers/common/messages/assistant.rb +57 -0
- data/lib/active_agent/providers/common/messages/base.rb +17 -0
- data/lib/active_agent/providers/common/messages/system.rb +20 -0
- data/lib/active_agent/providers/common/messages/tool.rb +21 -0
- data/lib/active_agent/providers/common/messages/user.rb +20 -0
- data/lib/active_agent/providers/common/model.rb +361 -0
- data/lib/active_agent/providers/common/response.rb +13 -0
- data/lib/active_agent/providers/common/responses/_types.rb +51 -0
- data/lib/active_agent/providers/common/responses/base.rb +151 -0
- data/lib/active_agent/providers/common/responses/embed.rb +33 -0
- data/lib/active_agent/providers/common/responses/format.rb +31 -0
- data/lib/active_agent/providers/common/responses/message.rb +3 -0
- data/lib/active_agent/providers/common/responses/prompt.rb +42 -0
- data/lib/active_agent/providers/concerns/exception_handler.rb +72 -0
- data/lib/active_agent/providers/concerns/previewable.rb +150 -0
- data/lib/active_agent/providers/log_subscriber.rb +360 -0
- data/lib/active_agent/providers/mock/_types.rb +77 -0
- data/lib/active_agent/providers/mock/embedding_request.rb +17 -0
- data/lib/active_agent/providers/mock/messages/_types.rb +103 -0
- data/lib/active_agent/providers/mock/messages/assistant.rb +26 -0
- data/lib/active_agent/providers/mock/messages/base.rb +63 -0
- data/lib/active_agent/providers/mock/messages/user.rb +18 -0
- data/lib/active_agent/providers/mock/options.rb +30 -0
- data/lib/active_agent/providers/mock/request.rb +38 -0
- data/lib/active_agent/providers/mock_provider.rb +311 -0
- data/lib/active_agent/providers/ollama/_types.rb +5 -0
- data/lib/active_agent/providers/ollama/chat/_types.rb +44 -0
- data/lib/active_agent/providers/ollama/chat/request.rb +70 -0
- data/lib/active_agent/providers/ollama/chat/requests/_types.rb +3 -0
- data/lib/active_agent/providers/ollama/chat/requests/messages/_types.rb +116 -0
- data/lib/active_agent/providers/ollama/chat/requests/messages/assistant.rb +19 -0
- data/lib/active_agent/providers/ollama/chat/requests/messages/user.rb +19 -0
- data/lib/active_agent/providers/ollama/embedding/_types.rb +44 -0
- data/lib/active_agent/providers/ollama/embedding/request.rb +77 -0
- data/lib/active_agent/providers/ollama/embedding/requests/_types.rb +83 -0
- data/lib/active_agent/providers/ollama/embedding/requests/options.rb +104 -0
- data/lib/active_agent/providers/ollama/options.rb +27 -0
- data/lib/active_agent/providers/ollama_provider.rb +95 -0
- data/lib/active_agent/providers/open_ai/_base.rb +58 -0
- data/lib/active_agent/providers/open_ai/_types.rb +5 -0
- data/lib/active_agent/providers/open_ai/chat/_types.rb +44 -0
- data/lib/active_agent/providers/open_ai/chat/request.rb +215 -0
- data/lib/active_agent/providers/open_ai/chat/requests/_types.rb +229 -0
- data/lib/active_agent/providers/open_ai/chat/requests/audio.rb +24 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/_types.rb +123 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/assistant.rb +42 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/base.rb +78 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/content/_types.rb +133 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/content/audio.rb +35 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/content/base.rb +24 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/content/file.rb +26 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/content/files/_types.rb +60 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/content/files/details.rb +41 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/content/image.rb +37 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/content/refusal.rb +25 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/content/text.rb +25 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/developer.rb +25 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/function.rb +25 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/system.rb +25 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/tool.rb +26 -0
- data/lib/active_agent/providers/open_ai/chat/requests/messages/user.rb +32 -0
- data/lib/active_agent/providers/open_ai/chat/requests/prediction.rb +46 -0
- data/lib/active_agent/providers/open_ai/chat/requests/response_format.rb +53 -0
- data/lib/active_agent/providers/open_ai/chat/requests/stream_options.rb +24 -0
- data/lib/active_agent/providers/open_ai/chat/requests/tool_choice.rb +26 -0
- data/lib/active_agent/providers/open_ai/chat/requests/tools/_types.rb +5 -0
- data/lib/active_agent/providers/open_ai/chat/requests/tools/base.rb +22 -0
- data/lib/active_agent/providers/open_ai/chat/requests/tools/custom_tool.rb +41 -0
- data/lib/active_agent/providers/open_ai/chat/requests/tools/function_tool.rb +51 -0
- data/lib/active_agent/providers/open_ai/chat/requests/web_search_options.rb +45 -0
- data/lib/active_agent/providers/open_ai/chat_provider.rb +198 -0
- data/lib/active_agent/providers/open_ai/embedding/_types.rb +45 -0
- data/lib/active_agent/providers/open_ai/embedding/request.rb +85 -0
- data/lib/active_agent/providers/open_ai/embedding/requests/_types.rb +49 -0
- data/lib/active_agent/providers/open_ai/options.rb +74 -0
- data/lib/active_agent/providers/open_ai/responses/_types.rb +50 -0
- data/lib/active_agent/providers/open_ai/responses/request.rb +163 -0
- data/lib/active_agent/providers/open_ai/responses/requests/_types.rb +231 -0
- data/lib/active_agent/providers/open_ai/responses/requests/conversation.rb +23 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/_types.rb +264 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/assistant_message.rb +22 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/base.rb +89 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/code_interpreter_tool_call.rb +30 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/computer_tool_call.rb +28 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/computer_tool_call_output.rb +33 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/content/_types.rb +207 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/content/base.rb +22 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/content/input_audio.rb +26 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/content/input_file.rb +28 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/content/input_image.rb +28 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/content/input_text.rb +25 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/custom_tool_call.rb +28 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/custom_tool_call_output.rb +27 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/developer_message.rb +20 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/file_search_tool_call.rb +25 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/function_call_output.rb +32 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/function_tool_call.rb +28 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/image_gen_tool_call.rb +27 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/input_message.rb +31 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/item_reference.rb +23 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/local_shell_tool_call.rb +26 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/local_shell_tool_call_output.rb +33 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/mcp_approval_request.rb +30 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/mcp_approval_response.rb +28 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/mcp_list_tools.rb +29 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/mcp_tool_call.rb +35 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/output_message.rb +35 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/reasoning.rb +33 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/system_message.rb +20 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/tool_call_base.rb +27 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/tool_message.rb +23 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/user_message.rb +20 -0
- data/lib/active_agent/providers/open_ai/responses/requests/inputs/web_search_tool_call.rb +24 -0
- data/lib/active_agent/providers/open_ai/responses/requests/prompt_reference.rb +23 -0
- data/lib/active_agent/providers/open_ai/responses/requests/reasoning.rb +23 -0
- data/lib/active_agent/providers/open_ai/responses/requests/stream_options.rb +20 -0
- data/lib/active_agent/providers/open_ai/responses/requests/text/_types.rb +89 -0
- data/lib/active_agent/providers/open_ai/responses/requests/text/base.rb +22 -0
- data/lib/active_agent/providers/open_ai/responses/requests/text/json_object.rb +20 -0
- data/lib/active_agent/providers/open_ai/responses/requests/text/json_schema.rb +48 -0
- data/lib/active_agent/providers/open_ai/responses/requests/text/plain.rb +20 -0
- data/lib/active_agent/providers/open_ai/responses/requests/text.rb +41 -0
- data/lib/active_agent/providers/open_ai/responses/requests/tool_choice.rb +26 -0
- data/lib/active_agent/providers/open_ai/responses/requests/tools/_types.rb +112 -0
- data/lib/active_agent/providers/open_ai/responses/requests/tools/base.rb +25 -0
- data/lib/active_agent/providers/open_ai/responses/requests/tools/code_interpreter_tool.rb +23 -0
- data/lib/active_agent/providers/open_ai/responses/requests/tools/computer_tool.rb +27 -0
- data/lib/active_agent/providers/open_ai/responses/requests/tools/custom_tool.rb +28 -0
- data/lib/active_agent/providers/open_ai/responses/requests/tools/file_search_tool.rb +27 -0
- data/lib/active_agent/providers/open_ai/responses/requests/tools/function_tool.rb +29 -0
- data/lib/active_agent/providers/open_ai/responses/requests/tools/image_generation_tool.rb +37 -0
- data/lib/active_agent/providers/open_ai/responses/requests/tools/local_shell_tool.rb +21 -0
- data/lib/active_agent/providers/open_ai/responses/requests/tools/mcp_tool.rb +41 -0
- data/lib/active_agent/providers/open_ai/responses/requests/tools/web_search_preview_tool.rb +24 -0
- data/lib/active_agent/providers/open_ai/responses/requests/tools/web_search_tool.rb +25 -0
- data/lib/active_agent/providers/open_ai/responses_provider.rb +153 -0
- data/lib/active_agent/providers/open_ai/schema.yml +65937 -0
- data/lib/active_agent/providers/open_ai_provider.rb +97 -0
- data/lib/active_agent/providers/open_router/_types.rb +45 -0
- data/lib/active_agent/providers/open_router/options.rb +93 -0
- data/lib/active_agent/providers/open_router/request.rb +83 -0
- data/lib/active_agent/providers/open_router/requests/_types.rb +198 -0
- data/lib/active_agent/providers/open_router/requests/message.rb +1 -0
- data/lib/active_agent/providers/open_router/requests/messages/_types.rb +59 -0
- data/lib/active_agent/providers/open_router/requests/messages/assistant.rb +20 -0
- data/lib/active_agent/providers/open_router/requests/messages/content/_types.rb +97 -0
- data/lib/active_agent/providers/open_router/requests/messages/content/file.rb +27 -0
- data/lib/active_agent/providers/open_router/requests/messages/content/files/_types.rb +61 -0
- data/lib/active_agent/providers/open_router/requests/messages/content/files/details.rb +26 -0
- data/lib/active_agent/providers/open_router/requests/messages/user.rb +30 -0
- data/lib/active_agent/providers/open_router/requests/plugin.rb +25 -0
- data/lib/active_agent/providers/open_router/requests/plugins/_types.rb +46 -0
- data/lib/active_agent/providers/open_router/requests/plugins/pdf_config.rb +29 -0
- data/lib/active_agent/providers/open_router/requests/prediction.rb +17 -0
- data/lib/active_agent/providers/open_router/requests/provider_preferences/_types.rb +44 -0
- data/lib/active_agent/providers/open_router/requests/provider_preferences/max_price.rb +30 -0
- data/lib/active_agent/providers/open_router/requests/provider_preferences.rb +64 -0
- data/lib/active_agent/providers/open_router/requests/response_format.rb +49 -0
- data/lib/active_agent/providers/open_router_provider.rb +53 -0
- data/lib/active_agent/providers/openai_provider.rb +2 -0
- data/lib/active_agent/providers/openrouter_provider.rb +2 -0
- data/lib/active_agent/railtie.rb +8 -6
- data/lib/active_agent/schema_generator.rb +333 -166
- data/lib/active_agent/version.rb +1 -1
- data/lib/active_agent.rb +112 -36
- data/lib/generators/active_agent/agent/USAGE +78 -0
- data/lib/generators/active_agent/{agent_generator.rb → agent/agent_generator.rb} +14 -4
- data/lib/generators/active_agent/install/USAGE +25 -0
- data/lib/generators/active_agent/{install_generator.rb → install/install_generator.rb} +1 -19
- data/lib/generators/active_agent/templates/agent.rb.tt +7 -3
- data/lib/generators/active_agent/templates/application_agent.rb.tt +0 -2
- data/lib/generators/erb/agent_generator.rb +31 -16
- data/lib/generators/erb/templates/instructions.md.erb.tt +3 -0
- data/lib/generators/erb/templates/instructions.md.tt +3 -0
- data/lib/generators/erb/templates/instructions.text.tt +1 -0
- data/lib/generators/erb/templates/message.md.erb.tt +5 -0
- data/lib/generators/erb/templates/schema.json.tt +10 -0
- data/lib/generators/test_unit/agent_generator.rb +1 -1
- data/lib/generators/test_unit/templates/functional_test.rb.tt +4 -2
- metadata +320 -65
- data/lib/active_agent/action_prompt/action.rb +0 -13
- data/lib/active_agent/action_prompt/base.rb +0 -623
- data/lib/active_agent/action_prompt/message.rb +0 -126
- data/lib/active_agent/action_prompt/prompt.rb +0 -136
- data/lib/active_agent/action_prompt.rb +0 -19
- data/lib/active_agent/callbacks.rb +0 -33
- data/lib/active_agent/generation_provider/anthropic_provider.rb +0 -163
- data/lib/active_agent/generation_provider/base.rb +0 -55
- data/lib/active_agent/generation_provider/base_adapter.rb +0 -19
- data/lib/active_agent/generation_provider/error_handling.rb +0 -167
- data/lib/active_agent/generation_provider/log_subscriber.rb +0 -92
- data/lib/active_agent/generation_provider/message_formatting.rb +0 -107
- data/lib/active_agent/generation_provider/ollama_provider.rb +0 -66
- data/lib/active_agent/generation_provider/open_ai_provider.rb +0 -279
- data/lib/active_agent/generation_provider/open_router_provider.rb +0 -385
- data/lib/active_agent/generation_provider/parameter_builder.rb +0 -119
- data/lib/active_agent/generation_provider/response.rb +0 -75
- data/lib/active_agent/generation_provider/responses_adapter.rb +0 -44
- data/lib/active_agent/generation_provider/stream_processing.rb +0 -58
- data/lib/active_agent/generation_provider/tool_management.rb +0 -142
- data/lib/active_agent/generation_provider.rb +0 -67
- data/lib/active_agent/log_subscriber.rb +0 -44
- data/lib/active_agent/parameterized.rb +0 -75
- data/lib/active_agent/prompt_helper.rb +0 -19
- data/lib/active_agent/queued_generation.rb +0 -12
- data/lib/active_agent/rescuable.rb +0 -34
- data/lib/active_agent/sanitizers.rb +0 -40
- data/lib/active_agent/streaming.rb +0 -34
- data/lib/active_agent/test_case.rb +0 -125
- data/lib/generators/USAGE +0 -47
- data/lib/generators/active_agent/USAGE +0 -56
- data/lib/generators/erb/install_generator.rb +0 -44
- data/lib/generators/erb/templates/layout.html.erb.tt +0 -1
- data/lib/generators/erb/templates/layout.json.erb.tt +0 -1
- data/lib/generators/erb/templates/layout.text.erb.tt +0 -1
- data/lib/generators/erb/templates/view.html.erb.tt +0 -5
- data/lib/generators/erb/templates/view.json.erb.tt +0 -16
- /data/lib/active_agent/{preview.rb → concerns/preview.rb} +0 -0
- /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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3a2f8f345b5f6a3f9d2717f24542a0dd0a75ae22a7b3601ebe77b9ff8ba3bbc1
|
|
4
|
+
data.tar.gz: efe4dc5f9c4d10e4f1454bf274080d42cd88c5af5488195fa98cafd5cbadb812
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab6e83518446995be3984dc347524314d831de5650c263e0338f2cff4382cd111196145f2155b206fe651d930054ac3cf166b05cee9aa89fe907fbc4c7d7ed5f
|
|
7
|
+
data.tar.gz: bbff91deb2aba1feccb49edbf71664c3569595357fc7d3c1aea9555d95f07c2edb102f24927fe2132eb35ddc5bc2a8b8d0f52eb1b0f40ca9ca308b59263b68a6
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,214 @@ 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] - Unreleased
|
|
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
|
+
**Provider Enhancements**
|
|
152
|
+
- OpenAI Responses API: `api: :responses` or `api: :chat`
|
|
153
|
+
- Anthropic JSON object mode with automatic extraction
|
|
154
|
+
- OpenRouter: quantization, provider preferences, web search
|
|
155
|
+
- Flexible naming: `:openai` or `:open_ai`, `:openrouter` or `:open_router`
|
|
156
|
+
|
|
157
|
+
**Rails 8.1 Support**
|
|
158
|
+
|
|
159
|
+
**Comprehensive Documentation**
|
|
160
|
+
- VitePress site at docs.activeagents.ai
|
|
161
|
+
- All examples tested and validated
|
|
162
|
+
|
|
163
|
+
### Changed
|
|
164
|
+
|
|
165
|
+
**Provider Architecture**
|
|
166
|
+
- Unified `BaseProvider` interface across all providers
|
|
167
|
+
- Retry logic moved to provider SDKs (automatic exponential backoff)
|
|
168
|
+
- Migrated to official SDKs: `openai` gem and `anthropic` gem
|
|
169
|
+
- Type-safe options with per-provider definitions
|
|
170
|
+
|
|
171
|
+
**Configuration**
|
|
172
|
+
- Options configurable at class level, instance level, or per-call
|
|
173
|
+
- Simplified parameter handling pattern
|
|
174
|
+
|
|
175
|
+
**Requirements**
|
|
176
|
+
- Ruby 3.1+ (previously 3.0+)
|
|
177
|
+
|
|
178
|
+
**Testing**
|
|
179
|
+
- Reorganized by feature and provider integration
|
|
180
|
+
- All documentation examples validated
|
|
181
|
+
|
|
182
|
+
### Fixed
|
|
183
|
+
|
|
184
|
+
**Providers**
|
|
185
|
+
- OpenAI streaming with functions/tools
|
|
186
|
+
- Ollama streaming support
|
|
187
|
+
- Anthropic tool choice modes (`any` and `tool`)
|
|
188
|
+
- OpenRouter model fallback and parameter naming
|
|
189
|
+
- Provider gem loading errors
|
|
190
|
+
|
|
191
|
+
**Framework**
|
|
192
|
+
- Streaming lifecycle with function/tool calls
|
|
193
|
+
- Multi-tool and multi-turn conversation handling
|
|
194
|
+
- Options mutation during generation
|
|
195
|
+
- Template rendering without blocks
|
|
196
|
+
- Schema generator key symbolization
|
|
197
|
+
- Rails 8.0 and 8.1 compatibility
|
|
198
|
+
|
|
199
|
+
### Removed
|
|
200
|
+
|
|
201
|
+
**Namespaces**
|
|
202
|
+
- `ActiveAgent::ActionPrompt` → use `ActiveAgent::Base`
|
|
203
|
+
- `ActiveAgent::GenerationProvider` → use `ActiveAgent::Providers`
|
|
204
|
+
|
|
205
|
+
**Configuration**
|
|
206
|
+
- `ActiveAgent.configuration.retries` → use provider `max_retries`
|
|
207
|
+
- `ActiveAgent.configuration.retries_count` → use provider `max_retries`
|
|
208
|
+
- `ActiveAgent.configuration.retries_on` → handled by provider SDKs
|
|
209
|
+
|
|
210
|
+
**Modules**
|
|
211
|
+
- `ActiveAgent::QueuedGeneration` → `Queueing` concern
|
|
212
|
+
- `ActiveAgent::Rescuable` → `Rescue` concern
|
|
213
|
+
- `ActiveAgent::Sanitizers` → moved to concerns
|
|
214
|
+
- `ActiveAgent::PromptHelper` → moved to concerns
|
|
215
|
+
|
|
8
216
|
## [0.3.2] - 2025-04-15
|
|
9
217
|
|
|
10
218
|
### Added
|
|
@@ -13,5 +221,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
13
221
|
- Enhance streaming to support tool calls during stream. Previously, streaming mode blocked tool call execution.
|
|
14
222
|
- Fix layout rendering bug when no block is passed and views now render correctly without requiring a block.
|
|
15
223
|
|
|
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.
|
|
224
|
+
### Removed
|
|
225
|
+
- 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
|
|
32
|
+
bundle add openai
|
|
33
33
|
|
|
34
34
|
# Anthropic
|
|
35
|
-
bundle add
|
|
35
|
+
bundle add anthropic
|
|
36
36
|
|
|
37
37
|
# Ollama (uses OpenAI-compatible API)
|
|
38
|
-
bundle add
|
|
38
|
+
bundle add openai
|
|
39
39
|
|
|
40
40
|
# OpenRouter (uses OpenAI-compatible API)
|
|
41
|
-
bundle add
|
|
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`:
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
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
|
-
|
|
122
|
-
model: "claude-
|
|
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
|
-
|
|
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
|
```
|