Class: Informers::Model
- Inherits:
-
Object
- Object
- Informers::Model
- Defined in:
- lib/informers/model.rb
Instance Method Summary collapse
- #embed(texts) ⇒ Object
-
#initialize(model_id, quantized: false) ⇒ Model
constructor
A new instance of Model.
Constructor Details
#initialize(model_id, quantized: false) ⇒ Model
Returns a new instance of Model.
3 4 5 6 |
# File 'lib/informers/model.rb', line 3 def initialize(model_id, quantized: false) @model_id = model_id @model = Informers.pipeline("embedding", model_id, quantized: quantized) end |
Instance Method Details
#embed(texts) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/informers/model.rb', line 8 def (texts) case @model_id when "sentence-transformers/all-MiniLM-L6-v2", "Xenova/all-MiniLM-L6-v2", "Xenova/multi-qa-MiniLM-L6-cos-v1", "Supabase/gte-small" @model.(texts) when "mixedbread-ai/mxbai-embed-large-v1" @model.(texts, pooling: "cls", normalize: false) else raise Error, "Use the embedding pipeline for this model: #{@model_id}" end end |