Class: Aoororachain::VectorStores::Retriever
- Inherits:
-
Object
- Object
- Aoororachain::VectorStores::Retriever
- Defined in:
- lib/aoororachain/vector_stores/retriever.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
Returns the value of attribute results.
-
#search_type ⇒ Object
Returns the value of attribute search_type.
Instance Method Summary collapse
-
#initialize(vector_store, search_type: :similarity, results: 3) ⇒ Retriever
constructor
A new instance of Retriever.
- #search(query, **options) ⇒ Object
Constructor Details
#initialize(vector_store, search_type: :similarity, results: 3) ⇒ Retriever
Returns a new instance of Retriever.
8 9 10 11 12 |
# File 'lib/aoororachain/vector_stores/retriever.rb', line 8 def initialize(vector_store, search_type: :similarity, results: 3) @vector_store = vector_store @search_type = search_type @results = results end |
Instance Attribute Details
#results ⇒ Object
Returns the value of attribute results.
6 7 8 |
# File 'lib/aoororachain/vector_stores/retriever.rb', line 6 def results @results end |
#search_type ⇒ Object
Returns the value of attribute search_type.
6 7 8 |
# File 'lib/aoororachain/vector_stores/retriever.rb', line 6 def search_type @search_type end |
Instance Method Details
#search(query, **options) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/aoororachain/vector_stores/retriever.rb', line 14 def search(query, **) results = .delete(:results) || @results filter = .delete(:filter) || {} if @search_type == :similarity @vector_store.similarity_search(query, results:, filter:) end end |