Module: RubyLLM::Mongoid::ModelMethods

Extended by:
ActiveSupport::Concern
Defined in:
lib/ruby_llm/mongoid/model_methods.rb

Overview

Mixes into a Mongoid document that represents a persisted LLM model record. Mirrors RubyLLM::ActiveRecord::ModelMethods.

Instance Method Summary collapse

Instance Method Details

#to_llmObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/ruby_llm/mongoid/model_methods.rb', line 54

def to_llm
  RubyLLM::Model::Info.new(
    id: model_id,
    name: name,
    provider: provider,
    family: family,
    created_at: model_created_at,
    context_window: context_window,
    max_output_tokens: max_output_tokens,
    knowledge_cutoff: knowledge_cutoff,
    modalities: modalities&.deep_symbolize_keys || {},
    capabilities: capabilities,
    pricing: pricing&.deep_symbolize_keys || {},
    metadata: &.deep_symbolize_keys || {}
  )
end