activeagent 1.0.0.rc1 → 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 (187) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -1
  3. data/lib/active_agent/providers/_base_provider.rb +92 -82
  4. data/lib/active_agent/providers/anthropic/_types.rb +2 -2
  5. data/lib/active_agent/providers/anthropic/request.rb +135 -81
  6. data/lib/active_agent/providers/anthropic/transforms.rb +353 -0
  7. data/lib/active_agent/providers/anthropic_provider.rb +96 -53
  8. data/lib/active_agent/providers/common/messages/_types.rb +37 -1
  9. data/lib/active_agent/providers/common/responses/base.rb +118 -70
  10. data/lib/active_agent/providers/common/usage.rb +385 -0
  11. data/lib/active_agent/providers/concerns/instrumentation.rb +263 -0
  12. data/lib/active_agent/providers/log_subscriber.rb +64 -246
  13. data/lib/active_agent/providers/mock_provider.rb +23 -23
  14. data/lib/active_agent/providers/ollama/chat/request.rb +214 -35
  15. data/lib/active_agent/providers/ollama/chat/transforms.rb +135 -0
  16. data/lib/active_agent/providers/ollama/embedding/request.rb +160 -47
  17. data/lib/active_agent/providers/ollama/embedding/transforms.rb +160 -0
  18. data/lib/active_agent/providers/ollama_provider.rb +0 -1
  19. data/lib/active_agent/providers/open_ai/_base.rb +3 -2
  20. data/lib/active_agent/providers/open_ai/chat/_types.rb +13 -1
  21. data/lib/active_agent/providers/open_ai/chat/request.rb +132 -186
  22. data/lib/active_agent/providers/open_ai/chat/transforms.rb +364 -0
  23. data/lib/active_agent/providers/open_ai/chat_provider.rb +57 -36
  24. data/lib/active_agent/providers/open_ai/embedding/_types.rb +13 -2
  25. data/lib/active_agent/providers/open_ai/embedding/request.rb +38 -70
  26. data/lib/active_agent/providers/open_ai/embedding/transforms.rb +88 -0
  27. data/lib/active_agent/providers/open_ai/responses/_types.rb +1 -7
  28. data/lib/active_agent/providers/open_ai/responses/request.rb +100 -134
  29. data/lib/active_agent/providers/open_ai/responses/transforms.rb +228 -0
  30. data/lib/active_agent/providers/open_ai/responses_provider.rb +77 -30
  31. data/lib/active_agent/providers/open_ai_provider.rb +0 -3
  32. data/lib/active_agent/providers/open_router/_types.rb +27 -1
  33. data/lib/active_agent/providers/open_router/options.rb +49 -1
  34. data/lib/active_agent/providers/open_router/request.rb +232 -66
  35. data/lib/active_agent/providers/open_router/requests/_types.rb +0 -1
  36. data/lib/active_agent/providers/open_router/requests/messages/_types.rb +37 -40
  37. data/lib/active_agent/providers/open_router/requests/messages/content/file.rb +19 -3
  38. data/lib/active_agent/providers/open_router/requests/messages/content/files/details.rb +15 -4
  39. data/lib/active_agent/providers/open_router/requests/plugin.rb +19 -3
  40. data/lib/active_agent/providers/open_router/requests/plugins/pdf_config.rb +30 -8
  41. data/lib/active_agent/providers/open_router/requests/prediction.rb +17 -0
  42. data/lib/active_agent/providers/open_router/requests/provider_preferences/max_price.rb +41 -7
  43. data/lib/active_agent/providers/open_router/requests/provider_preferences.rb +60 -19
  44. data/lib/active_agent/providers/open_router/requests/response_format.rb +30 -2
  45. data/lib/active_agent/providers/open_router/transforms.rb +134 -0
  46. data/lib/active_agent/providers/open_router_provider.rb +9 -0
  47. data/lib/active_agent/version.rb +1 -1
  48. metadata +15 -159
  49. data/lib/active_agent/generation_provider/open_router/types.rb +0 -505
  50. data/lib/active_agent/generation_provider/xai_provider.rb +0 -144
  51. data/lib/active_agent/providers/anthropic/requests/_types.rb +0 -190
  52. data/lib/active_agent/providers/anthropic/requests/container_params.rb +0 -19
  53. data/lib/active_agent/providers/anthropic/requests/content/base.rb +0 -21
  54. data/lib/active_agent/providers/anthropic/requests/content/sources/base.rb +0 -22
  55. data/lib/active_agent/providers/anthropic/requests/context_management_config.rb +0 -18
  56. data/lib/active_agent/providers/anthropic/requests/messages/_types.rb +0 -189
  57. data/lib/active_agent/providers/anthropic/requests/messages/assistant.rb +0 -23
  58. data/lib/active_agent/providers/anthropic/requests/messages/base.rb +0 -63
  59. data/lib/active_agent/providers/anthropic/requests/messages/content/_types.rb +0 -143
  60. data/lib/active_agent/providers/anthropic/requests/messages/content/base.rb +0 -21
  61. data/lib/active_agent/providers/anthropic/requests/messages/content/document.rb +0 -26
  62. data/lib/active_agent/providers/anthropic/requests/messages/content/image.rb +0 -23
  63. data/lib/active_agent/providers/anthropic/requests/messages/content/redacted_thinking.rb +0 -21
  64. data/lib/active_agent/providers/anthropic/requests/messages/content/search_result.rb +0 -27
  65. data/lib/active_agent/providers/anthropic/requests/messages/content/sources/_types.rb +0 -171
  66. data/lib/active_agent/providers/anthropic/requests/messages/content/sources/base.rb +0 -22
  67. data/lib/active_agent/providers/anthropic/requests/messages/content/sources/document_base64.rb +0 -25
  68. data/lib/active_agent/providers/anthropic/requests/messages/content/sources/document_file.rb +0 -23
  69. data/lib/active_agent/providers/anthropic/requests/messages/content/sources/document_text.rb +0 -25
  70. data/lib/active_agent/providers/anthropic/requests/messages/content/sources/document_url.rb +0 -23
  71. data/lib/active_agent/providers/anthropic/requests/messages/content/sources/image_base64.rb +0 -27
  72. data/lib/active_agent/providers/anthropic/requests/messages/content/sources/image_file.rb +0 -23
  73. data/lib/active_agent/providers/anthropic/requests/messages/content/sources/image_url.rb +0 -23
  74. data/lib/active_agent/providers/anthropic/requests/messages/content/text.rb +0 -22
  75. data/lib/active_agent/providers/anthropic/requests/messages/content/thinking.rb +0 -23
  76. data/lib/active_agent/providers/anthropic/requests/messages/content/tool_result.rb +0 -24
  77. data/lib/active_agent/providers/anthropic/requests/messages/content/tool_use.rb +0 -28
  78. data/lib/active_agent/providers/anthropic/requests/messages/user.rb +0 -21
  79. data/lib/active_agent/providers/anthropic/requests/metadata.rb +0 -18
  80. data/lib/active_agent/providers/anthropic/requests/response_format.rb +0 -22
  81. data/lib/active_agent/providers/anthropic/requests/thinking_config/_types.rb +0 -60
  82. data/lib/active_agent/providers/anthropic/requests/thinking_config/base.rb +0 -20
  83. data/lib/active_agent/providers/anthropic/requests/thinking_config/disabled.rb +0 -16
  84. data/lib/active_agent/providers/anthropic/requests/thinking_config/enabled.rb +0 -20
  85. data/lib/active_agent/providers/anthropic/requests/tool_choice/_types.rb +0 -78
  86. data/lib/active_agent/providers/anthropic/requests/tool_choice/any.rb +0 -17
  87. data/lib/active_agent/providers/anthropic/requests/tool_choice/auto.rb +0 -17
  88. data/lib/active_agent/providers/anthropic/requests/tool_choice/base.rb +0 -20
  89. data/lib/active_agent/providers/anthropic/requests/tool_choice/none.rb +0 -16
  90. data/lib/active_agent/providers/anthropic/requests/tool_choice/tool.rb +0 -20
  91. data/lib/active_agent/providers/ollama/chat/requests/_types.rb +0 -3
  92. data/lib/active_agent/providers/ollama/chat/requests/messages/_types.rb +0 -116
  93. data/lib/active_agent/providers/ollama/chat/requests/messages/assistant.rb +0 -19
  94. data/lib/active_agent/providers/ollama/chat/requests/messages/user.rb +0 -19
  95. data/lib/active_agent/providers/ollama/embedding/requests/_types.rb +0 -83
  96. data/lib/active_agent/providers/ollama/embedding/requests/options.rb +0 -104
  97. data/lib/active_agent/providers/open_ai/chat/requests/_types.rb +0 -229
  98. data/lib/active_agent/providers/open_ai/chat/requests/audio.rb +0 -24
  99. data/lib/active_agent/providers/open_ai/chat/requests/messages/_types.rb +0 -123
  100. data/lib/active_agent/providers/open_ai/chat/requests/messages/assistant.rb +0 -42
  101. data/lib/active_agent/providers/open_ai/chat/requests/messages/base.rb +0 -78
  102. data/lib/active_agent/providers/open_ai/chat/requests/messages/content/_types.rb +0 -133
  103. data/lib/active_agent/providers/open_ai/chat/requests/messages/content/audio.rb +0 -35
  104. data/lib/active_agent/providers/open_ai/chat/requests/messages/content/base.rb +0 -24
  105. data/lib/active_agent/providers/open_ai/chat/requests/messages/content/file.rb +0 -26
  106. data/lib/active_agent/providers/open_ai/chat/requests/messages/content/files/_types.rb +0 -60
  107. data/lib/active_agent/providers/open_ai/chat/requests/messages/content/files/details.rb +0 -41
  108. data/lib/active_agent/providers/open_ai/chat/requests/messages/content/image.rb +0 -37
  109. data/lib/active_agent/providers/open_ai/chat/requests/messages/content/refusal.rb +0 -25
  110. data/lib/active_agent/providers/open_ai/chat/requests/messages/content/text.rb +0 -25
  111. data/lib/active_agent/providers/open_ai/chat/requests/messages/developer.rb +0 -25
  112. data/lib/active_agent/providers/open_ai/chat/requests/messages/function.rb +0 -25
  113. data/lib/active_agent/providers/open_ai/chat/requests/messages/system.rb +0 -25
  114. data/lib/active_agent/providers/open_ai/chat/requests/messages/tool.rb +0 -26
  115. data/lib/active_agent/providers/open_ai/chat/requests/messages/user.rb +0 -32
  116. data/lib/active_agent/providers/open_ai/chat/requests/prediction.rb +0 -46
  117. data/lib/active_agent/providers/open_ai/chat/requests/response_format.rb +0 -53
  118. data/lib/active_agent/providers/open_ai/chat/requests/stream_options.rb +0 -24
  119. data/lib/active_agent/providers/open_ai/chat/requests/tool_choice.rb +0 -26
  120. data/lib/active_agent/providers/open_ai/chat/requests/tools/_types.rb +0 -5
  121. data/lib/active_agent/providers/open_ai/chat/requests/tools/base.rb +0 -22
  122. data/lib/active_agent/providers/open_ai/chat/requests/tools/custom_tool.rb +0 -41
  123. data/lib/active_agent/providers/open_ai/chat/requests/tools/function_tool.rb +0 -51
  124. data/lib/active_agent/providers/open_ai/chat/requests/web_search_options.rb +0 -45
  125. data/lib/active_agent/providers/open_ai/embedding/requests/_types.rb +0 -49
  126. data/lib/active_agent/providers/open_ai/responses/requests/_types.rb +0 -231
  127. data/lib/active_agent/providers/open_ai/responses/requests/conversation.rb +0 -23
  128. data/lib/active_agent/providers/open_ai/responses/requests/inputs/_types.rb +0 -264
  129. data/lib/active_agent/providers/open_ai/responses/requests/inputs/assistant_message.rb +0 -22
  130. data/lib/active_agent/providers/open_ai/responses/requests/inputs/base.rb +0 -89
  131. data/lib/active_agent/providers/open_ai/responses/requests/inputs/code_interpreter_tool_call.rb +0 -30
  132. data/lib/active_agent/providers/open_ai/responses/requests/inputs/computer_tool_call.rb +0 -28
  133. data/lib/active_agent/providers/open_ai/responses/requests/inputs/computer_tool_call_output.rb +0 -33
  134. data/lib/active_agent/providers/open_ai/responses/requests/inputs/content/_types.rb +0 -207
  135. data/lib/active_agent/providers/open_ai/responses/requests/inputs/content/base.rb +0 -22
  136. data/lib/active_agent/providers/open_ai/responses/requests/inputs/content/input_audio.rb +0 -26
  137. data/lib/active_agent/providers/open_ai/responses/requests/inputs/content/input_file.rb +0 -28
  138. data/lib/active_agent/providers/open_ai/responses/requests/inputs/content/input_image.rb +0 -28
  139. data/lib/active_agent/providers/open_ai/responses/requests/inputs/content/input_text.rb +0 -25
  140. data/lib/active_agent/providers/open_ai/responses/requests/inputs/custom_tool_call.rb +0 -28
  141. data/lib/active_agent/providers/open_ai/responses/requests/inputs/custom_tool_call_output.rb +0 -27
  142. data/lib/active_agent/providers/open_ai/responses/requests/inputs/developer_message.rb +0 -20
  143. data/lib/active_agent/providers/open_ai/responses/requests/inputs/file_search_tool_call.rb +0 -25
  144. data/lib/active_agent/providers/open_ai/responses/requests/inputs/function_call_output.rb +0 -32
  145. data/lib/active_agent/providers/open_ai/responses/requests/inputs/function_tool_call.rb +0 -28
  146. data/lib/active_agent/providers/open_ai/responses/requests/inputs/image_gen_tool_call.rb +0 -27
  147. data/lib/active_agent/providers/open_ai/responses/requests/inputs/input_message.rb +0 -31
  148. data/lib/active_agent/providers/open_ai/responses/requests/inputs/item_reference.rb +0 -23
  149. data/lib/active_agent/providers/open_ai/responses/requests/inputs/local_shell_tool_call.rb +0 -26
  150. data/lib/active_agent/providers/open_ai/responses/requests/inputs/local_shell_tool_call_output.rb +0 -33
  151. data/lib/active_agent/providers/open_ai/responses/requests/inputs/mcp_approval_request.rb +0 -30
  152. data/lib/active_agent/providers/open_ai/responses/requests/inputs/mcp_approval_response.rb +0 -28
  153. data/lib/active_agent/providers/open_ai/responses/requests/inputs/mcp_list_tools.rb +0 -29
  154. data/lib/active_agent/providers/open_ai/responses/requests/inputs/mcp_tool_call.rb +0 -35
  155. data/lib/active_agent/providers/open_ai/responses/requests/inputs/output_message.rb +0 -35
  156. data/lib/active_agent/providers/open_ai/responses/requests/inputs/reasoning.rb +0 -33
  157. data/lib/active_agent/providers/open_ai/responses/requests/inputs/system_message.rb +0 -20
  158. data/lib/active_agent/providers/open_ai/responses/requests/inputs/tool_call_base.rb +0 -27
  159. data/lib/active_agent/providers/open_ai/responses/requests/inputs/tool_message.rb +0 -23
  160. data/lib/active_agent/providers/open_ai/responses/requests/inputs/user_message.rb +0 -20
  161. data/lib/active_agent/providers/open_ai/responses/requests/inputs/web_search_tool_call.rb +0 -24
  162. data/lib/active_agent/providers/open_ai/responses/requests/prompt_reference.rb +0 -23
  163. data/lib/active_agent/providers/open_ai/responses/requests/reasoning.rb +0 -23
  164. data/lib/active_agent/providers/open_ai/responses/requests/stream_options.rb +0 -20
  165. data/lib/active_agent/providers/open_ai/responses/requests/text/_types.rb +0 -89
  166. data/lib/active_agent/providers/open_ai/responses/requests/text/base.rb +0 -22
  167. data/lib/active_agent/providers/open_ai/responses/requests/text/json_object.rb +0 -20
  168. data/lib/active_agent/providers/open_ai/responses/requests/text/json_schema.rb +0 -48
  169. data/lib/active_agent/providers/open_ai/responses/requests/text/plain.rb +0 -20
  170. data/lib/active_agent/providers/open_ai/responses/requests/text.rb +0 -41
  171. data/lib/active_agent/providers/open_ai/responses/requests/tool_choice.rb +0 -26
  172. data/lib/active_agent/providers/open_ai/responses/requests/tools/_types.rb +0 -112
  173. data/lib/active_agent/providers/open_ai/responses/requests/tools/base.rb +0 -25
  174. data/lib/active_agent/providers/open_ai/responses/requests/tools/code_interpreter_tool.rb +0 -23
  175. data/lib/active_agent/providers/open_ai/responses/requests/tools/computer_tool.rb +0 -27
  176. data/lib/active_agent/providers/open_ai/responses/requests/tools/custom_tool.rb +0 -28
  177. data/lib/active_agent/providers/open_ai/responses/requests/tools/file_search_tool.rb +0 -27
  178. data/lib/active_agent/providers/open_ai/responses/requests/tools/function_tool.rb +0 -29
  179. data/lib/active_agent/providers/open_ai/responses/requests/tools/image_generation_tool.rb +0 -37
  180. data/lib/active_agent/providers/open_ai/responses/requests/tools/local_shell_tool.rb +0 -21
  181. data/lib/active_agent/providers/open_ai/responses/requests/tools/mcp_tool.rb +0 -41
  182. data/lib/active_agent/providers/open_ai/responses/requests/tools/web_search_preview_tool.rb +0 -24
  183. data/lib/active_agent/providers/open_ai/responses/requests/tools/web_search_tool.rb +0 -25
  184. data/lib/active_agent/providers/open_ai/schema.yml +0 -65937
  185. data/lib/active_agent/providers/open_router/requests/message.rb +0 -1
  186. data/lib/active_agent/providers/open_router/requests/messages/assistant.rb +0 -20
  187. data/lib/active_agent/providers/open_router/requests/messages/user.rb +0 -30
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module Inputs
11
- # Local shell tool call output
12
- class LocalShellToolCallOutput < Base
13
- attribute :type, :string, as: "local_shell_call_output"
14
- attribute :id, :string
15
- attribute :call_id, :string
16
- attribute :output, :string # JSON string output
17
- attribute :status, :string
18
-
19
- validates :type, inclusion: { in: %w[local_shell_call_output], allow_nil: false }
20
- validates :id, presence: true
21
- validates :call_id, presence: true
22
- validates :output, presence: true
23
- validates :status, inclusion: {
24
- in: %w[in_progress completed incomplete],
25
- allow_nil: true
26
- }
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module Inputs
11
- # MCP approval request - request for human approval
12
- class MCPApprovalRequest < Base
13
- attribute :type, :string, as: "mcp_approval_request"
14
- attribute :id, :string
15
- attribute :server_label, :string
16
- attribute :name, :string
17
- attribute :arguments, :string # JSON string
18
-
19
- validates :type, inclusion: { in: %w[mcp_approval_request], allow_nil: false }
20
- validates :id, presence: true
21
- validates :server_label, presence: true
22
- validates :name, presence: true
23
- validates :arguments, presence: true
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module Inputs
11
- # MCP approval response - response to approval request
12
- class MCPApprovalResponse < Base
13
- attribute :type, :string, as: "mcp_approval_response"
14
- attribute :id, :string
15
- attribute :approval_request_id, :string
16
- attribute :approve, :boolean
17
- attribute :reason, :string
18
-
19
- validates :type, inclusion: { in: %w[mcp_approval_response], allow_nil: false }
20
- validates :approval_request_id, presence: true
21
- validates :approve, inclusion: { in: [ true, false ], allow_nil: false }
22
- end
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module Inputs
11
- # MCP list tools - list of tools available on an MCP server
12
- class MCPListTools < Base
13
- attribute :type, :string, as: "mcp_list_tools"
14
- attribute :id, :string
15
- attribute :server_label, :string
16
- attribute :tools # Always an array of tool objects
17
- attribute :error, :string # Error message if listing failed
18
-
19
- validates :type, inclusion: { in: %w[mcp_list_tools], allow_nil: false }
20
- validates :id, presence: true
21
- validates :server_label, presence: true
22
- validates :tools, presence: true
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "tool_call_base"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module Inputs
11
- # MCP tool call - invocation of MCP server tool
12
- class MCPToolCall < ToolCallBase
13
- attribute :type, :string, as: "mcp_call"
14
- attribute :server_label, :string
15
- attribute :name, :string
16
- attribute :arguments, :string # JSON string
17
- attribute :output, :string # JSON output or null
18
- attribute :error, :string # Error message or null
19
- attribute :approval_request_id, :string # Optional approval request ID
20
-
21
- validates :type, inclusion: { in: %w[mcp_call], allow_nil: false }
22
- validates :server_label, presence: true
23
- validates :name, presence: true
24
- validates :arguments, presence: true
25
- validates :status, inclusion: {
26
- in: %w[in_progress completed incomplete calling failed],
27
- allow_nil: false
28
- }
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module Inputs
11
- # Base class for assistant message outputs
12
- class OutputMessage < Base
13
- attribute :id, :string
14
- attribute :status, :string
15
- attribute :type, :string, default: "message" # Optional
16
-
17
- validates :role, inclusion: {
18
- in: %w[assistant],
19
- allow_nil: false
20
- }
21
-
22
- validates :status, inclusion: {
23
- in: %w[in_progress completed incomplete],
24
- allow_nil: false
25
- }
26
-
27
- validates :id, presence: true
28
- validates :content, presence: true
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module Inputs
11
- # Reasoning item for chain of thought from reasoning models
12
- class Reasoning < Base
13
- attribute :type, :string, as: "reasoning"
14
- attribute :id, :string
15
- attribute :encrypted_content, :string
16
- attribute :summary # Always an array of summary content
17
- attribute :content # Always an array of reasoning text content
18
- attribute :status, :string
19
-
20
- validates :type, inclusion: { in: %w[reasoning], allow_nil: false }
21
- validates :id, presence: true
22
- validates :summary, presence: true
23
- validates :status, inclusion: {
24
- in: %w[in_progress completed incomplete],
25
- allow_nil: true
26
- }
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "input_message"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module Inputs
11
- # System message input
12
- class SystemMessage < InputMessage
13
- attribute :role, :string, as: "system"
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module Inputs
11
- # Base class for all tool call types
12
- class ToolCallBase < Base
13
- attribute :id, :string
14
- attribute :status, :string
15
-
16
- validates :id, presence: true
17
- validates :status, inclusion: {
18
- in: %w[in_progress completed incomplete failed searching generating calling interpreting],
19
- allow_nil: true
20
- }
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module Inputs
11
- # Tool message input
12
- class ToolMessage < Base
13
- attribute :role, :string, as: "tool"
14
- attribute :tool_call_id, :string
15
-
16
- validates :tool_call_id, presence: true
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "input_message"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module Inputs
11
- # User message input
12
- class UserMessage < InputMessage
13
- attribute :role, :string, as: "user"
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "tool_call_base"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module Inputs
11
- # Web search tool call - results from web search
12
- class WebSearchToolCall < ToolCallBase
13
- attribute :type, :string, as: "web_search_call"
14
- attribute :action # WebSearchAction object (search, open_page, or find)
15
-
16
- validates :type, inclusion: { in: %w[web_search_call], allow_nil: false }
17
- validates :action, presence: true
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_agent/providers/common/model"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- class PromptReference < Common::BaseModel
11
- # Prompt ID or name
12
- attribute :id, :string
13
-
14
- # Variables for the prompt template
15
- attribute :variables # Hash of variables
16
-
17
- validates :id, presence: true
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_agent/providers/common/model"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- class Reasoning < Common::BaseModel
11
- # Effort level for reasoning (low, medium, high)
12
- attribute :effort, :string
13
-
14
- # Summary configuration
15
- attribute :summary # Can be string or object with format/length
16
-
17
- validates :effort, inclusion: { in: %w[low medium high] }, allow_nil: true
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_agent/providers/common/model"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- class StreamOptions < Common::BaseModel
11
- # Include usage information in the stream
12
- attribute :include_usage, :boolean
13
-
14
- validates :include_usage, inclusion: { in: [ true, false ] }, allow_nil: true
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,89 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base"
4
- require_relative "plain"
5
- require_relative "json_object"
6
- require_relative "json_schema"
7
-
8
- module ActiveAgent
9
- module Providers
10
- module OpenAI
11
- module Responses
12
- module Requests
13
- module TextFormats
14
- # ActiveModel type for casting and serializing Text format objects
15
- class FormatType < ActiveModel::Type::Value
16
- def cast(value)
17
- case value
18
- when Plain, JsonObject, JsonSchema
19
- value
20
- when Hash
21
- create_format_from_hash(value)
22
- when String
23
- create_format_from_string(value)
24
- when nil
25
- nil
26
- else
27
- raise ArgumentError, "Cannot cast #{value.class} to Format"
28
- end
29
- end
30
-
31
- def serialize(value)
32
- case value
33
- when Plain, JsonObject, JsonSchema
34
- value.serialize
35
- when Hash
36
- value
37
- when nil
38
- nil
39
- else
40
- raise ArgumentError, "Cannot serialize #{value.class}"
41
- end
42
- end
43
-
44
- def deserialize(value)
45
- cast(value)
46
- end
47
-
48
- private
49
-
50
- def create_format_from_hash(hash)
51
- hash = hash.deep_symbolize_keys
52
- type = hash[:type]
53
-
54
- case type
55
- when "text"
56
- Plain.new
57
- when "json_object"
58
- JsonObject.new
59
- when "json_schema"
60
- JsonSchema.new(
61
- name: hash[:name],
62
- description: hash[:description],
63
- schema: hash[:schema],
64
- strict: hash[:strict]
65
- )
66
- else
67
- nil
68
- end
69
- end
70
-
71
- def create_format_from_string(value)
72
- case value
73
- when "text"
74
- Plain.new
75
- when "json_object"
76
- JsonObject.new
77
- when "json_schema"
78
- JsonSchema.new
79
- else
80
- nil
81
- end
82
- end
83
- end
84
- end
85
- end
86
- end
87
- end
88
- end
89
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_agent/providers/common/model"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module TextFormats
11
- # Base class for text format configurations
12
- class Base < Common::BaseModel
13
- attribute :type, :string
14
-
15
- validates :type, inclusion: { in: %w[text json_object json_schema] }, allow_nil: false
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module TextFormats
11
- # JSON object format (older method)
12
- class JsonObject < Base
13
- attribute :type, :string, as: "json_object"
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module TextFormats
11
- # JSON schema format for structured outputs
12
- class JsonSchema < Base
13
- attribute :type, :string, as: "json_schema"
14
-
15
- # Name of the response format
16
- attribute :name, :string
17
-
18
- # Description of what the response format is for
19
- attribute :description, :string
20
-
21
- # The JSON schema object
22
- attribute :schema # Hash
23
-
24
- # Whether to enable strict schema adherence
25
- attribute :strict, :boolean, default: false
26
-
27
- validates :name, presence: true
28
- validates :schema, presence: true
29
-
30
- validate :validate_schema_structure
31
-
32
- private
33
-
34
- def validate_schema_structure
35
- return if schema.blank?
36
- return unless schema.is_a?(Hash)
37
-
38
- unless schema.key?("type") || schema.key?(:type)
39
- errors.add(:schema, "must include a 'type' property")
40
- end
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end
48
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base"
4
-
5
- module ActiveAgent
6
- module Providers
7
- module OpenAI
8
- module Responses
9
- module Requests
10
- module TextFormats
11
- # Plain text format
12
- class Plain < Base
13
- attribute :type, :string, as: "text"
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_agent/providers/common/model"
4
- require_relative "text/_types"
5
-
6
- module ActiveAgent
7
- module Providers
8
- module OpenAI
9
- module Responses
10
- module Requests
11
- class Text < Common::BaseModel
12
- # Format configuration for text output
13
- attribute :format, TextFormats::FormatType.new
14
-
15
- # Modalities for output
16
- attribute :modalities, default: -> { [] } # Array of strings
17
-
18
- # Verbosity setting
19
- attribute :verbosity, :string
20
-
21
- validates :verbosity, inclusion: { in: %w[concise default verbose] }, allow_nil: true
22
-
23
- # Common Format compatibility - maps format.type to type
24
- def type
25
- format&.type
26
- end
27
-
28
- def type=(value)
29
- self.format = value
30
- end
31
-
32
- # For Common Format
33
- def json_schema=(value)
34
- self.format = { type: "json_schema", **value }
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end