Class: Qdrant::Client

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/qdrant/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, api_key: nil, adapter: Faraday.default_adapter, raise_error: false) ⇒ Client

Returns a new instance of Client.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/qdrant/client.rb', line 14

def initialize(
  url:,
  api_key: nil,
  adapter: Faraday.default_adapter,
  raise_error: false
)
  @url = url
  @api_key = api_key
  @adapter = adapter
  @raise_error = raise_error
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



10
11
12
# File 'lib/qdrant/client.rb', line 10

def adapter
  @adapter
end

#api_keyObject (readonly)

Returns the value of attribute api_key.



10
11
12
# File 'lib/qdrant/client.rb', line 10

def api_key
  @api_key
end

#raise_errorObject (readonly)

Returns the value of attribute raise_error.



10
11
12
# File 'lib/qdrant/client.rb', line 10

def raise_error
  @raise_error
end

#urlObject (readonly)

Returns the value of attribute url.



10
11
12
# File 'lib/qdrant/client.rb', line 10

def url
  @url
end

Instance Method Details

#aliasesObject



38
39
40
# File 'lib/qdrant/client.rb', line 38

def aliases
  @aliases ||= Qdrant::Aliases.new(client: self).list
end

#clustersObject



54
55
56
# File 'lib/qdrant/client.rb', line 54

def clusters
  @clusters ||= Qdrant::Clusters.new(client: self)
end

#collectionsObject



42
43
44
# File 'lib/qdrant/client.rb', line 42

def collections
  @collections ||= Qdrant::Collections.new(client: self)
end

#connectionObject



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/qdrant/client.rb', line 26

def connection
  @connection ||= Faraday.new(url: url) do |faraday|
    if api_key
      faraday.headers["api-key"] = api_key
    end
    faraday.request :json
    faraday.response :raise_error if raise_error
    faraday.response :json, content_type: /\bjson$/
    faraday.adapter adapter
  end
end

#pointsObject



58
59
60
# File 'lib/qdrant/client.rb', line 58

def points
  @points ||= Qdrant::Points.new(client: self)
end

#serviceObject



50
51
52
# File 'lib/qdrant/client.rb', line 50

def service
  @service ||= Qdrant::Service.new(client: self)
end

#snapshotsObject



46
47
48
# File 'lib/qdrant/client.rb', line 46

def snapshots
  @snapshots ||= Qdrant::Snapshots.new(client: self)
end