Class: Boxcars::VectorStore::EmbedViaOpenAI
- Inherits:
-
Object
- Object
- Boxcars::VectorStore::EmbedViaOpenAI
- Includes:
- Boxcars::VectorStore
- Defined in:
- lib/boxcars/vector_store/embed_via_open_ai.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(texts:, client:, model: 'text-embedding-ada-002') ⇒ EmbedViaOpenAI
constructor
A new instance of EmbedViaOpenAI.
Methods included from Boxcars::VectorStore
Constructor Details
#initialize(texts:, client:, model: 'text-embedding-ada-002') ⇒ EmbedViaOpenAI
Returns a new instance of EmbedViaOpenAI.
10 11 12 13 14 15 |
# File 'lib/boxcars/vector_store/embed_via_open_ai.rb', line 10 def initialize(texts:, client:, model: 'text-embedding-ada-002') validate_params(texts, client) @texts = texts @client = client @model = model end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/boxcars/vector_store/embed_via_open_ai.rb', line 17 def call texts.map do |text| = (model: model, input: strip_new_lines(text)) { embedding: , dim: .size } end end |