roast-ai 0.4.4 → 0.4.5

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 (231) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +2 -0
  3. data/.github/workflows/ci.yaml +1 -0
  4. data/.gitignore +0 -26
  5. data/.rubocop.yml +13 -0
  6. data/.rubocop_todo.yml +21 -0
  7. data/CHANGELOG.md +29 -0
  8. data/Gemfile +4 -0
  9. data/Gemfile.lock +43 -1
  10. data/bin/rubocop +27 -0
  11. data/bin/spoom +27 -0
  12. data/bin/srb +27 -0
  13. data/bin/srb-rbi +27 -0
  14. data/bin/tapioca +27 -0
  15. data/docs/INSTRUMENTATION.md +3 -3
  16. data/dsl/simple.rb +10 -0
  17. data/lib/roast/dsl/executor.rb +26 -0
  18. data/lib/roast/dsl.rb +7 -0
  19. data/lib/roast/errors.rb +1 -0
  20. data/lib/roast/factories/api_provider_factory.rb +1 -0
  21. data/lib/roast/helpers/function_caching_interceptor.rb +3 -0
  22. data/lib/roast/helpers/logger.rb +6 -9
  23. data/lib/roast/helpers/metadata_access.rb +1 -0
  24. data/lib/roast/helpers/minitest_coverage_runner.rb +1 -0
  25. data/lib/roast/helpers/path_resolver.rb +8 -18
  26. data/lib/roast/helpers/prompt_loader.rb +3 -2
  27. data/lib/roast/helpers/timeout_handler.rb +3 -5
  28. data/lib/roast/initializers.rb +1 -0
  29. data/lib/roast/resources/api_resource.rb +4 -3
  30. data/lib/roast/resources/base_resource.rb +1 -0
  31. data/lib/roast/resources/directory_resource.rb +1 -0
  32. data/lib/roast/resources/file_resource.rb +1 -0
  33. data/lib/roast/resources/none_resource.rb +1 -0
  34. data/lib/roast/resources/url_resource.rb +2 -1
  35. data/lib/roast/resources.rb +1 -2
  36. data/lib/roast/services/context_threshold_checker.rb +1 -0
  37. data/lib/roast/services/token_counting_service.rb +1 -0
  38. data/lib/roast/tools/apply_diff.rb +1 -0
  39. data/lib/roast/tools/ask_user.rb +1 -0
  40. data/lib/roast/tools/bash.rb +1 -0
  41. data/lib/roast/tools/cmd.rb +1 -0
  42. data/lib/roast/tools/coding_agent.rb +1 -0
  43. data/lib/roast/tools/context_summarizer.rb +1 -0
  44. data/lib/roast/tools/grep.rb +1 -0
  45. data/lib/roast/tools/helpers/coding_agent_message_formatter.rb +1 -0
  46. data/lib/roast/tools/read_file.rb +1 -0
  47. data/lib/roast/tools/search_file.rb +1 -0
  48. data/lib/roast/tools/swarm.rb +1 -0
  49. data/lib/roast/tools/update_files.rb +1 -0
  50. data/lib/roast/tools/write_file.rb +1 -0
  51. data/lib/roast/tools.rb +2 -0
  52. data/lib/roast/value_objects/api_token.rb +1 -0
  53. data/lib/roast/value_objects/step_name.rb +1 -0
  54. data/lib/roast/value_objects/uri_base.rb +1 -0
  55. data/lib/roast/value_objects/workflow_path.rb +1 -0
  56. data/lib/roast/value_objects.rb +1 -0
  57. data/lib/roast/version.rb +2 -1
  58. data/lib/roast/workflow/agent_step.rb +1 -0
  59. data/lib/roast/workflow/api_configuration.rb +1 -0
  60. data/lib/roast/workflow/base_iteration_step.rb +1 -0
  61. data/lib/roast/workflow/base_step.rb +1 -0
  62. data/lib/roast/workflow/base_workflow.rb +1 -0
  63. data/lib/roast/workflow/case_executor.rb +1 -0
  64. data/lib/roast/workflow/case_step.rb +1 -0
  65. data/lib/roast/workflow/command_executor.rb +1 -0
  66. data/lib/roast/workflow/conditional_executor.rb +1 -0
  67. data/lib/roast/workflow/conditional_step.rb +1 -0
  68. data/lib/roast/workflow/configuration.rb +9 -0
  69. data/lib/roast/workflow/configuration_loader.rb +4 -1
  70. data/lib/roast/workflow/context_manager.rb +1 -0
  71. data/lib/roast/workflow/context_path_resolver.rb +1 -0
  72. data/lib/roast/workflow/dot_access_hash.rb +1 -0
  73. data/lib/roast/workflow/each_step.rb +1 -0
  74. data/lib/roast/workflow/error_handler.rb +7 -1
  75. data/lib/roast/workflow/expression_evaluator.rb +1 -0
  76. data/lib/roast/workflow/expression_utils.rb +1 -0
  77. data/lib/roast/workflow/file_state_repository.rb +2 -1
  78. data/lib/roast/workflow/input_executor.rb +1 -0
  79. data/lib/roast/workflow/input_step.rb +1 -0
  80. data/lib/roast/workflow/interpolator.rb +2 -1
  81. data/lib/roast/workflow/iteration_executor.rb +1 -0
  82. data/lib/roast/workflow/llm_boolean_coercer.rb +1 -0
  83. data/lib/roast/workflow/metadata_manager.rb +1 -0
  84. data/lib/roast/workflow/output_handler.rb +1 -0
  85. data/lib/roast/workflow/output_manager.rb +1 -0
  86. data/lib/roast/workflow/parallel_executor.rb +1 -0
  87. data/lib/roast/workflow/prompt_step.rb +1 -0
  88. data/lib/roast/workflow/repeat_step.rb +1 -0
  89. data/lib/roast/workflow/replay_handler.rb +1 -0
  90. data/lib/roast/workflow/resource_resolver.rb +2 -6
  91. data/lib/roast/workflow/session_manager.rb +1 -0
  92. data/lib/roast/workflow/shell_script_step.rb +1 -0
  93. data/lib/roast/workflow/sqlite_state_repository.rb +1 -0
  94. data/lib/roast/workflow/state_manager.rb +1 -0
  95. data/lib/roast/workflow/state_repository.rb +1 -0
  96. data/lib/roast/workflow/state_repository_factory.rb +4 -2
  97. data/lib/roast/workflow/step_completion_reporter.rb +1 -0
  98. data/lib/roast/workflow/step_executor_coordinator.rb +9 -5
  99. data/lib/roast/workflow/step_executor_factory.rb +1 -0
  100. data/lib/roast/workflow/step_executor_registry.rb +2 -3
  101. data/lib/roast/workflow/step_executor_with_reporting.rb +1 -0
  102. data/lib/roast/workflow/step_executors/base_step_executor.rb +1 -0
  103. data/lib/roast/workflow/step_executors/hash_step_executor.rb +1 -0
  104. data/lib/roast/workflow/step_executors/parallel_step_executor.rb +1 -0
  105. data/lib/roast/workflow/step_executors/string_step_executor.rb +1 -0
  106. data/lib/roast/workflow/step_factory.rb +1 -0
  107. data/lib/roast/workflow/step_finder.rb +1 -0
  108. data/lib/roast/workflow/step_loader.rb +1 -0
  109. data/lib/roast/workflow/step_name_extractor.rb +1 -0
  110. data/lib/roast/workflow/step_runner.rb +1 -0
  111. data/lib/roast/workflow/step_type_resolver.rb +1 -0
  112. data/lib/roast/workflow/validation_command.rb +1 -0
  113. data/lib/roast/workflow/validator.rb +1 -0
  114. data/lib/roast/workflow/validators/base_validator.rb +1 -0
  115. data/lib/roast/workflow/validators/dependency_validator.rb +1 -0
  116. data/lib/roast/workflow/validators/linting_validator.rb +1 -0
  117. data/lib/roast/workflow/validators/schema_validator.rb +1 -0
  118. data/lib/roast/workflow/validators/step_collector.rb +1 -0
  119. data/lib/roast/workflow/validators/validation_orchestrator.rb +1 -0
  120. data/lib/roast/workflow/workflow_context.rb +1 -0
  121. data/lib/roast/workflow/workflow_execution_context.rb +1 -0
  122. data/lib/roast/workflow/workflow_executor.rb +2 -1
  123. data/lib/roast/workflow/workflow_initializer.rb +1 -0
  124. data/lib/roast/workflow/workflow_runner.rb +66 -55
  125. data/lib/roast/workflow.rb +1 -0
  126. data/lib/roast/workflow_diagram_generator.rb +3 -2
  127. data/lib/roast.rb +23 -8
  128. data/sorbet/config +8 -0
  129. data/sorbet/rbi/dsl/.gitattributes +1 -0
  130. data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
  131. data/sorbet/rbi/gems/.gitattributes +1 -0
  132. data/sorbet/rbi/gems/activesupport@8.0.2.rbi +19107 -0
  133. data/sorbet/rbi/gems/addressable@2.8.7.rbi +1994 -0
  134. data/sorbet/rbi/gems/ast@2.4.3.rbi +585 -0
  135. data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
  136. data/sorbet/rbi/gems/benchmark@0.4.1.rbi +619 -0
  137. data/sorbet/rbi/gems/bigdecimal@3.2.2.rbi +62 -0
  138. data/sorbet/rbi/gems/cgi@0.5.0.rbi +2961 -0
  139. data/sorbet/rbi/gems/claude_swarm@0.1.19.rbi +568 -0
  140. data/sorbet/rbi/gems/cli-kit@5.0.1.rbi +1991 -0
  141. data/sorbet/rbi/gems/cli-ui@2.3.0.rbi +3181 -0
  142. data/sorbet/rbi/gems/coderay@1.1.3.rbi +9 -0
  143. data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +11657 -0
  144. data/sorbet/rbi/gems/connection_pool@2.5.3.rbi +9 -0
  145. data/sorbet/rbi/gems/crack@1.0.0.rbi +145 -0
  146. data/sorbet/rbi/gems/diff-lcs@1.6.2.rbi +972 -0
  147. data/sorbet/rbi/gems/dotenv@3.1.8.rbi +295 -0
  148. data/sorbet/rbi/gems/drb@2.2.3.rbi +1661 -0
  149. data/sorbet/rbi/gems/dry-configurable@1.3.0.rbi +672 -0
  150. data/sorbet/rbi/gems/dry-core@1.1.0.rbi +1894 -0
  151. data/sorbet/rbi/gems/dry-inflector@1.2.0.rbi +659 -0
  152. data/sorbet/rbi/gems/dry-initializer@3.2.0.rbi +781 -0
  153. data/sorbet/rbi/gems/dry-logic@1.6.0.rbi +1127 -0
  154. data/sorbet/rbi/gems/dry-schema@1.14.1.rbi +3727 -0
  155. data/sorbet/rbi/gems/dry-types@1.8.3.rbi +3969 -0
  156. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  157. data/sorbet/rbi/gems/event_stream_parser@1.0.0.rbi +49 -0
  158. data/sorbet/rbi/gems/faraday-multipart@1.1.1.rbi +283 -0
  159. data/sorbet/rbi/gems/faraday-net_http@3.4.1.rbi +147 -0
  160. data/sorbet/rbi/gems/faraday-retry@2.3.2.rbi +9 -0
  161. data/sorbet/rbi/gems/faraday@2.13.1.rbi +2977 -0
  162. data/sorbet/rbi/gems/fast-mcp-annotations@1.5.3.rbi +1588 -0
  163. data/sorbet/rbi/gems/ffi@1.17.2.rbi +9 -0
  164. data/sorbet/rbi/gems/formatador@1.1.0.rbi +9 -0
  165. data/sorbet/rbi/gems/guard-compat@1.2.1.rbi +102 -0
  166. data/sorbet/rbi/gems/guard-minitest@2.4.6.rbi +402 -0
  167. data/sorbet/rbi/gems/guard@2.19.1.rbi +2283 -0
  168. data/sorbet/rbi/gems/hashdiff@1.2.0.rbi +355 -0
  169. data/sorbet/rbi/gems/i18n@1.14.7.rbi +2359 -0
  170. data/sorbet/rbi/gems/json-schema@5.1.1.rbi +1466 -0
  171. data/sorbet/rbi/gems/json@2.12.2.rbi +2051 -0
  172. data/sorbet/rbi/gems/language_server-protocol@3.17.0.5.rbi +9 -0
  173. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +9 -0
  174. data/sorbet/rbi/gems/listen@3.9.0.rbi +1206 -0
  175. data/sorbet/rbi/gems/logger@1.7.0.rbi +963 -0
  176. data/sorbet/rbi/gems/lumberjack@1.2.10.rbi +1830 -0
  177. data/sorbet/rbi/gems/method_source@1.1.0.rbi +9 -0
  178. data/sorbet/rbi/gems/mime-types-data@3.2025.0617.rbi +136 -0
  179. data/sorbet/rbi/gems/mime-types@3.7.0.rbi +1342 -0
  180. data/sorbet/rbi/gems/minitest-rg@5.3.0.rbi +160 -0
  181. data/sorbet/rbi/gems/minitest@5.25.5.rbi +1640 -0
  182. data/sorbet/rbi/gems/mocha@2.7.1.rbi +12 -0
  183. data/sorbet/rbi/gems/multipart-post@2.4.1.rbi +244 -0
  184. data/sorbet/rbi/gems/nenv@0.3.0.rbi +147 -0
  185. data/sorbet/rbi/gems/net-http@0.6.0.rbi +4247 -0
  186. data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
  187. data/sorbet/rbi/gems/notiffany@0.1.3.rbi +1079 -0
  188. data/sorbet/rbi/gems/open_router@0.3.3.rbi +230 -0
  189. data/sorbet/rbi/gems/ostruct@0.6.2.rbi +354 -0
  190. data/sorbet/rbi/gems/parallel@1.27.0.rbi +291 -0
  191. data/sorbet/rbi/gems/parser@3.3.8.0.rbi +5535 -0
  192. data/sorbet/rbi/gems/prism@1.4.0.rbi +41732 -0
  193. data/sorbet/rbi/gems/pry@0.15.2.rbi +9 -0
  194. data/sorbet/rbi/gems/public_suffix@6.0.2.rbi +936 -0
  195. data/sorbet/rbi/gems/racc@1.8.1.rbi +158 -0
  196. data/sorbet/rbi/gems/rack@2.2.17.rbi +5659 -0
  197. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +9 -0
  198. data/sorbet/rbi/gems/raix@1.0.2.rbi +1104 -0
  199. data/sorbet/rbi/gems/rake@13.3.0.rbi +3036 -0
  200. data/sorbet/rbi/gems/rb-fsevent@0.11.2.rbi +9 -0
  201. data/sorbet/rbi/gems/rb-inotify@0.11.1.rbi +9 -0
  202. data/sorbet/rbi/gems/rbi@0.3.6.rbi +6893 -0
  203. data/sorbet/rbi/gems/rbs@3.9.4.rbi +6978 -0
  204. data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +9 -0
  205. data/sorbet/rbi/gems/rexml@3.4.1.rbi +5346 -0
  206. data/sorbet/rbi/gems/rubocop-ast@1.45.1.rbi +9 -0
  207. data/sorbet/rbi/gems/rubocop-shopify@2.17.1.rbi +9 -0
  208. data/sorbet/rbi/gems/rubocop@1.77.0.rbi +9 -0
  209. data/sorbet/rbi/gems/ruby-graphviz@1.2.5.rbi +1333 -0
  210. data/sorbet/rbi/gems/ruby-openai@8.1.0.rbi +758 -0
  211. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +9 -0
  212. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +9 -0
  213. data/sorbet/rbi/gems/securerandom@0.4.1.rbi +75 -0
  214. data/sorbet/rbi/gems/shellany@0.0.1.rbi +102 -0
  215. data/sorbet/rbi/gems/spoom@1.6.3.rbi +6985 -0
  216. data/sorbet/rbi/gems/sqlite3@2.7.0.rbi +1900 -0
  217. data/sorbet/rbi/gems/tapioca@0.16.11.rbi +3628 -0
  218. data/sorbet/rbi/gems/thor@1.4.0.rbi +4399 -0
  219. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5918 -0
  220. data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +9 -0
  221. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +9 -0
  222. data/sorbet/rbi/gems/uri@1.0.3.rbi +2349 -0
  223. data/sorbet/rbi/gems/vcr@6.3.1.rbi +3040 -0
  224. data/sorbet/rbi/gems/webmock@3.25.1.rbi +1792 -0
  225. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
  226. data/sorbet/rbi/gems/yard@0.9.37.rbi +18492 -0
  227. data/sorbet/rbi/gems/zeitwerk@2.7.3.rbi +1429 -0
  228. data/sorbet/tapioca/config.yml +13 -0
  229. data/sorbet/tapioca/require.rb +36 -0
  230. metadata +113 -2
  231. data/lib/roast/workflow/configuration_parser.rb +0 -54
