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, logger: nil) ⇒ Client

Returns a new instance of Client.



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

def initialize(
  url:,
  api_key: nil,
  adapter: Faraday.default_adapter,
  raise_error: false,
  logger: nil
)
  @url = url
  @api_key = api_key
  @adapter = adapter
  @raise_error = raise_error
  @logger = logger || Logger.new($stdout)
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

#loggerObject (readonly)

Returns the value of attribute logger.



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

def logger
  @logger
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



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

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

#clustersObject



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

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

#collectionsObject



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

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

#connectionObject



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

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

#pointsObject



61
62
63
# File 'lib/qdrant/client.rb', line 61

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

#serviceObject



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

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

#snapshotsObject



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

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