roast-ai 0.4.4 → 0.4.6
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/.github/CODEOWNERS +2 -0
- data/.github/workflows/ci.yaml +1 -0
- data/.gitignore +0 -26
- data/.rubocop.yml +13 -0
- data/.rubocop_todo.yml +21 -0
- data/CHANGELOG.md +37 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +43 -1
- data/bin/rubocop +27 -0
- data/bin/spoom +27 -0
- data/bin/srb +27 -0
- data/bin/srb-rbi +27 -0
- data/bin/tapioca +27 -0
- data/docs/INSTRUMENTATION.md +3 -3
- data/dsl/simple.rb +10 -0
- data/examples/retry/workflow.yml +23 -0
- data/lib/roast/dsl/executor.rb +26 -0
- data/lib/roast/dsl.rb +7 -0
- data/lib/roast/errors.rb +1 -0
- data/lib/roast/factories/api_provider_factory.rb +1 -0
- data/lib/roast/helpers/function_caching_interceptor.rb +3 -0
- data/lib/roast/helpers/logger.rb +6 -9
- data/lib/roast/helpers/metadata_access.rb +1 -0
- data/lib/roast/helpers/minitest_coverage_runner.rb +1 -0
- data/lib/roast/helpers/path_resolver.rb +8 -18
- data/lib/roast/helpers/prompt_loader.rb +3 -2
- data/lib/roast/helpers/timeout_handler.rb +3 -5
- data/lib/roast/initializers.rb +1 -0
- data/lib/roast/resources/api_resource.rb +4 -3
- data/lib/roast/resources/base_resource.rb +1 -0
- data/lib/roast/resources/directory_resource.rb +1 -0
- data/lib/roast/resources/file_resource.rb +1 -0
- data/lib/roast/resources/none_resource.rb +1 -0
- data/lib/roast/resources/url_resource.rb +2 -1
- data/lib/roast/resources.rb +1 -2
- data/lib/roast/services/context_threshold_checker.rb +1 -0
- data/lib/roast/services/token_counting_service.rb +1 -0
- data/lib/roast/tools/apply_diff.rb +1 -0
- data/lib/roast/tools/ask_user.rb +1 -0
- data/lib/roast/tools/bash.rb +1 -0
- data/lib/roast/tools/cmd.rb +1 -0
- data/lib/roast/tools/coding_agent.rb +1 -0
- data/lib/roast/tools/context_summarizer.rb +1 -0
- data/lib/roast/tools/grep.rb +1 -0
- data/lib/roast/tools/helpers/coding_agent_message_formatter.rb +1 -0
- data/lib/roast/tools/read_file.rb +1 -0
- data/lib/roast/tools/search_file.rb +1 -0
- data/lib/roast/tools/swarm.rb +1 -0
- data/lib/roast/tools/update_files.rb +1 -0
- data/lib/roast/tools/write_file.rb +1 -0
- data/lib/roast/tools.rb +2 -0
- data/lib/roast/value_objects/api_token.rb +1 -0
- data/lib/roast/value_objects/step_name.rb +1 -0
- data/lib/roast/value_objects/uri_base.rb +1 -0
- data/lib/roast/value_objects/workflow_path.rb +1 -0
- data/lib/roast/value_objects.rb +1 -0
- data/lib/roast/version.rb +2 -1
- data/lib/roast/workflow/agent_step.rb +1 -0
- data/lib/roast/workflow/api_configuration.rb +1 -0
- data/lib/roast/workflow/base_iteration_step.rb +1 -0
- data/lib/roast/workflow/base_step.rb +1 -0
- data/lib/roast/workflow/base_workflow.rb +1 -0
- data/lib/roast/workflow/case_executor.rb +1 -0
- data/lib/roast/workflow/case_step.rb +1 -0
- data/lib/roast/workflow/command_executor.rb +1 -0
- data/lib/roast/workflow/conditional_executor.rb +1 -0
- data/lib/roast/workflow/conditional_step.rb +1 -0
- data/lib/roast/workflow/configuration.rb +9 -0
- data/lib/roast/workflow/configuration_loader.rb +4 -1
- data/lib/roast/workflow/context_manager.rb +1 -0
- data/lib/roast/workflow/context_path_resolver.rb +1 -0
- data/lib/roast/workflow/dot_access_hash.rb +1 -0
- data/lib/roast/workflow/each_step.rb +1 -0
- data/lib/roast/workflow/error_handler.rb +39 -3
- data/lib/roast/workflow/expression_evaluator.rb +1 -0
- data/lib/roast/workflow/expression_utils.rb +1 -0
- data/lib/roast/workflow/file_state_repository.rb +2 -1
- data/lib/roast/workflow/input_executor.rb +1 -0
- data/lib/roast/workflow/input_step.rb +1 -0
- data/lib/roast/workflow/interpolator.rb +2 -1
- data/lib/roast/workflow/iteration_executor.rb +1 -0
- data/lib/roast/workflow/llm_boolean_coercer.rb +1 -0
- data/lib/roast/workflow/metadata_manager.rb +1 -0
- data/lib/roast/workflow/output_handler.rb +1 -0
- data/lib/roast/workflow/output_manager.rb +1 -0
- data/lib/roast/workflow/parallel_executor.rb +1 -0
- data/lib/roast/workflow/prompt_step.rb +1 -0
- data/lib/roast/workflow/repeat_step.rb +1 -0
- data/lib/roast/workflow/replay_handler.rb +1 -0
- data/lib/roast/workflow/resource_resolver.rb +2 -6
- data/lib/roast/workflow/session_manager.rb +1 -0
- data/lib/roast/workflow/shell_script_step.rb +1 -0
- data/lib/roast/workflow/sqlite_state_repository.rb +1 -0
- data/lib/roast/workflow/state_manager.rb +1 -0
- data/lib/roast/workflow/state_repository.rb +1 -0
- data/lib/roast/workflow/state_repository_factory.rb +4 -2
- data/lib/roast/workflow/step_completion_reporter.rb +1 -0
- data/lib/roast/workflow/step_executor_coordinator.rb +17 -6
- data/lib/roast/workflow/step_executor_factory.rb +1 -0
- data/lib/roast/workflow/step_executor_registry.rb +2 -3
- data/lib/roast/workflow/step_executor_with_reporting.rb +1 -0
- data/lib/roast/workflow/step_executors/base_step_executor.rb +1 -0
- data/lib/roast/workflow/step_executors/hash_step_executor.rb +1 -0
- data/lib/roast/workflow/step_executors/parallel_step_executor.rb +1 -0
- data/lib/roast/workflow/step_executors/string_step_executor.rb +1 -0
- data/lib/roast/workflow/step_factory.rb +1 -0
- data/lib/roast/workflow/step_finder.rb +1 -0
- data/lib/roast/workflow/step_loader.rb +1 -0
- data/lib/roast/workflow/step_name_extractor.rb +1 -0
- data/lib/roast/workflow/step_runner.rb +1 -0
- data/lib/roast/workflow/step_type_resolver.rb +1 -0
- data/lib/roast/workflow/validation_command.rb +1 -0
- data/lib/roast/workflow/validator.rb +1 -0
- data/lib/roast/workflow/validators/base_validator.rb +1 -0
- data/lib/roast/workflow/validators/dependency_validator.rb +1 -0
- data/lib/roast/workflow/validators/linting_validator.rb +1 -0
- data/lib/roast/workflow/validators/schema_validator.rb +1 -0
- data/lib/roast/workflow/validators/step_collector.rb +1 -0
- data/lib/roast/workflow/validators/validation_orchestrator.rb +1 -0
- data/lib/roast/workflow/workflow_context.rb +1 -0
- data/lib/roast/workflow/workflow_execution_context.rb +1 -0
- data/lib/roast/workflow/workflow_executor.rb +2 -1
- data/lib/roast/workflow/workflow_initializer.rb +16 -1
- data/lib/roast/workflow/workflow_runner.rb +66 -55
- data/lib/roast/workflow.rb +1 -0
- data/lib/roast/workflow_diagram_generator.rb +3 -2
- data/lib/roast.rb +23 -8
- data/sorbet/config +8 -0
- data/sorbet/rbi/dsl/.gitattributes +1 -0
- data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/activesupport@8.0.2.rbi +19107 -0
- data/sorbet/rbi/gems/addressable@2.8.7.rbi +1994 -0
- data/sorbet/rbi/gems/ast@2.4.3.rbi +585 -0
- data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
- data/sorbet/rbi/gems/benchmark@0.4.1.rbi +619 -0
- data/sorbet/rbi/gems/bigdecimal@3.2.2.rbi +62 -0
- data/sorbet/rbi/gems/cgi@0.5.0.rbi +2961 -0
- data/sorbet/rbi/gems/claude_swarm@0.1.19.rbi +568 -0
- data/sorbet/rbi/gems/cli-kit@5.0.1.rbi +1991 -0
- data/sorbet/rbi/gems/cli-ui@2.3.0.rbi +3181 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +9 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +11657 -0
- data/sorbet/rbi/gems/connection_pool@2.5.3.rbi +9 -0
- data/sorbet/rbi/gems/crack@1.0.0.rbi +145 -0
- data/sorbet/rbi/gems/diff-lcs@1.6.2.rbi +972 -0
- data/sorbet/rbi/gems/dotenv@3.1.8.rbi +295 -0
- data/sorbet/rbi/gems/drb@2.2.3.rbi +1661 -0
- data/sorbet/rbi/gems/dry-configurable@1.3.0.rbi +672 -0
- data/sorbet/rbi/gems/dry-core@1.1.0.rbi +1894 -0
- data/sorbet/rbi/gems/dry-inflector@1.2.0.rbi +659 -0
- data/sorbet/rbi/gems/dry-initializer@3.2.0.rbi +781 -0
- data/sorbet/rbi/gems/dry-logic@1.6.0.rbi +1127 -0
- data/sorbet/rbi/gems/dry-schema@1.14.1.rbi +3727 -0
- data/sorbet/rbi/gems/dry-types@1.8.3.rbi +3969 -0
- data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
- data/sorbet/rbi/gems/event_stream_parser@1.0.0.rbi +49 -0
- data/sorbet/rbi/gems/faraday-multipart@1.1.1.rbi +283 -0
- data/sorbet/rbi/gems/faraday-net_http@3.4.1.rbi +147 -0
- data/sorbet/rbi/gems/faraday-retry@2.3.2.rbi +9 -0
- data/sorbet/rbi/gems/faraday@2.13.1.rbi +2977 -0
- data/sorbet/rbi/gems/fast-mcp-annotations@1.5.3.rbi +1588 -0
- data/sorbet/rbi/gems/ffi@1.17.2.rbi +9 -0
- data/sorbet/rbi/gems/formatador@1.1.0.rbi +9 -0
- data/sorbet/rbi/gems/guard-compat@1.2.1.rbi +102 -0
- data/sorbet/rbi/gems/guard-minitest@2.4.6.rbi +402 -0
- data/sorbet/rbi/gems/guard@2.19.1.rbi +2283 -0
- data/sorbet/rbi/gems/hashdiff@1.2.0.rbi +355 -0
- data/sorbet/rbi/gems/i18n@1.14.7.rbi +2359 -0
- data/sorbet/rbi/gems/json-schema@5.1.1.rbi +1466 -0
- data/sorbet/rbi/gems/json@2.12.2.rbi +2051 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.5.rbi +9 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +9 -0
- data/sorbet/rbi/gems/listen@3.9.0.rbi +1206 -0
- data/sorbet/rbi/gems/logger@1.7.0.rbi +963 -0
- data/sorbet/rbi/gems/lumberjack@1.2.10.rbi +1830 -0
- data/sorbet/rbi/gems/method_source@1.1.0.rbi +9 -0
- data/sorbet/rbi/gems/mime-types-data@3.2025.0617.rbi +136 -0
- data/sorbet/rbi/gems/mime-types@3.7.0.rbi +1342 -0
- data/sorbet/rbi/gems/minitest-rg@5.3.0.rbi +160 -0
- data/sorbet/rbi/gems/minitest@5.25.5.rbi +1640 -0
- data/sorbet/rbi/gems/mocha@2.7.1.rbi +12 -0
- data/sorbet/rbi/gems/multipart-post@2.4.1.rbi +244 -0
- data/sorbet/rbi/gems/nenv@0.3.0.rbi +147 -0
- data/sorbet/rbi/gems/net-http@0.6.0.rbi +4247 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
- data/sorbet/rbi/gems/notiffany@0.1.3.rbi +1079 -0
- data/sorbet/rbi/gems/open_router@0.3.3.rbi +230 -0
- data/sorbet/rbi/gems/ostruct@0.6.2.rbi +354 -0
- data/sorbet/rbi/gems/parallel@1.27.0.rbi +291 -0
- data/sorbet/rbi/gems/parser@3.3.8.0.rbi +5535 -0
- data/sorbet/rbi/gems/prism@1.4.0.rbi +41732 -0
- data/sorbet/rbi/gems/pry@0.15.2.rbi +9 -0
- data/sorbet/rbi/gems/public_suffix@6.0.2.rbi +936 -0
- data/sorbet/rbi/gems/racc@1.8.1.rbi +158 -0
- data/sorbet/rbi/gems/rack@2.2.17.rbi +5659 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +9 -0
- data/sorbet/rbi/gems/raix@1.0.2.rbi +1104 -0
- data/sorbet/rbi/gems/rake@13.3.0.rbi +3036 -0
- data/sorbet/rbi/gems/rb-fsevent@0.11.2.rbi +9 -0
- data/sorbet/rbi/gems/rb-inotify@0.11.1.rbi +9 -0
- data/sorbet/rbi/gems/rbi@0.3.6.rbi +6893 -0
- data/sorbet/rbi/gems/rbs@3.9.4.rbi +6978 -0
- data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +9 -0
- data/sorbet/rbi/gems/rexml@3.4.1.rbi +5346 -0
- data/sorbet/rbi/gems/rubocop-ast@1.45.1.rbi +9 -0
- data/sorbet/rbi/gems/rubocop-shopify@2.17.1.rbi +9 -0
- data/sorbet/rbi/gems/rubocop@1.77.0.rbi +9 -0
- data/sorbet/rbi/gems/ruby-graphviz@1.2.5.rbi +1333 -0
- data/sorbet/rbi/gems/ruby-openai@8.1.0.rbi +758 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +9 -0
- data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +9 -0
- data/sorbet/rbi/gems/securerandom@0.4.1.rbi +75 -0
- data/sorbet/rbi/gems/shellany@0.0.1.rbi +102 -0
- data/sorbet/rbi/gems/spoom@1.6.3.rbi +6985 -0
- data/sorbet/rbi/gems/sqlite3@2.7.0.rbi +1900 -0
- data/sorbet/rbi/gems/tapioca@0.16.11.rbi +3628 -0
- data/sorbet/rbi/gems/thor@1.4.0.rbi +4399 -0
- data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5918 -0
- data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +9 -0
- data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +9 -0
- data/sorbet/rbi/gems/uri@1.0.3.rbi +2349 -0
- data/sorbet/rbi/gems/vcr@6.3.1.rbi +3040 -0
- data/sorbet/rbi/gems/webmock@3.25.1.rbi +1792 -0
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
- data/sorbet/rbi/gems/yard@0.9.37.rbi +18492 -0
- data/sorbet/rbi/gems/zeitwerk@2.7.3.rbi +1429 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +36 -0
- metadata +114 -2
- data/lib/roast/workflow/configuration_parser.rb +0 -54
@@ -0,0 +1,230 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `open_router` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem open_router`.
|
6
|
+
|
7
|
+
|
8
|
+
# source://open_router//lib/open_router/http.rb#3
|
9
|
+
module OpenRouter
|
10
|
+
class << self
|
11
|
+
# source://open_router//lib/open_router.rb#54
|
12
|
+
def configuration; end
|
13
|
+
|
14
|
+
# Sets the attribute configuration
|
15
|
+
#
|
16
|
+
# @param value the value to set the attribute configuration to.
|
17
|
+
#
|
18
|
+
# source://open_router//lib/open_router.rb#51
|
19
|
+
def configuration=(_arg0); end
|
20
|
+
|
21
|
+
# @yield [configuration]
|
22
|
+
#
|
23
|
+
# source://open_router//lib/open_router.rb#58
|
24
|
+
def configure; end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# source://open_router//lib/open_router/client.rb#11
|
29
|
+
class OpenRouter::Client
|
30
|
+
include ::OpenRouter::HTTP
|
31
|
+
|
32
|
+
# Initializes the client with optional configurations.
|
33
|
+
#
|
34
|
+
# @return [Client] a new instance of Client
|
35
|
+
# @yield [OpenRouter.configuration]
|
36
|
+
#
|
37
|
+
# source://open_router//lib/open_router/client.rb#15
|
38
|
+
def initialize(access_token: T.unsafe(nil), request_timeout: T.unsafe(nil), uri_base: T.unsafe(nil), extra_headers: T.unsafe(nil)); end
|
39
|
+
|
40
|
+
# Performs a chat completion request to the OpenRouter API.
|
41
|
+
#
|
42
|
+
# @param messages [Array<Hash>] Array of message hashes with role and content, like [{role: "user", content: "What is the meaning of life?"}]
|
43
|
+
# @param model [String|Array] Model identifier, or array of model identifiers if you want to fallback to the next model in case of failure
|
44
|
+
# @param providers [Array<String>] Optional array of provider identifiers, ordered by priority
|
45
|
+
# @param transforms [Array<String>] Optional array of strings that tell OpenRouter to apply a series of transformations to the prompt before sending it to the model. Transformations are applied in-order
|
46
|
+
# @param extras [Hash] Optional hash of model-specific parameters to send to the OpenRouter API
|
47
|
+
# @param stream [Proc, nil] Optional callable object for streaming
|
48
|
+
# @return [Hash] The completion response.
|
49
|
+
#
|
50
|
+
# source://open_router//lib/open_router/client.rb#31
|
51
|
+
def complete(messages, model: T.unsafe(nil), providers: T.unsafe(nil), transforms: T.unsafe(nil), extras: T.unsafe(nil), stream: T.unsafe(nil)); end
|
52
|
+
|
53
|
+
# Fetches the list of available models from the OpenRouter API.
|
54
|
+
#
|
55
|
+
# @return [Array<Hash>] The list of models.
|
56
|
+
#
|
57
|
+
# source://open_router//lib/open_router/client.rb#54
|
58
|
+
def models; end
|
59
|
+
|
60
|
+
# Queries the generation stats for a given id.
|
61
|
+
#
|
62
|
+
# @param generation_id [String] The generation id returned from a previous request.
|
63
|
+
# @return [Hash] The stats including token counts and cost.
|
64
|
+
#
|
65
|
+
# source://open_router//lib/open_router/client.rb#61
|
66
|
+
def query_generation_stats(generation_id); end
|
67
|
+
end
|
68
|
+
|
69
|
+
# source://open_router//lib/open_router.rb#14
|
70
|
+
class OpenRouter::Configuration
|
71
|
+
# @return [Configuration] a new instance of Configuration
|
72
|
+
#
|
73
|
+
# source://open_router//lib/open_router.rb#22
|
74
|
+
def initialize; end
|
75
|
+
|
76
|
+
# @raise [ConfigurationError]
|
77
|
+
#
|
78
|
+
# source://open_router//lib/open_router.rb#31
|
79
|
+
def access_token; end
|
80
|
+
|
81
|
+
# Sets the attribute access_token
|
82
|
+
#
|
83
|
+
# @param value the value to set the attribute access_token to.
|
84
|
+
#
|
85
|
+
# source://open_router//lib/open_router.rb#15
|
86
|
+
def access_token=(_arg0); end
|
87
|
+
|
88
|
+
# Returns the value of attribute api_version.
|
89
|
+
#
|
90
|
+
# source://open_router//lib/open_router.rb#16
|
91
|
+
def api_version; end
|
92
|
+
|
93
|
+
# Sets the attribute api_version
|
94
|
+
#
|
95
|
+
# @param value the value to set the attribute api_version to.
|
96
|
+
#
|
97
|
+
# source://open_router//lib/open_router.rb#16
|
98
|
+
def api_version=(_arg0); end
|
99
|
+
|
100
|
+
# Returns the value of attribute extra_headers.
|
101
|
+
#
|
102
|
+
# source://open_router//lib/open_router.rb#16
|
103
|
+
def extra_headers; end
|
104
|
+
|
105
|
+
# Sets the attribute extra_headers
|
106
|
+
#
|
107
|
+
# @param value the value to set the attribute extra_headers to.
|
108
|
+
#
|
109
|
+
# source://open_router//lib/open_router.rb#16
|
110
|
+
def extra_headers=(_arg0); end
|
111
|
+
|
112
|
+
# source://open_router//lib/open_router.rb#37
|
113
|
+
def faraday(&block); end
|
114
|
+
|
115
|
+
# Returns the value of attribute faraday_config.
|
116
|
+
#
|
117
|
+
# source://open_router//lib/open_router.rb#16
|
118
|
+
def faraday_config; end
|
119
|
+
|
120
|
+
# Sets the attribute faraday_config
|
121
|
+
#
|
122
|
+
# @param value the value to set the attribute faraday_config to.
|
123
|
+
#
|
124
|
+
# source://open_router//lib/open_router.rb#16
|
125
|
+
def faraday_config=(_arg0); end
|
126
|
+
|
127
|
+
# Returns the value of attribute log_errors.
|
128
|
+
#
|
129
|
+
# source://open_router//lib/open_router.rb#16
|
130
|
+
def log_errors; end
|
131
|
+
|
132
|
+
# Sets the attribute log_errors
|
133
|
+
#
|
134
|
+
# @param value the value to set the attribute log_errors to.
|
135
|
+
#
|
136
|
+
# source://open_router//lib/open_router.rb#16
|
137
|
+
def log_errors=(_arg0); end
|
138
|
+
|
139
|
+
# Returns the value of attribute request_timeout.
|
140
|
+
#
|
141
|
+
# source://open_router//lib/open_router.rb#16
|
142
|
+
def request_timeout; end
|
143
|
+
|
144
|
+
# Sets the attribute request_timeout
|
145
|
+
#
|
146
|
+
# @param value the value to set the attribute request_timeout to.
|
147
|
+
#
|
148
|
+
# source://open_router//lib/open_router.rb#16
|
149
|
+
def request_timeout=(_arg0); end
|
150
|
+
|
151
|
+
# source://open_router//lib/open_router.rb#41
|
152
|
+
def site_name=(value); end
|
153
|
+
|
154
|
+
# source://open_router//lib/open_router.rb#45
|
155
|
+
def site_url=(value); end
|
156
|
+
|
157
|
+
# Returns the value of attribute uri_base.
|
158
|
+
#
|
159
|
+
# source://open_router//lib/open_router.rb#16
|
160
|
+
def uri_base; end
|
161
|
+
|
162
|
+
# Sets the attribute uri_base
|
163
|
+
#
|
164
|
+
# @param value the value to set the attribute uri_base to.
|
165
|
+
#
|
166
|
+
# source://open_router//lib/open_router.rb#16
|
167
|
+
def uri_base=(_arg0); end
|
168
|
+
end
|
169
|
+
|
170
|
+
# source://open_router//lib/open_router.rb#18
|
171
|
+
OpenRouter::Configuration::DEFAULT_API_VERSION = T.let(T.unsafe(nil), String)
|
172
|
+
|
173
|
+
# source://open_router//lib/open_router.rb#19
|
174
|
+
OpenRouter::Configuration::DEFAULT_REQUEST_TIMEOUT = T.let(T.unsafe(nil), Integer)
|
175
|
+
|
176
|
+
# source://open_router//lib/open_router.rb#20
|
177
|
+
OpenRouter::Configuration::DEFAULT_URI_BASE = T.let(T.unsafe(nil), String)
|
178
|
+
|
179
|
+
# source://open_router//lib/open_router.rb#12
|
180
|
+
class OpenRouter::ConfigurationError < ::OpenRouter::Error; end
|
181
|
+
|
182
|
+
# source://open_router//lib/open_router.rb#11
|
183
|
+
class OpenRouter::Error < ::StandardError; end
|
184
|
+
|
185
|
+
# source://open_router//lib/open_router/http.rb#4
|
186
|
+
module OpenRouter::HTTP
|
187
|
+
# source://open_router//lib/open_router/http.rb#30
|
188
|
+
def delete(path:); end
|
189
|
+
|
190
|
+
# source://open_router//lib/open_router/http.rb#5
|
191
|
+
def get(path:); end
|
192
|
+
|
193
|
+
# source://open_router//lib/open_router/http.rb#23
|
194
|
+
def multipart_post(path:, parameters: T.unsafe(nil)); end
|
195
|
+
|
196
|
+
# source://open_router//lib/open_router/http.rb#11
|
197
|
+
def post(path:, parameters:); end
|
198
|
+
|
199
|
+
private
|
200
|
+
|
201
|
+
# source://open_router//lib/open_router/http.rb#56
|
202
|
+
def conn(multipart: T.unsafe(nil)); end
|
203
|
+
|
204
|
+
# source://open_router//lib/open_router/http.rb#72
|
205
|
+
def headers; end
|
206
|
+
|
207
|
+
# source://open_router//lib/open_router/http.rb#81
|
208
|
+
def multipart_parameters(parameters); end
|
209
|
+
|
210
|
+
# Given a proc, returns an outer proc that can be used to iterate over a JSON stream of chunks.
|
211
|
+
# For each chunk, the inner user_proc is called giving it the JSON object. The JSON object could
|
212
|
+
# be a data object or an error object as described in the OpenRouter API documentation.
|
213
|
+
#
|
214
|
+
# If the JSON object for a given data or error message is invalid, it is ignored.
|
215
|
+
#
|
216
|
+
# @param user_proc [Proc] The inner proc to call for each JSON object in the chunk.
|
217
|
+
# @return [Proc] An outer proc that iterates over a raw stream, converting it to JSON.
|
218
|
+
#
|
219
|
+
# source://open_router//lib/open_router/http.rb#46
|
220
|
+
def to_json_stream(user_proc:); end
|
221
|
+
|
222
|
+
# source://open_router//lib/open_router/http.rb#68
|
223
|
+
def uri(path:); end
|
224
|
+
end
|
225
|
+
|
226
|
+
# source://open_router//lib/open_router/client.rb#9
|
227
|
+
class OpenRouter::ServerError < ::StandardError; end
|
228
|
+
|
229
|
+
# source://open_router//lib/open_router/version.rb#4
|
230
|
+
OpenRouter::VERSION = T.let(T.unsafe(nil), String)
|
@@ -0,0 +1,354 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `ostruct` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem ostruct`.
|
6
|
+
|
7
|
+
|
8
|
+
# An OpenStruct is a data structure, similar to a Hash, that allows the
|
9
|
+
# definition of arbitrary attributes with their accompanying values. This is
|
10
|
+
# accomplished by using Ruby's metaprogramming to define methods on the class
|
11
|
+
# itself.
|
12
|
+
#
|
13
|
+
# == Examples
|
14
|
+
#
|
15
|
+
# require "ostruct"
|
16
|
+
#
|
17
|
+
# person = OpenStruct.new
|
18
|
+
# person.name = "John Smith"
|
19
|
+
# person.age = 70
|
20
|
+
#
|
21
|
+
# person.name # => "John Smith"
|
22
|
+
# person.age # => 70
|
23
|
+
# person.address # => nil
|
24
|
+
#
|
25
|
+
# An OpenStruct employs a Hash internally to store the attributes and values
|
26
|
+
# and can even be initialized with one:
|
27
|
+
#
|
28
|
+
# australia = OpenStruct.new(:country => "Australia", :capital => "Canberra")
|
29
|
+
# # => #<OpenStruct country="Australia", capital="Canberra">
|
30
|
+
#
|
31
|
+
# Hash keys with spaces or characters that could normally not be used for
|
32
|
+
# method calls (e.g. <code>()[]*</code>) will not be immediately available
|
33
|
+
# on the OpenStruct object as a method for retrieval or assignment, but can
|
34
|
+
# still be reached through the Object#send method or using [].
|
35
|
+
#
|
36
|
+
# measurements = OpenStruct.new("length (in inches)" => 24)
|
37
|
+
# measurements[:"length (in inches)"] # => 24
|
38
|
+
# measurements.send("length (in inches)") # => 24
|
39
|
+
#
|
40
|
+
# message = OpenStruct.new(:queued? => true)
|
41
|
+
# message.queued? # => true
|
42
|
+
# message.send("queued?=", false)
|
43
|
+
# message.queued? # => false
|
44
|
+
#
|
45
|
+
# Removing the presence of an attribute requires the execution of the
|
46
|
+
# delete_field method as setting the property value to +nil+ will not
|
47
|
+
# remove the attribute.
|
48
|
+
#
|
49
|
+
# first_pet = OpenStruct.new(:name => "Rowdy", :owner => "John Smith")
|
50
|
+
# second_pet = OpenStruct.new(:name => "Rowdy")
|
51
|
+
#
|
52
|
+
# first_pet.owner = nil
|
53
|
+
# first_pet # => #<OpenStruct name="Rowdy", owner=nil>
|
54
|
+
# first_pet == second_pet # => false
|
55
|
+
#
|
56
|
+
# first_pet.delete_field(:owner)
|
57
|
+
# first_pet # => #<OpenStruct name="Rowdy">
|
58
|
+
# first_pet == second_pet # => true
|
59
|
+
#
|
60
|
+
# Ractor compatibility: A frozen OpenStruct with shareable values is itself shareable.
|
61
|
+
#
|
62
|
+
# == Caveats
|
63
|
+
#
|
64
|
+
# An OpenStruct utilizes Ruby's method lookup structure to find and define the
|
65
|
+
# necessary methods for properties. This is accomplished through the methods
|
66
|
+
# method_missing and define_singleton_method.
|
67
|
+
#
|
68
|
+
# This should be a consideration if there is a concern about the performance of
|
69
|
+
# the objects that are created, as there is much more overhead in the setting
|
70
|
+
# of these properties compared to using a Hash or a Struct.
|
71
|
+
# Creating an open struct from a small Hash and accessing a few of the
|
72
|
+
# entries can be 200 times slower than accessing the hash directly.
|
73
|
+
#
|
74
|
+
# This is a potential security issue; building OpenStruct from untrusted user data
|
75
|
+
# (e.g. JSON web request) may be susceptible to a "symbol denial of service" attack
|
76
|
+
# since the keys create methods and names of methods are never garbage collected.
|
77
|
+
#
|
78
|
+
# This may also be the source of incompatibilities between Ruby versions:
|
79
|
+
#
|
80
|
+
# o = OpenStruct.new
|
81
|
+
# o.then # => nil in Ruby < 2.6, enumerator for Ruby >= 2.6
|
82
|
+
#
|
83
|
+
# Builtin methods may be overwritten this way, which may be a source of bugs
|
84
|
+
# or security issues:
|
85
|
+
#
|
86
|
+
# o = OpenStruct.new
|
87
|
+
# o.methods # => [:to_h, :marshal_load, :marshal_dump, :each_pair, ...
|
88
|
+
# o.methods = [:foo, :bar]
|
89
|
+
# o.methods # => [:foo, :bar]
|
90
|
+
#
|
91
|
+
# To help remedy clashes, OpenStruct uses only protected/private methods ending with <code>!</code>
|
92
|
+
# and defines aliases for builtin public methods by adding a <code>!</code>:
|
93
|
+
#
|
94
|
+
# o = OpenStruct.new(make: 'Bentley', class: :luxury)
|
95
|
+
# o.class # => :luxury
|
96
|
+
# o.class! # => OpenStruct
|
97
|
+
#
|
98
|
+
# It is recommended (but not enforced) to not use fields ending in <code>!</code>;
|
99
|
+
# Note that a subclass' methods may not be overwritten, nor can OpenStruct's own methods
|
100
|
+
# ending with <code>!</code>.
|
101
|
+
#
|
102
|
+
# For all these reasons, consider not using OpenStruct at all.
|
103
|
+
#
|
104
|
+
# source://ostruct//lib/ostruct.rb#109
|
105
|
+
class OpenStruct
|
106
|
+
# Creates a new OpenStruct object. By default, the resulting OpenStruct
|
107
|
+
# object will have no attributes.
|
108
|
+
#
|
109
|
+
# The optional +hash+, if given, will generate attributes and values
|
110
|
+
# (can be a Hash, an OpenStruct or a Struct).
|
111
|
+
# For example:
|
112
|
+
#
|
113
|
+
# require "ostruct"
|
114
|
+
# hash = { "country" => "Australia", :capital => "Canberra" }
|
115
|
+
# data = OpenStruct.new(hash)
|
116
|
+
#
|
117
|
+
# data # => #<OpenStruct country="Australia", capital="Canberra">
|
118
|
+
#
|
119
|
+
# @return [OpenStruct] a new instance of OpenStruct
|
120
|
+
#
|
121
|
+
# source://ostruct//lib/ostruct.rb#134
|
122
|
+
def initialize(hash = T.unsafe(nil)); end
|
123
|
+
|
124
|
+
# Compares this object and +other+ for equality. An OpenStruct is equal to
|
125
|
+
# +other+ when +other+ is an OpenStruct and the two objects' Hash tables are
|
126
|
+
# equal.
|
127
|
+
#
|
128
|
+
# require "ostruct"
|
129
|
+
# first_pet = OpenStruct.new("name" => "Rowdy")
|
130
|
+
# second_pet = OpenStruct.new(:name => "Rowdy")
|
131
|
+
# third_pet = OpenStruct.new("name" => "Rowdy", :age => nil)
|
132
|
+
#
|
133
|
+
# first_pet == second_pet # => true
|
134
|
+
# first_pet == third_pet # => false
|
135
|
+
#
|
136
|
+
# source://ostruct//lib/ostruct.rb#423
|
137
|
+
def ==(other); end
|
138
|
+
|
139
|
+
# :call-seq:
|
140
|
+
# ostruct[name] -> object
|
141
|
+
#
|
142
|
+
# Returns the value of an attribute, or +nil+ if there is no such attribute.
|
143
|
+
#
|
144
|
+
# require "ostruct"
|
145
|
+
# person = OpenStruct.new("name" => "John Smith", "age" => 70)
|
146
|
+
# person[:age] # => 70, same as person.age
|
147
|
+
#
|
148
|
+
# source://ostruct//lib/ostruct.rb#303
|
149
|
+
def [](name); end
|
150
|
+
|
151
|
+
# :call-seq:
|
152
|
+
# ostruct[name] = obj -> obj
|
153
|
+
#
|
154
|
+
# Sets the value of an attribute.
|
155
|
+
#
|
156
|
+
# require "ostruct"
|
157
|
+
# person = OpenStruct.new("name" => "John Smith", "age" => 70)
|
158
|
+
# person[:age] = 42 # equivalent to person.age = 42
|
159
|
+
# person.age # => 42
|
160
|
+
#
|
161
|
+
# source://ostruct//lib/ostruct.rb#318
|
162
|
+
def []=(name, value); end
|
163
|
+
|
164
|
+
# Removes the named field from the object and returns the value the field
|
165
|
+
# contained if it was defined. You may optionally provide a block.
|
166
|
+
# If the field is not defined, the result of the block is returned,
|
167
|
+
# or a NameError is raised if no block was given.
|
168
|
+
#
|
169
|
+
# require "ostruct"
|
170
|
+
#
|
171
|
+
# person = OpenStruct.new(name: "John", age: 70, pension: 300)
|
172
|
+
#
|
173
|
+
# person.delete_field!("age") # => 70
|
174
|
+
# person # => #<OpenStruct name="John", pension=300>
|
175
|
+
#
|
176
|
+
# Setting the value to +nil+ will not remove the attribute:
|
177
|
+
#
|
178
|
+
# person.pension = nil
|
179
|
+
# person # => #<OpenStruct name="John", pension=nil>
|
180
|
+
#
|
181
|
+
# person.delete_field('number') # => NameError
|
182
|
+
#
|
183
|
+
# person.delete_field('number') { 8675_309 } # => 8675309
|
184
|
+
#
|
185
|
+
# source://ostruct//lib/ostruct.rb#371
|
186
|
+
def delete_field(name, &block); end
|
187
|
+
|
188
|
+
# source://ostruct//lib/ostruct.rb#371
|
189
|
+
def delete_field!(name, &block); end
|
190
|
+
|
191
|
+
# :call-seq:
|
192
|
+
# ostruct.dig(name, *identifiers) -> object
|
193
|
+
#
|
194
|
+
# Finds and returns the object in nested objects
|
195
|
+
# that is specified by +name+ and +identifiers+.
|
196
|
+
# The nested objects may be instances of various classes.
|
197
|
+
# See {Dig Methods}[rdoc-ref:dig_methods.rdoc].
|
198
|
+
#
|
199
|
+
# Examples:
|
200
|
+
# require "ostruct"
|
201
|
+
# address = OpenStruct.new("city" => "Anytown NC", "zip" => 12345)
|
202
|
+
# person = OpenStruct.new("name" => "John Smith", "address" => address)
|
203
|
+
# person.dig(:address, "zip") # => 12345
|
204
|
+
# person.dig(:business_address, "zip") # => nil
|
205
|
+
#
|
206
|
+
# source://ostruct//lib/ostruct.rb#340
|
207
|
+
def dig(name, *names); end
|
208
|
+
|
209
|
+
# source://ostruct//lib/ostruct.rb#340
|
210
|
+
def dig!(name, *names); end
|
211
|
+
|
212
|
+
# :call-seq:
|
213
|
+
# ostruct.each_pair {|name, value| block } -> ostruct
|
214
|
+
# ostruct.each_pair -> Enumerator
|
215
|
+
#
|
216
|
+
# Yields all attributes (as symbols) along with the corresponding values
|
217
|
+
# or returns an enumerator if no block is given.
|
218
|
+
#
|
219
|
+
# require "ostruct"
|
220
|
+
# data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
|
221
|
+
# data.each_pair.to_a # => [[:country, "Australia"], [:capital, "Canberra"]]
|
222
|
+
#
|
223
|
+
# source://ostruct//lib/ostruct.rb#211
|
224
|
+
def each_pair; end
|
225
|
+
|
226
|
+
# source://ostruct//lib/ostruct.rb#211
|
227
|
+
def each_pair!; end
|
228
|
+
|
229
|
+
# Provides marshalling support for use by the YAML library.
|
230
|
+
#
|
231
|
+
# source://ostruct//lib/ostruct.rb#446
|
232
|
+
def encode_with(coder); end
|
233
|
+
|
234
|
+
# source://ostruct//lib/ostruct.rb#446
|
235
|
+
def encode_with!(coder); end
|
236
|
+
|
237
|
+
# Compares this object and +other+ for equality. An OpenStruct is eql? to
|
238
|
+
# +other+ when +other+ is an OpenStruct and the two objects' Hash tables are
|
239
|
+
# eql?.
|
240
|
+
#
|
241
|
+
# @return [Boolean]
|
242
|
+
#
|
243
|
+
# source://ostruct//lib/ostruct.rb#433
|
244
|
+
def eql?(other); end
|
245
|
+
|
246
|
+
# source://ostruct//lib/ostruct.rb#269
|
247
|
+
def freeze; end
|
248
|
+
|
249
|
+
# source://ostruct//lib/ostruct.rb#269
|
250
|
+
def freeze!; end
|
251
|
+
|
252
|
+
# Computes a hash code for this OpenStruct.
|
253
|
+
#
|
254
|
+
# source://ostruct//lib/ostruct.rb#439
|
255
|
+
def hash; end
|
256
|
+
|
257
|
+
# source://ostruct//lib/ostruct.rb#439
|
258
|
+
def hash!; end
|
259
|
+
|
260
|
+
# Provides marshalling support for use by the YAML library.
|
261
|
+
#
|
262
|
+
# source://ostruct//lib/ostruct.rb#459
|
263
|
+
def init_with(coder); end
|
264
|
+
|
265
|
+
# source://ostruct//lib/ostruct.rb#459
|
266
|
+
def init_with!(coder); end
|
267
|
+
|
268
|
+
# Returns a string containing a detailed summary of the keys and values.
|
269
|
+
#
|
270
|
+
# source://ostruct//lib/ostruct.rb#388
|
271
|
+
def inspect; end
|
272
|
+
|
273
|
+
# source://ostruct//lib/ostruct.rb#388
|
274
|
+
def inspect!; end
|
275
|
+
|
276
|
+
# Provides marshalling support for use by the Marshal library.
|
277
|
+
#
|
278
|
+
# source://ostruct//lib/ostruct.rb#220
|
279
|
+
def marshal_dump; end
|
280
|
+
|
281
|
+
# source://ostruct//lib/ostruct.rb#220
|
282
|
+
def marshal_dump!; end
|
283
|
+
|
284
|
+
# source://ostruct//lib/ostruct.rb#406
|
285
|
+
def table; end
|
286
|
+
|
287
|
+
# source://ostruct//lib/ostruct.rb#182
|
288
|
+
def to_h(&block); end
|
289
|
+
|
290
|
+
# source://ostruct//lib/ostruct.rb#182
|
291
|
+
def to_h!(&block); end
|
292
|
+
|
293
|
+
# Returns a string containing a detailed summary of the keys and values.
|
294
|
+
#
|
295
|
+
# source://ostruct//lib/ostruct.rb#388
|
296
|
+
def to_s; end
|
297
|
+
|
298
|
+
# source://ostruct//lib/ostruct.rb#388
|
299
|
+
def to_s!; end
|
300
|
+
|
301
|
+
protected
|
302
|
+
|
303
|
+
# source://ostruct//lib/ostruct.rb#406
|
304
|
+
def table!; end
|
305
|
+
|
306
|
+
private
|
307
|
+
|
308
|
+
# source://ostruct//lib/ostruct.rb#147
|
309
|
+
def initialize_clone(orig); end
|
310
|
+
|
311
|
+
# source://ostruct//lib/ostruct.rb#152
|
312
|
+
def initialize_dup(orig); end
|
313
|
+
|
314
|
+
# source://ostruct//lib/ostruct.rb#251
|
315
|
+
def is_method_protected!(name); end
|
316
|
+
|
317
|
+
#
|
318
|
+
# Provides marshalling support for use by the Marshal library.
|
319
|
+
#
|
320
|
+
# source://ostruct//lib/ostruct.rb#157
|
321
|
+
def marshal_load(hash); end
|
322
|
+
|
323
|
+
# source://ostruct//lib/ostruct.rb#274
|
324
|
+
def method_missing(mid, *args); end
|
325
|
+
|
326
|
+
# Used internally to defined properties on the
|
327
|
+
# OpenStruct. It does this by using the metaprogramming function
|
328
|
+
# define_singleton_method for both the getter method and the setter method.
|
329
|
+
#
|
330
|
+
# source://ostruct//lib/ostruct.rb#234
|
331
|
+
def new_ostruct_member!(name); end
|
332
|
+
|
333
|
+
# :call-seq:
|
334
|
+
# ostruct[name] = obj -> obj
|
335
|
+
#
|
336
|
+
# Sets the value of an attribute.
|
337
|
+
#
|
338
|
+
# require "ostruct"
|
339
|
+
# person = OpenStruct.new("name" => "John Smith", "age" => 70)
|
340
|
+
# person[:age] = 42 # equivalent to person.age = 42
|
341
|
+
# person.age # => 42
|
342
|
+
#
|
343
|
+
# source://ostruct//lib/ostruct.rb#318
|
344
|
+
def set_ostruct_member_value!(name, value); end
|
345
|
+
|
346
|
+
# source://ostruct//lib/ostruct.rb#157
|
347
|
+
def update_to_values!(hash); end
|
348
|
+
end
|
349
|
+
|
350
|
+
# source://ostruct//lib/ostruct.rb#112
|
351
|
+
OpenStruct::HAS_PERFORMANCE_WARNINGS = T.let(T.unsafe(nil), TrueClass)
|
352
|
+
|
353
|
+
# source://ostruct//lib/ostruct.rb#110
|
354
|
+
OpenStruct::VERSION = T.let(T.unsafe(nil), String)
|