Module: Raif::ModelManifest
- Defined in:
- lib/raif/model_manifest.rb,
lib/raif/model_manifest/dsl.rb,
lib/raif/model_manifest/registry_data.rb,
lib/raif/model_manifest/smoke_observations.rb
Defined Under Namespace
Modules: Dsl, RegistryData Classes: EmbeddingEntry, Entry, Manifest, SmokeObservations
Constant Summary collapse
- MANIFEST_DIR =
File.("model_manifest/definitions", __dir__)
- PROVIDER_ADAPTERS =
Provider and endpoint names are strings in these lookup maps even though an entry's provider_name is a symbol: entries_for_model fetches by provider.name.to_s.
{ "anthropic" => "Raif::Llms::Anthropic", "bedrock" => "Raif::Llms::Bedrock", "open_router" => "Raif::Llms::OpenRouter", "x_ai" => "Raif::Llms::XAi", "google" => "Raif::Llms::Google" }.freeze
- OPEN_AI_ENDPOINT_ADAPTERS =
{ "completions" => "Raif::Llms::OpenAiCompletions", "responses" => "Raif::Llms::OpenAiResponses" }.freeze
- OPEN_AI_ENDPOINT_KEY_PREFIXES =
{ "completions" => "open_ai_", "responses" => "open_ai_responses_" }.freeze
- ADAPTER_ORDER =
[ "Raif::Llms::OpenAiCompletions", "Raif::Llms::OpenAiResponses", "Raif::Llms::Anthropic", "Raif::Llms::Bedrock", "Raif::Llms::OpenRouter", "Raif::Llms::XAi", "Raif::Llms::Google" ].freeze
- CAPABILITY_KEYS =
%i[ temperature structured_outputs native_tool_use streaming batch_inference images pdfs provider_managed_tools ].freeze
- LIFECYCLE_STATUSES =
%i[active deprecated retired].freeze
- LIFECYCLE_KEYS =
Every entry's lifecycle carries all of these, defaulting to nil, so a caller never has to ask whether a model declared them.
%i[status added_on deprecated_on retirement_date replacement_key migration_note].freeze
- PROVIDER_MANAGED_TOOL_CLASSES =
{ "web_search" => "Raif::ModelTools::ProviderManaged::WebSearch", "code_execution" => "Raif::ModelTools::ProviderManaged::CodeExecution", "image_generation" => "Raif::ModelTools::ProviderManaged::ImageGeneration" }.freeze
- ADAPTER_DEFAULTS =
What each adapter class assumes when model_provider_settings says nothing. RegistryData.provider_settings_for emits a setting only when the manifest value differs from these.
{ "Raif::Llms::OpenAiCompletions" => { "temperature" => true, "structured_outputs" => true, "batch_inference" => true }, "Raif::Llms::OpenAiResponses" => { "temperature" => true, "structured_outputs" => true, "batch_inference" => true }, "Raif::Llms::Anthropic" => { "temperature" => true, "structured_outputs" => false, "batch_inference" => true }, "Raif::Llms::Bedrock" => { "temperature" => true, "structured_outputs" => false, "batch_inference" => false }, # Mirrors OpenAI for structured outputs "Raif::Llms::OpenRouter" => { "temperature" => true, "structured_outputs" => true, "batch_inference" => false }, # Mirrors OpenAI for structured outputs; includes XAi::BatchInference "Raif::Llms::XAi" => { "temperature" => true, "structured_outputs" => true, "batch_inference" => true }, # Native JSON schema support; includes Google::BatchInference "Raif::Llms::Google" => { "temperature" => true, "structured_outputs" => true, "batch_inference" => true } }.freeze
Class Method Summary collapse
-
.load(dir: MANIFEST_DIR) ⇒ Object
Each file is evaluated against its own Dsl::Context, so nothing a manifest file declares can leak into the next file or into a later load.
Class Method Details
.load(dir: MANIFEST_DIR) ⇒ Object
Each file is evaluated against its own Dsl::Context, so nothing a manifest file declares can leak into the next file or into a later load.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/raif/model_manifest.rb', line 144 def self.load(dir: MANIFEST_DIR) llm_entries = [] = [] provider_references = {} provider_files = {} Dir[File.join(dir, "*.rb")].sort.each do |path| context = Dsl::Context.new.evaluate(File.read(path), path) context.providers.each do |provider| provider_references[provider.name] = provider.references provider_files[provider.name] = provider.source_path provider.models.each { |model| llm_entries.concat(entries_for_model(provider, model)) } end context..each do |provider| .concat((provider)) end end Manifest.new( llm_entries: llm_entries, embedding_entries: , provider_references: provider_references, provider_files: provider_files ) end |