Class: Pinecone::Vectors
- Inherits:
-
Object
- Object
- Pinecone::Vectors
- Defined in:
- lib/pinecone/vectors.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
Instance Method Summary collapse
- #delete(ids:, namespace: nil, delete_all: nil) ⇒ Object
- #fetch(ids:) ⇒ Object
-
#initialize(index:) ⇒ Vectors
constructor
A new instance of Vectors.
-
#upsert(body) ⇒ Object
# POST Upsert # Inserts or updates vectors in an index.
Constructor Details
#initialize(index:) ⇒ Vectors
Returns a new instance of Vectors.
4 5 6 |
# File 'lib/pinecone/vectors.rb', line 4 def initialize(index:) self.index = index end |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
3 4 5 |
# File 'lib/pinecone/vectors.rb', line 3 def index @index end |
Instance Method Details
#delete(ids:, namespace: nil, delete_all: nil) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/pinecone/vectors.rb', line 21 def delete(ids:, namespace: nil, delete_all: nil) params = { ids: ids.join(','), namespace: namespace, deleteAll: delete_all }.compact params = params.map{ |k, v| "#{k}=#{v}" }.join('&') Pinecone::Client.delete(prefix: index.prefix, path: "/vectors/delete?#{params}") end |
#fetch(ids:) ⇒ Object
16 17 18 |
# File 'lib/pinecone/vectors.rb', line 16 def fetch(ids:) Pinecone::Client.get(prefix: index.prefix, path: "/vectors/fetch?ids=#{ids.join(',')}") end |
#upsert(body) ⇒ Object
# POST Upsert # Inserts or updates vectors in an index. docs.pinecone.io/docs/insert-data#inserting-the-vectors
11 12 13 |
# File 'lib/pinecone/vectors.rb', line 11 def upsert(body) Pinecone::Client.json_post(prefix: index.prefix, path: "/vectors/upsert", parameters: body) end |