85 lines
3.0 KiB
Ruby
85 lines
3.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe Llm::Models do
|
|
describe '.providers' do
|
|
it 'loads provider metadata from the config' do
|
|
expect(described_class.providers).to include(
|
|
'openai' => include('display_name' => 'OpenAI')
|
|
)
|
|
end
|
|
end
|
|
|
|
describe '.features' do
|
|
it 'keeps every feature default in the allowed model list' do
|
|
described_class.features.each do |feature_key, config|
|
|
expect(config['models']).to include(config['default']), "#{feature_key} default model must be allowed"
|
|
end
|
|
end
|
|
|
|
it 'references existing models from every feature' do
|
|
described_class.features.each do |feature_key, config|
|
|
missing_models = config['models'].reject { |model_name| described_class.models.key?(model_name) }
|
|
|
|
expect(missing_models).to be_empty, "#{feature_key} references missing models: #{missing_models.join(', ')}"
|
|
end
|
|
end
|
|
|
|
it 'routes document and conversation FAQ generation independently' do
|
|
expect(described_class.default_model_for('document_faq_generation')).to eq('gpt-5.6-terra')
|
|
expect(described_class.default_model_for('conversation_faq_generation')).to eq('gpt-5.6-terra')
|
|
end
|
|
|
|
it 'sets reasoning effort for every text generation feature' do
|
|
features_without_reasoning = %w[audio_transcription help_center_search]
|
|
|
|
described_class.features.each_key do |feature_key|
|
|
if features_without_reasoning.include?(feature_key)
|
|
expect(described_class.reasoning_effort_for(feature_key)).to be_nil
|
|
else
|
|
expect(described_class.reasoning_effort_for(feature_key)).to be_present
|
|
end
|
|
end
|
|
end
|
|
|
|
it 'exposes GPT-5.6 models for Captain V2 workflows without changing the legacy PDF path' do
|
|
expect(described_class.models_for('assistant')).to include('gpt-5.6-luna', 'gpt-5.6-terra', 'gpt-5.6-sol')
|
|
expect(described_class.models_for('pdf_faq_generation')).not_to include('gpt-5.6-luna', 'gpt-5.6-terra', 'gpt-5.6-sol')
|
|
end
|
|
end
|
|
|
|
describe '.models' do
|
|
it 'includes the GPT-5.6 model family' do
|
|
expect(described_class.models.keys).to include('gpt-5.6-luna', 'gpt-5.6-terra', 'gpt-5.6-sol')
|
|
end
|
|
|
|
it 'references existing providers from every model' do
|
|
missing_providers = described_class.models.filter_map do |model_name, config|
|
|
provider = config['provider']
|
|
next if described_class.providers.key?(provider)
|
|
|
|
"#{model_name}: #{provider}"
|
|
end
|
|
|
|
expect(missing_providers).to be_empty
|
|
end
|
|
end
|
|
|
|
describe '.feature_config' do
|
|
it 'returns model metadata for a feature' do
|
|
config = described_class.feature_config('editor')
|
|
|
|
expect(config[:default]).to eq('gpt-5.6-luna')
|
|
expect(config[:reasoning_effort]).to eq('low')
|
|
expect(config[:models].pluck(:id)).to include('gpt-5.6-luna', 'gpt-5.6-terra')
|
|
expect(config[:models].first).to include(
|
|
id: 'gpt-4.1-mini',
|
|
display_name: 'GPT-4.1 Mini',
|
|
provider: 'openai',
|
|
credit_multiplier: 1
|
|
)
|
|
end
|
|
end
|
|
end
|