@@ -0,0 +1,1104 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `raix` gem.
5
+ # Please instead update this file by running `bin/tapioca gem raix`.
6
+
7
+
8
+ # The Raix module provides configuration options for the Raix gem.
9
+ #
10
+ # source://raix//lib/raix/version.rb#3
11
+ module Raix
12
+ class << self
13
+ # Returns the current configuration instance.
14
+ #
15
+ # source://raix//lib/raix.rb#19
16
+ def configuration; end
17
+
18
+ # Sets the attribute configuration
19
+ #
20
+ # @param value the value to set the attribute configuration to.
21
+ #
22
+ # source://raix//lib/raix.rb#15
23
+ def configuration=(_arg0); end
24
+
25
+ # Configures the Raix gem using a block.
26
+ #
27
+ # @yield [configuration]
28
+ #
29
+ # source://raix//lib/raix.rb#24
30
+ def configure; end
31
+ end
32
+ end
33
+
34
+ # The `ChatCompletion` module is a Rails concern that provides a way to interact
35
+ # with the OpenRouter Chat Completion API via its client. The module includes a few
36
+ # methods that allow you to build a transcript of messages and then send them to
37
+ # the API for completion. The API will return a response that you can use however
38
+ # you see fit.
39
+ #
40
+ # When the AI responds with tool function calls instead of a text message, this
41
+ # module automatically:
42
+ # 1. Executes the requested tool functions
43
+ # 2. Adds the function results to the conversation transcript
44
+ # 3. Sends the updated transcript back to the AI for another completion
45
+ # 4. Repeats this process until the AI responds with a regular text message
46
+ #
47
+ # This automatic continuation ensures that tool calls are seamlessly integrated
48
+ # into the conversation flow. The AI can use tool results to formulate its final
49
+ # response to the user. You can limit the number of tool calls using the
50
+ # `max_tool_calls` parameter to prevent excessive function invocations.
51
+ #
52
+ # Tool functions must be defined on the class that includes this module. The
53
+ # `FunctionDispatch` module provides a Rails-like DSL for declaring these
54
+ # functions at the class level, which is cleaner than implementing them as
55
+ # instance methods.
56
+ #
57
+ # Note that some AI models can make multiple tool function calls in a single
58
+ # response. When that happens, the module executes all requested functions
59
+ # before continuing the conversation.
60
+ #
61
+ # source://raix//lib/raix/chat_completion.rb#40
62
+ module Raix::ChatCompletion
63
+ extend ::ActiveSupport::Concern
64
+
65
+ mixes_in_class_methods ::Raix::ChatCompletion::ClassMethods
66
+
67
+ # Returns the value of attribute available_tools.
68
+ #
69
+ # source://raix//lib/raix/chat_completion.rb#43
70
+ def available_tools; end
71
+
72
+ # Sets the attribute available_tools
73
+ #
74
+ # @param value the value to set the attribute available_tools to.
75
+ #
76
+ # source://raix//lib/raix/chat_completion.rb#43
77
+ def available_tools=(_arg0); end
78
+
79
+ # Returns the value of attribute cache_at.
80
+ #
81
+ # source://raix//lib/raix/chat_completion.rb#43
82
+ def cache_at; end
83
+
84
+ # Sets the attribute cache_at
85
+ #
86
+ # @param value the value to set the attribute cache_at to.
87
+ #
88
+ # source://raix//lib/raix/chat_completion.rb#43
89
+ def cache_at=(_arg0); end
90
+
91
+ # This method performs chat completion based on the provided transcript and parameters.
92
+ #
93
+ # @option loop
94
+ # @option params
95
+ # @option params
96
+ # @option params
97
+ # @option params
98
+ # @option tools
99
+ # @option max_tool_calls
100
+ # @param params [Hash] The parameters for chat completion.
101
+ # @param loop [Hash] a customizable set of options
102
+ # @param tools [Hash] a customizable set of options
103
+ # @param max_tool_calls [Hash] a customizable set of options
104
+ # @return [String|Hash] The completed chat response.
105
+ #
106
+ # source://raix//lib/raix/chat_completion.rb#76
107
+ def chat_completion(params: T.unsafe(nil), loop: T.unsafe(nil), json: T.unsafe(nil), raw: T.unsafe(nil), openai: T.unsafe(nil), save_response: T.unsafe(nil), messages: T.unsafe(nil), available_tools: T.unsafe(nil), max_tool_calls: T.unsafe(nil)); end
108
+
109
+ # Instance level access to the class-level configuration.
110
+ #
111
+ # source://raix//lib/raix/chat_completion.rb#61
112
+ def configuration; end
113
+
114
+ # Dispatches a tool function call with the given function name and arguments.
115
+ # This method can be overridden in subclasses to customize how function calls are handled.
116
+ #
117
+ # @param function_name [String] The name of the function to call
118
+ # @param arguments [Hash] The arguments to pass to the function
119
+ # @param cache [ActiveSupport::Cache] Optional cache object
120
+ # @return [Object] The result of the function call
121
+ #
122
+ # source://raix//lib/raix/chat_completion.rb#292
123
+ def dispatch_tool_function(function_name, arguments, cache: T.unsafe(nil)); end
124
+
125
+ # Returns the value of attribute frequency_penalty.
126
+ #
127
+ # source://raix//lib/raix/chat_completion.rb#43
128
+ def frequency_penalty; end
129
+
130
+ # Sets the attribute frequency_penalty
131
+ #
132
+ # @param value the value to set the attribute frequency_penalty to.
133
+ #
134
+ # source://raix//lib/raix/chat_completion.rb#43
135
+ def frequency_penalty=(_arg0); end
136
+
137
+ # Returns the value of attribute logit_bias.
138
+ #
139
+ # source://raix//lib/raix/chat_completion.rb#43
140
+ def logit_bias; end
141
+
142
+ # Sets the attribute logit_bias
143
+ #
144
+ # @param value the value to set the attribute logit_bias to.
145
+ #
146
+ # source://raix//lib/raix/chat_completion.rb#43
147
+ def logit_bias=(_arg0); end
148
+
149
+ # Returns the value of attribute logprobs.
150
+ #
151
+ # source://raix//lib/raix/chat_completion.rb#43
152
+ def logprobs; end
153
+
154
+ # Sets the attribute logprobs
155
+ #
156
+ # @param value the value to set the attribute logprobs to.
157
+ #
158
+ # source://raix//lib/raix/chat_completion.rb#43
159
+ def logprobs=(_arg0); end
160
+
161
+ # Returns the value of attribute loop.
162
+ #
163
+ # source://raix//lib/raix/chat_completion.rb#43
164
+ def loop; end
165
+
166
+ # Sets the attribute loop
167
+ #
168
+ # @param value the value to set the attribute loop to.
169
+ #
170
+ # source://raix//lib/raix/chat_completion.rb#43
171
+ def loop=(_arg0); end
172
+
173
+ # Returns the value of attribute max_completion_tokens.
174
+ #
175
+ # source://raix//lib/raix/chat_completion.rb#43
176
+ def max_completion_tokens; end
177
+
178
+ # Sets the attribute max_completion_tokens
179
+ #
180
+ # @param value the value to set the attribute max_completion_tokens to.
181
+ #
182
+ # source://raix//lib/raix/chat_completion.rb#43
183
+ def max_completion_tokens=(_arg0); end
184
+
185
+ # Returns the value of attribute max_tokens.
186
+ #
187
+ # source://raix//lib/raix/chat_completion.rb#43
188
+ def max_tokens; end
189
+
190
+ # Sets the attribute max_tokens
191
+ #
192
+ # @param value the value to set the attribute max_tokens to.
193
+ #
194
+ # source://raix//lib/raix/chat_completion.rb#43
195
+ def max_tokens=(_arg0); end
196
+
197
+ # Returns the value of attribute max_tool_calls.
198
+ #
199
+ # source://raix//lib/raix/chat_completion.rb#43
200
+ def max_tool_calls; end
201
+
202
+ # Sets the attribute max_tool_calls
203
+ #
204
+ # @param value the value to set the attribute max_tool_calls to.
205
+ #
206
+ # source://raix//lib/raix/chat_completion.rb#43
207
+ def max_tool_calls=(_arg0); end
208
+
209
+ # Returns the value of attribute min_p.
210
+ #
211
+ # source://raix//lib/raix/chat_completion.rb#43
212
+ def min_p; end
213
+
214
+ # Sets the attribute min_p
215
+ #
216
+ # @param value the value to set the attribute min_p to.
217
+ #
218
+ # source://raix//lib/raix/chat_completion.rb#43
219
+ def min_p=(_arg0); end
220
+
221
+ # Returns the value of attribute model.
222
+ #
223
+ # source://raix//lib/raix/chat_completion.rb#43
224
+ def model; end
225
+
226
+ # Sets the attribute model
227
+ #
228
+ # @param value the value to set the attribute model to.
229
+ #
230
+ # source://raix//lib/raix/chat_completion.rb#43
231
+ def model=(_arg0); end
232
+
233
+ # Returns the value of attribute prediction.
234
+ #
235
+ # source://raix//lib/raix/chat_completion.rb#43
236
+ def prediction; end
237
+
238
+ # Sets the attribute prediction
239
+ #
240
+ # @param value the value to set the attribute prediction to.
241
+ #
242
+ # source://raix//lib/raix/chat_completion.rb#43
243
+ def prediction=(_arg0); end
244
+
245
+ # Returns the value of attribute presence_penalty.
246
+ #
247
+ # source://raix//lib/raix/chat_completion.rb#43
248
+ def presence_penalty; end
249
+
250
+ # Sets the attribute presence_penalty
251
+ #
252
+ # @param value the value to set the attribute presence_penalty to.
253
+ #
254
+ # source://raix//lib/raix/chat_completion.rb#43
255
+ def presence_penalty=(_arg0); end
256
+
257
+ # Returns the value of attribute provider.
258
+ #
259
+ # source://raix//lib/raix/chat_completion.rb#43
260
+ def provider; end
261
+
262
+ # Sets the attribute provider
263
+ #
264
+ # @param value the value to set the attribute provider to.
265
+ #
266
+ # source://raix//lib/raix/chat_completion.rb#43
267
+ def provider=(_arg0); end
268
+
269
+ # Returns the value of attribute repetition_penalty.
270
+ #
271
+ # source://raix//lib/raix/chat_completion.rb#43
272
+ def repetition_penalty; end
273
+
274
+ # Sets the attribute repetition_penalty
275
+ #
276
+ # @param value the value to set the attribute repetition_penalty to.
277
+ #
278
+ # source://raix//lib/raix/chat_completion.rb#43
279
+ def repetition_penalty=(_arg0); end
280
+
281
+ # Returns the value of attribute response_format.
282
+ #
283
+ # source://raix//lib/raix/chat_completion.rb#43
284
+ def response_format; end
285
+
286
+ # Sets the attribute response_format
287
+ #
288
+ # @param value the value to set the attribute response_format to.
289
+ #
290
+ # source://raix//lib/raix/chat_completion.rb#43
291
+ def response_format=(_arg0); end
292
+
293
+ # Returns the value of attribute seed.
294
+ #
295
+ # source://raix//lib/raix/chat_completion.rb#43
296
+ def seed; end
297
+
298
+ # Sets the attribute seed
299
+ #
300
+ # @param value the value to set the attribute seed to.
301
+ #
302
+ # source://raix//lib/raix/chat_completion.rb#43
303
+ def seed=(_arg0); end
304
+
305
+ # Returns the value of attribute stop.
306
+ #
307
+ # source://raix//lib/raix/chat_completion.rb#43
308
+ def stop; end
309
+
310
+ # Sets the attribute stop
311
+ #
312
+ # @param value the value to set the attribute stop to.
313
+ #
314
+ # source://raix//lib/raix/chat_completion.rb#43
315
+ def stop=(_arg0); end
316
+
317
+ # Returns the value of attribute stop_tool_calls_and_respond.
318
+ #
319
+ # source://raix//lib/raix/chat_completion.rb#43
320
+ def stop_tool_calls_and_respond; end
321
+
322
+ # Sets the attribute stop_tool_calls_and_respond
323
+ #
324
+ # @param value the value to set the attribute stop_tool_calls_and_respond to.
325
+ #
326
+ # source://raix//lib/raix/chat_completion.rb#43
327
+ def stop_tool_calls_and_respond=(_arg0); end
328
+
329
+ # Returns the value of attribute stream.
330
+ #
331
+ # source://raix//lib/raix/chat_completion.rb#43
332
+ def stream; end
333
+
334
+ # Sets the attribute stream
335
+ #
336
+ # @param value the value to set the attribute stream to.
337
+ #
338
+ # source://raix//lib/raix/chat_completion.rb#43
339
+ def stream=(_arg0); end
340
+
341
+ # Returns the value of attribute temperature.
342
+ #
343
+ # source://raix//lib/raix/chat_completion.rb#43
344
+ def temperature; end
345
+
346
+ # Sets the attribute temperature
347
+ #
348
+ # @param value the value to set the attribute temperature to.
349
+ #
350
+ # source://raix//lib/raix/chat_completion.rb#43
351
+ def temperature=(_arg0); end
352
+
353
+ # Returns the value of attribute tool_choice.
354
+ #
355
+ # source://raix//lib/raix/chat_completion.rb#43
356
+ def tool_choice; end
357
+
358
+ # Sets the attribute tool_choice
359
+ #
360
+ # @param value the value to set the attribute tool_choice to.
361
+ #
362
+ # source://raix//lib/raix/chat_completion.rb#43
363
+ def tool_choice=(_arg0); end
364
+
365
+ # Returns the value of attribute tools.
366
+ #
367
+ # source://raix//lib/raix/chat_completion.rb#43
368
+ def tools; end
369
+
370
+ # Sets the attribute tools
371
+ #
372
+ # @param value the value to set the attribute tools to.
373
+ #
374
+ # source://raix//lib/raix/chat_completion.rb#43
375
+ def tools=(_arg0); end
376
+
377
+ # Returns the value of attribute top_a.
378
+ #
379
+ # source://raix//lib/raix/chat_completion.rb#43
380
+ def top_a; end
381
+
382
+ # Sets the attribute top_a
383
+ #
384
+ # @param value the value to set the attribute top_a to.
385
+ #
386
+ # source://raix//lib/raix/chat_completion.rb#43
387
+ def top_a=(_arg0); end
388
+
389
+ # Returns the value of attribute top_k.
390
+ #
391
+ # source://raix//lib/raix/chat_completion.rb#43
392
+ def top_k; end
393
+
394
+ # Sets the attribute top_k
395
+ #
396
+ # @param value the value to set the attribute top_k to.
397
+ #
398
+ # source://raix//lib/raix/chat_completion.rb#43
399
+ def top_k=(_arg0); end
400
+
401
+ # Returns the value of attribute top_logprobs.
402
+ #
403
+ # source://raix//lib/raix/chat_completion.rb#43
404
+ def top_logprobs; end
405
+
406
+ # Sets the attribute top_logprobs
407
+ #
408
+ # @param value the value to set the attribute top_logprobs to.
409
+ #
410
+ # source://raix//lib/raix/chat_completion.rb#43
411
+ def top_logprobs=(_arg0); end
412
+
413
+ # Returns the value of attribute top_p.
414
+ #
415
+ # source://raix//lib/raix/chat_completion.rb#43
416
+ def top_p; end
417
+
418
+ # Sets the attribute top_p
419
+ #
420
+ # @param value the value to set the attribute top_p to.
421
+ #
422
+ # source://raix//lib/raix/chat_completion.rb#43
423
+ def top_p=(_arg0); end
424
+
425
+ # This method returns the transcript array.
426
+ # Manually add your messages to it in the following abbreviated format
427
+ # before calling `chat_completion`.
428
+ #
429
+ # { system: "You are a pumpkin" },
430
+ # { user: "Hey what time is it?" },
431
+ # { assistant: "Sorry, pumpkins do not wear watches" }
432
+ #
433
+ # to add a function call use the following format:
434
+ # { function: { name: 'fancy_pants_function', arguments: { param: 'value' } } }
435
+ #
436
+ # to add a function result use the following format:
437
+ # { function: result, name: 'fancy_pants_function' }
438
+ #
439
+ # @return [Array] The transcript array.
440
+ #
441
+ # source://raix//lib/raix/chat_completion.rb#281
442
+ def transcript; end
443
+
444
+ private
445
+
446
+ # @raise [UndeclaredToolError]
447
+ #
448
+ # source://raix//lib/raix/chat_completion.rb#298
449
+ def filtered_tools(tool_names); end
450
+
451
+ # source://raix//lib/raix/chat_completion.rb#310
452
+ def openai_request(params:, model:, messages:); end
453
+
454
+ # source://raix//lib/raix/chat_completion.rb#326
455
+ def openrouter_request(params:, model:, messages:); end
456
+ end
457
+
458
+ # source://raix//lib/raix/chat_completion.rb#0
459
+ module Raix::ChatCompletion::ClassMethods
460
+ # source://raix//lib/raix/chat_completion.rb#50
461
+ def configuration; end
462
+
463
+ # source://raix//lib/raix/chat_completion.rb#55
464
+ def configure; end
465
+ end
466
+
467
+ # The Configuration class holds the configuration options for the Raix gem.
468
+ #
469
+ # source://raix//lib/raix/configuration.rb#5
470
+ class Raix::Configuration
471
+ # Initializes a new instance of the Configuration class with default values.
472
+ #
473
+ # @return [Configuration] a new instance of Configuration
474
+ #
475
+ # source://raix//lib/raix/configuration.rb#50
476
+ def initialize(fallback: T.unsafe(nil)); end
477
+
478
+ # @return [Boolean]
479
+ #
480
+ # source://raix//lib/raix/configuration.rb#59
481
+ def client?; end
482
+
483
+ # source://raix//lib/raix/configuration.rb#7
484
+ def max_completion_tokens; end
485
+
486
+ # source://raix//lib/raix/configuration.rb#14
487
+ def max_completion_tokens=(value); end
488
+
489
+ # source://raix//lib/raix/configuration.rb#7
490
+ def max_tokens; end
491
+
492
+ # source://raix//lib/raix/configuration.rb#14
493
+ def max_tokens=(value); end
494
+
495
+ # source://raix//lib/raix/configuration.rb#7
496
+ def max_tool_calls; end
497
+
498
+ # source://raix//lib/raix/configuration.rb#14
499
+ def max_tool_calls=(value); end
500
+
501
+ # source://raix//lib/raix/configuration.rb#7
502
+ def model; end
503
+
504
+ # source://raix//lib/raix/configuration.rb#14
505
+ def model=(value); end
506
+
507
+ # source://raix//lib/raix/configuration.rb#7
508
+ def openai_client; end
509
+
510
+ # source://raix//lib/raix/configuration.rb#14
511
+ def openai_client=(value); end
512
+
513
+ # source://raix//lib/raix/configuration.rb#7
514
+ def openrouter_client; end
515
+
516
+ # source://raix//lib/raix/configuration.rb#14
517
+ def openrouter_client=(value); end
518
+
519
+ # source://raix//lib/raix/configuration.rb#7
520
+ def temperature; end
521
+
522
+ # source://raix//lib/raix/configuration.rb#14
523
+ def temperature=(value); end
524
+
525
+ private
526
+
527
+ # Returns the value of attribute fallback.
528
+ #
529
+ # source://raix//lib/raix/configuration.rb#65
530
+ def fallback; end
531
+
532
+ # Sets the attribute fallback
533
+ #
534
+ # @param value the value to set the attribute fallback to.
535
+ #
536
+ # source://raix//lib/raix/configuration.rb#65
537
+ def fallback=(_arg0); end
538
+
539
+ # source://raix//lib/raix/configuration.rb#67
540
+ def get_with_fallback(method); end
541
+
542
+ class << self
543
+ # source://raix//lib/raix/configuration.rb#6
544
+ def attr_accessor_with_fallback(method_name); end
545
+ end
546
+ end
547
+
548
+ # source://raix//lib/raix/configuration.rb#44
549
+ Raix::Configuration::DEFAULT_MAX_COMPLETION_TOKENS = T.let(T.unsafe(nil), Integer)
550
+
551
+ # source://raix//lib/raix/configuration.rb#43
552
+ Raix::Configuration::DEFAULT_MAX_TOKENS = T.let(T.unsafe(nil), Integer)
553
+
554
+ # source://raix//lib/raix/configuration.rb#47
555
+ Raix::Configuration::DEFAULT_MAX_TOOL_CALLS = T.let(T.unsafe(nil), Integer)
556
+
557
+ # source://raix//lib/raix/configuration.rb#45
558
+ Raix::Configuration::DEFAULT_MODEL = T.let(T.unsafe(nil), String)
559
+
560
+ # source://raix//lib/raix/configuration.rb#46
561
+ Raix::Configuration::DEFAULT_TEMPERATURE = T.let(T.unsafe(nil), Float)
562
+
563
+ # Provides declarative function definition for ChatCompletion classes.
564
+ #
565
+ # Example:
566
+ #
567
+ # class MeaningOfLife
568
+ # include Raix::ChatCompletion
569
+ # include Raix::FunctionDispatch
570
+ #
571
+ # function :ask_deep_thought do
572
+ # wait 236_682_000_000_000
573
+ # "The meaning of life is 42"
574
+ # end
575
+ #
576
+ # def initialize
577
+ # transcript << { user: "What is the meaning of life?" }
578
+ # chat_completion
579
+ # end
580
+ # end
581
+ #
582
+ # source://raix//lib/raix/function_dispatch.rb#23
583
+ module Raix::FunctionDispatch
584
+ extend ::ActiveSupport::Concern
585
+
586
+ mixes_in_class_methods ::Raix::FunctionDispatch::ClassMethods
587
+
588
+ # source://raix//lib/raix/function_dispatch.rb#114
589
+ def chat_completion(**chat_completion_args); end
590
+
591
+ # Stops the automatic continuation of chat completions after this function call.
592
+ # Useful when you want to halt processing within a function and force the AI
593
+ # to provide a text response without making additional tool calls.
594
+ #
595
+ # source://raix//lib/raix/function_dispatch.rb#122
596
+ def stop_tool_calls_and_respond!; end
597
+
598
+ # source://raix//lib/raix/function_dispatch.rb#126
599
+ def tools; end
600
+ end
601
+
602
+ # source://raix//lib/raix/function_dispatch.rb#0
603
+ module Raix::FunctionDispatch::ClassMethods
604
+ # source://raix//lib/raix/function_dispatch.rb#46
605
+ def function(name, description = T.unsafe(nil), **parameters, &block); end
606
+
607
+ # source://raix//lib/raix/function_dispatch.rb#27
608
+ def functions; end
609
+ end
610
+
611
+ # Model Context Protocol integration for Raix
612
+ #
613
+ # Allows declaring MCP servers with a simple DSL that automatically:
614
+ # - Queries tools from the remote server
615
+ # - Exposes each tool as a function callable by LLMs
616
+ # - Handles transcript recording and response processing
617
+ #
618
+ # source://raix//lib/mcp/tool.rb#2
619
+ module Raix::MCP
620
+ extend ::ActiveSupport::Concern
621
+
622
+ mixes_in_class_methods ::Raix::MCP::ClassMethods
623
+
624
+ private
625
+
626
+ # Coerce argument types based on the JSON schema
627
+ #
628
+ # source://raix//lib/raix/mcp.rb#171
629
+ def coerce_arguments(arguments, schema); end
630
+
631
+ # Coerce a single value based on its schema
632
+ #
633
+ # source://raix//lib/raix/mcp.rb#196
634
+ def coerce_value(value, schema); end
635
+ end
636
+
637
+ # source://raix//lib/raix/mcp.rb#0
638
+ module Raix::MCP::ClassMethods
639
+ # source://raix//lib/raix/mcp.rb#73
640
+ def mcp(client:, only: T.unsafe(nil), except: T.unsafe(nil)); end
641
+
642
+ # source://raix//lib/raix/mcp.rb#44
643
+ def sse_mcp(url, headers: T.unsafe(nil), only: T.unsafe(nil), except: T.unsafe(nil)); end
644
+
645
+ # source://raix//lib/raix/mcp.rb#57
646
+ def stdio_mcp(*args, env: T.unsafe(nil), only: T.unsafe(nil), except: T.unsafe(nil)); end
647
+ end
648
+
649
+ # source://raix//lib/raix/mcp.rb#35
650
+ Raix::MCP::JSONRPC_VERSION = T.let(T.unsafe(nil), String)
651
+
652
+ # Error raised when there's a protocol-level error in MCP communication
653
+ #
654
+ # source://raix//lib/raix/mcp.rb#33
655
+ class Raix::MCP::ProtocolError < ::StandardError; end
656
+
657
+ # Client for communicating with MCP servers via Server-Sent Events (SSE).
658
+ #
659
+ # source://raix//lib/mcp/sse_client.rb#11
660
+ class Raix::MCP::SseClient
661
+ # Creates a new client and establishes SSE connection to discover the JSON-RPC endpoint.
662
+ #
663
+ # @param url [String] the SSE endpoint URL
664
+ # @return [SseClient] a new instance of SseClient
665
+ #
666
+ # source://raix//lib/mcp/sse_client.rb#19
667
+ def initialize(url, headers: T.unsafe(nil)); end
668
+
669
+ # Executes a tool with given arguments.
670
+ # Returns text content directly, or JSON-encoded data for other content types.
671
+ #
672
+ # source://raix//lib/mcp/sse_client.rb#48
673
+ def call_tool(name, **arguments); end
674
+
675
+ # Closes the connection to the server.
676
+ #
677
+ # source://raix//lib/mcp/sse_client.rb#81
678
+ def close; end
679
+
680
+ # Returns available tools from the server.
681
+ #
682
+ # source://raix//lib/mcp/sse_client.rb#33
683
+ def tools; end
684
+
685
+ # source://raix//lib/mcp/sse_client.rb#87
686
+ def unique_key; end
687
+
688
+ private
689
+
690
+ # Builds an absolute URL for candidate relative to base.
691
+ #
692
+ # source://raix//lib/mcp/sse_client.rb#287
693
+ def build_absolute_url(base, candidate); end
694
+
695
+ # Establishes and maintains the SSE connection
696
+ #
697
+ # source://raix//lib/mcp/sse_client.rb#95
698
+ def establish_sse_connection; end
699
+
700
+ # Handle SSE message events
701
+ #
702
+ # source://raix//lib/mcp/sse_client.rb#155
703
+ def handle_message_event(event_data); end
704
+
705
+ # Initialize the MCP session
706
+ #
707
+ # source://raix//lib/mcp/sse_client.rb#175
708
+ def initialize_mcp_session; end
709
+
710
+ # Parses SSE event fields from raw text.
711
+ #
712
+ # source://raix//lib/mcp/sse_client.rb#270
713
+ def parse_sse_fields(event_text); end
714
+
715
+ # Process SSE buffer for complete events
716
+ #
717
+ # source://raix//lib/mcp/sse_client.rb#139
718
+ def process_sse_buffer; end
719
+
720
+ # Send a JSON-RPC request
721
+ #
722
+ # source://raix//lib/mcp/sse_client.rb#199
723
+ def send_json_rpc(id, method, params); end
724
+
725
+ # Send a notification (no response expected)
726
+ #
727
+ # source://raix//lib/mcp/sse_client.rb#221
728
+ def send_notification(method, params); end
729
+
730
+ # Wait for a response with a specific ID
731
+ #
732
+ # source://raix//lib/mcp/sse_client.rb#241
733
+ def wait_for_response(request_id); end
734
+ end
735
+
736
+ # source://raix//lib/mcp/sse_client.rb#13
737
+ Raix::MCP::SseClient::CONNECTION_TIMEOUT = T.let(T.unsafe(nil), Integer)
738
+
739
+ # source://raix//lib/mcp/sse_client.rb#14
740
+ Raix::MCP::SseClient::OPEN_TIMEOUT = T.let(T.unsafe(nil), Integer)
741
+
742
+ # source://raix//lib/mcp/sse_client.rb#12
743
+ Raix::MCP::SseClient::PROTOCOL_VERSION = T.let(T.unsafe(nil), String)
744
+
745
+ # Client for communicating with MCP servers via stdio using JSON-RPC.
746
+ #
747
+ # source://raix//lib/mcp/stdio_client.rb#9
748
+ class Raix::MCP::StdioClient
749
+ # Creates a new client with a bidirectional pipe to the MCP server.
750
+ #
751
+ # @return [StdioClient] a new instance of StdioClient
752
+ #
753
+ # source://raix//lib/mcp/stdio_client.rb#11
754
+ def initialize(*args, env); end
755
+
756
+ # Executes a tool with given arguments.
757
+ # Returns text content directly, or JSON-encoded data for other content types.
758
+ #
759
+ # source://raix//lib/mcp/stdio_client.rb#27
760
+ def call_tool(name, **arguments); end
761
+
762
+ # Closes the connection to the server.
763
+ #
764
+ # source://raix//lib/mcp/stdio_client.rb#56
765
+ def close; end
766
+
767
+ # Returns available tools from the server.
768
+ #
769
+ # source://raix//lib/mcp/stdio_client.rb#17
770
+ def tools; end
771
+
772
+ # source://raix//lib/mcp/stdio_client.rb#60
773
+ def unique_key; end
774
+
775
+ private
776
+
777
+ # Sends JSON-RPC request and returns the result.
778
+ #
779
+ # source://raix//lib/mcp/stdio_client.rb#68
780
+ def call(method, **params); end
781
+ end
782
+
783
+ # Represents an MCP (Model Context Protocol) tool with metadata and schema
784
+ #
785
+ # @example
786
+ # tool = Tool.new(
787
+ # name: "weather",
788
+ # description: "Get weather info",
789
+ # input_schema: { "type" => "object", "properties" => { "city" => { "type" => "string" } } }
790
+ # )
791
+ #
792
+ # source://raix//lib/mcp/tool.rb#11
793
+ class Raix::MCP::Tool
794
+ # Initialize a new Tool
795
+ #
796
+ # @param name [String] the tool name
797
+ # @param description [String] human-readable description of what the tool does
798
+ # @param input_schema [Hash] JSON schema defining the tool's input parameters
799
+ # @return [Tool] a new instance of Tool
800
+ #
801
+ # source://raix//lib/mcp/tool.rb#19
802
+ def initialize(name:, description:, input_schema: T.unsafe(nil)); end
803
+
804
+ # Returns the value of attribute description.
805
+ #
806
+ # source://raix//lib/mcp/tool.rb#12
807
+ def description; end
808
+
809
+ # Returns the value of attribute input_schema.
810
+ #
811
+ # source://raix//lib/mcp/tool.rb#12
812
+ def input_schema; end
813
+
814
+ # Get the input schema type
815
+ #
816
+ # @return [String, nil] the schema type (e.g., "object")
817
+ #
818
+ # source://raix//lib/mcp/tool.rb#40
819
+ def input_type; end
820
+
821
+ # Returns the value of attribute name.
822
+ #
823
+ # source://raix//lib/mcp/tool.rb#12
824
+ def name; end
825
+
826
+ # Get the properties hash
827
+ #
828
+ # @return [Hash] schema properties definition
829
+ #
830
+ # source://raix//lib/mcp/tool.rb#47
831
+ def properties; end
832
+
833
+ # Check if a property is required
834
+ #
835
+ # @param property_name [String] name of the property to check
836
+ # @return [Boolean] true if the property is required
837
+ #
838
+ # source://raix//lib/mcp/tool.rb#62
839
+ def required?(property_name); end
840
+
841
+ # Get required properties array
842
+ #
843
+ # @return [Array<String>] list of required property names
844
+ #
845
+ # source://raix//lib/mcp/tool.rb#54
846
+ def required_properties; end
847
+
848
+ class << self
849
+ # Initialize from raw MCP JSON response
850
+ #
851
+ # @param json [Hash] parsed JSON data from MCP response
852
+ # @return [Tool] new Tool instance
853
+ #
854
+ # source://raix//lib/mcp/tool.rb#29
855
+ def from_json(json); end
856
+ end
857
+ end
858
+
859
+ # source://raix//lib/raix/message_adapters/base.rb#6
860
+ module Raix::MessageAdapters; end
861
+
862
+ # Transforms messages into the format expected by the OpenAI API
863
+ #
864
+ # source://raix//lib/raix/message_adapters/base.rb#8
865
+ class Raix::MessageAdapters::Base
866
+ # @return [Base] a new instance of Base
867
+ #
868
+ # source://raix//lib/raix/message_adapters/base.rb#13
869
+ def initialize(context); end
870
+
871
+ # source://raix//lib/raix/message_adapters/base.rb#11
872
+ def cache_at(*_arg0, **_arg1, &_arg2); end
873
+
874
+ # Returns the value of attribute context.
875
+ #
876
+ # source://raix//lib/raix/message_adapters/base.rb#9
877
+ def context; end
878
+
879
+ # Sets the attribute context
880
+ #
881
+ # @param value the value to set the attribute context to.
882
+ #
883
+ # source://raix//lib/raix/message_adapters/base.rb#9
884
+ def context=(_arg0); end
885
+
886
+ # source://raix//lib/raix/message_adapters/base.rb#11
887
+ def model(*_arg0, **_arg1, &_arg2); end
888
+
889
+ # source://raix//lib/raix/message_adapters/base.rb#17
890
+ def transform(message); end
891
+
892
+ protected
893
+
894
+ # source://raix//lib/raix/message_adapters/base.rb#31
895
+ def content(message); end
896
+ end
897
+
898
+ # A module for handling yes/no questions using AI chat completion.
899
+ # When included in a class, it provides methods to define handlers for
900
+ # yes and no responses. All handlers are optional. Any response that
901
+ # does not begin with "yes, " or "no, " will be considered a maybe.
902
+ #
903
+ # @example
904
+ # class Question
905
+ # include Raix::Predicate
906
+ #
907
+ # yes? do |explanation|
908
+ # puts "Yes: #{explanation}"
909
+ # end
910
+ #
911
+ # no? do |explanation|
912
+ # puts "No: #{explanation}"
913
+ # end
914
+ #
915
+ # maybe? do |explanation|
916
+ # puts "Maybe: #{explanation}"
917
+ # end
918
+ # end
919
+ #
920
+ # question = Question.new
921
+ # question.ask("Is Ruby a programming language?")
922
+ #
923
+ # source://raix//lib/raix/predicate.rb#28
924
+ module Raix::Predicate
925
+ extend ::ActiveSupport::Concern
926
+ include ::Raix::ChatCompletion
927
+
928
+ mixes_in_class_methods ::Raix::ChatCompletion::ClassMethods
929
+ mixes_in_class_methods ::Raix::Predicate::ClassMethods
930
+
931
+ # source://raix//lib/raix/predicate.rb#32
932
+ def ask(question, openai: T.unsafe(nil)); end
933
+ end
934
+
935
+ # Class methods added to the including class
936
+ #
937
+ # source://raix//lib/raix/predicate.rb#52
938
+ module Raix::Predicate::ClassMethods
939
+ # @return [Boolean]
940
+ #
941
+ # source://raix//lib/raix/predicate.rb#63
942
+ def maybe?(&block); end
943
+
944
+ # Returns the value of attribute maybe_block.
945
+ #
946
+ # source://raix//lib/raix/predicate.rb#53
947
+ def maybe_block; end
948
+
949
+ # @return [Boolean]
950
+ #
951
+ # source://raix//lib/raix/predicate.rb#59
952
+ def no?(&block); end
953
+
954
+ # Returns the value of attribute no_block.
955
+ #
956
+ # source://raix//lib/raix/predicate.rb#53
957
+ def no_block; end
958
+
959
+ # @return [Boolean]
960
+ #
961
+ # source://raix//lib/raix/predicate.rb#55
962
+ def yes?(&block); end
963
+
964
+ # Returns the value of attribute yes_block.
965
+ #
966
+ # source://raix//lib/raix/predicate.rb#53
967
+ def yes_block; end
968
+ end
969
+
970
+ # The PromptDeclarations module provides a way to chain prompts and handle
971
+ # user responses in a serialized manner, with support for
972
+ # functions if the FunctionDispatch module is also included.
973
+ #
974
+ # source://raix//lib/raix/prompt_declarations.rb#12
975
+ module Raix::PromptDeclarations
976
+ extend ::ActiveSupport::Concern
977
+
978
+ mixes_in_class_methods ::Raix::PromptDeclarations::ClassMethods
979
+
980
+ # Executes the chat completion process based on the class-level declared prompts.
981
+ # The response to each prompt is added to the transcript automatically and returned.
982
+ #
983
+ # Raises an error if there are not enough prompts defined.
984
+ #
985
+ # Uses system prompt in following order of priority:
986
+ # - system lambda specified in the prompt declaration
987
+ # - system_prompt instance method if defined
988
+ # - system_prompt class-level declaration if defined
989
+ #
990
+ # Prompts require a text lambda to be defined at minimum.
991
+ # TODO: shortcut syntax passes just a string prompt if no other options are needed.
992
+ #
993
+ # TODO: SHOULD NOT HAVE A DIFFERENT INTERFACE THAN PARENT
994
+ #
995
+ # @param prompt [String] The prompt to use for the chat completion.
996
+ # @param params [Hash] Parameters for the chat completion.
997
+ # @param raw [Boolean] Whether to return the raw response.
998
+ # @raise [RuntimeError] If no prompts are defined.
999
+ #
1000
+ # source://raix//lib/raix/prompt_declarations.rb#66
1001
+ def chat_completion(prompt = T.unsafe(nil), params: T.unsafe(nil), raw: T.unsafe(nil), openai: T.unsafe(nil)); end
1002
+
1003
+ # Returns the value of attribute current_prompt.
1004
+ #
1005
+ # source://raix//lib/raix/prompt_declarations.rb#42
1006
+ def current_prompt; end
1007
+
1008
+ # source://raix//lib/raix/prompt_declarations.rb#125
1009
+ def execute_ai_request(params:, raw:, openai:, transcript:, loop_count:); end
1010
+
1011
+ # Returns the value of attribute last_response.
1012
+ #
1013
+ # source://raix//lib/raix/prompt_declarations.rb#42
1014
+ def last_response; end
1015
+
1016
+ # Returns the max_tokens parameter of the current prompt or the default max_tokens.
1017
+ #
1018
+ # @return [Integer] The max_tokens parameter of the current prompt or the default max_tokens.
1019
+ #
1020
+ # source://raix//lib/raix/prompt_declarations.rb#155
1021
+ def max_tokens; end
1022
+
1023
+ # Returns the model parameter of the current prompt or the default model.
1024
+ #
1025
+ # @return [Object] The model parameter of the current prompt or the default model.
1026
+ #
1027
+ # source://raix//lib/raix/prompt_declarations.rb#141
1028
+ def model; end
1029
+
1030
+ # Returns the temperature parameter of the current prompt or the default temperature.
1031
+ #
1032
+ # @return [Float] The temperature parameter of the current prompt or the default temperature.
1033
+ #
1034
+ # source://raix//lib/raix/prompt_declarations.rb#148
1035
+ def temperature; end
1036
+
1037
+ protected
1038
+
1039
+ # workaround for super.chat_completion, which is not available in ruby
1040
+ #
1041
+ # source://raix//lib/raix/prompt_declarations.rb#162
1042
+ def chat_completion_from_superclass(*_arg0, **kargs); end
1043
+ end
1044
+
1045
+ # source://raix//lib/raix/prompt_declarations.rb#15
1046
+ module Raix::PromptDeclarations::ClassMethods
1047
+ # Adds a prompt to the list of prompts. At minimum, provide a `text` or `call` parameter.
1048
+ #
1049
+ # @param system [Proc] A lambda that generates the system message.
1050
+ # @param call [ChatCompletion] A callable class that includes ChatCompletion. Will be passed a context object when initialized.
1051
+ # @param text Accepts 1) a lambda that returns the prompt text, 2) a string, or 3) a symbol that references a method.
1052
+ # @param stream [Proc] A lambda stream handler
1053
+ # @param success [Proc] The block of code to execute when the prompt is answered.
1054
+ # @param params [Hash] Additional parameters for the completion API call
1055
+ # @param if [Proc] A lambda that determines if the prompt should be executed.
1056
+ #
1057
+ # source://raix//lib/raix/prompt_declarations.rb#25
1058
+ def prompt(system: T.unsafe(nil), call: T.unsafe(nil), text: T.unsafe(nil), stream: T.unsafe(nil), success: T.unsafe(nil), params: T.unsafe(nil), if: T.unsafe(nil), unless: T.unsafe(nil), until: T.unsafe(nil)); end
1059
+
1060
+ # source://raix//lib/raix/prompt_declarations.rb#37
1061
+ def prompts; end
1062
+ end
1063
+
1064
+ # source://raix//lib/raix/prompt_declarations.rb#44
1065
+ Raix::PromptDeclarations::MAX_LOOP_COUNT = T.let(T.unsafe(nil), Integer)
1066
+
1067
+ # Handles the formatting of responses for AI interactions.
1068
+ #
1069
+ # This class is responsible for converting input data into a JSON schema
1070
+ # that can be used to structure and validate AI responses. It supports
1071
+ # nested structures and arrays, ensuring that the output conforms to
1072
+ # the expected format for AI model interactions.
1073
+ #
1074
+ # @attr_reader name [String] The name of the response format
1075
+ # @attr_reader input [Hash] The input data to be formatted
1076
+ # @example
1077
+ # input = { name: { type: "string" }, age: { type: "integer" } }
1078
+ # format = ResponseFormat.new("PersonInfo", input)
1079
+ # schema = format.to_schema
1080
+ #
1081
+ # source://raix//lib/raix/response_format.rb#21
1082
+ class Raix::ResponseFormat
1083
+ # @return [ResponseFormat] a new instance of ResponseFormat
1084
+ #
1085
+ # source://raix//lib/raix/response_format.rb#22
1086
+ def initialize(name, input); end
1087
+
1088
+ # source://raix//lib/raix/response_format.rb#27
1089
+ def to_json(*_arg0); end
1090
+
1091
+ # source://raix//lib/raix/response_format.rb#31
1092
+ def to_schema; end
1093
+
1094
+ private
1095
+
1096
+ # source://raix//lib/raix/response_format.rb#49
1097
+ def decode(input); end
1098
+ end
1099
+
1100
+ # source://raix//lib/raix/chat_completion.rb#12
1101
+ class Raix::UndeclaredToolError < ::StandardError; end
1102
+
1103
+ # source://raix//lib/raix/version.rb#4
1104
+ Raix::VERSION = T.let(T.unsafe(nil), String)