Class: Milvus::Client
- Inherits:
-
Object
- Object
- Milvus::Client
- Defined in:
- lib/milvus/client.rb
Constant Summary collapse
- API_VERSION =
"v2/vectordb"
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#raise_error ⇒ Object
readonly
Returns the value of attribute raise_error.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #aliases ⇒ Object
- #collections ⇒ Object
- #connection ⇒ Object
- #entities ⇒ Object
- #indexes ⇒ Object
-
#initialize(url:, api_key: nil, adapter: Faraday.default_adapter, raise_error: false, logger: nil) ⇒ Client
constructor
A new instance of Client.
- #partitions ⇒ Object
- #roles ⇒ Object
- #users ⇒ Object
Constructor Details
#initialize(url:, api_key: nil, adapter: Faraday.default_adapter, raise_error: false, logger: nil) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/milvus/client.rb', line 11 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
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
7 8 9 |
# File 'lib/milvus/client.rb', line 7 def adapter @adapter end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/milvus/client.rb', line 7 def api_key @api_key end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/milvus/client.rb', line 7 def logger @logger end |
#raise_error ⇒ Object (readonly)
Returns the value of attribute raise_error.
7 8 9 |
# File 'lib/milvus/client.rb', line 7 def raise_error @raise_error end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/milvus/client.rb', line 7 def url @url end |
Instance Method Details
#aliases ⇒ Object
49 50 51 |
# File 'lib/milvus/client.rb', line 49 def aliases @aliases ||= Milvus::Aliases.new(client: self) end |
#collections ⇒ Object
25 26 27 |
# File 'lib/milvus/client.rb', line 25 def collections @schema ||= Milvus::Collections.new(client: self) end |
#connection ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/milvus/client.rb', line 53 def connection @connection ||= Faraday.new(url: "#{url}/#{API_VERSION}/") do |faraday| if api_key faraday.request :authorization, :Bearer, 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 |
#entities ⇒ Object
33 34 35 |
# File 'lib/milvus/client.rb', line 33 def entities @entities ||= Milvus::Entities.new(client: self) end |
#indexes ⇒ Object
37 38 39 |
# File 'lib/milvus/client.rb', line 37 def indexes @indexes ||= Milvus::Indexes.new(client: self) end |
#partitions ⇒ Object
29 30 31 |
# File 'lib/milvus/client.rb', line 29 def partitions @partitions ||= Milvus::Partitions.new(client: self) end |