Class: Weaviate::Classifications

Inherits:
Base
  • Object
show all
Defined in:
lib/weaviate/classifications.rb

Constant Summary collapse

PATH =
"classifications"

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Weaviate::Base

Instance Method Details

#create(class_name:, type:, classify_properties: nil, based_on_properties: nil, settings: nil, filters: nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/weaviate/classifications.rb', line 12

def create(
  class_name:,
  type:,
  classify_properties: nil,
  based_on_properties: nil,
  settings: nil,
  filters: nil
)
  response = client.connection.post(PATH) do |req|
    req.body = {}
    req.body["class"] = class_name
    req.body["type"] = type
    req.body["classifyProperties"] = classify_properties if classify_properties
    req.body["basedOnProperties"] = based_on_properties if based_on_properties
    req.body["settings"] = settings if settings
    req.body["filters"] = filters if filters
  end

  if response.success?
    response.body
  end
end

#get(id:) ⇒ Object



7
8
9
10
# File 'lib/weaviate/classifications.rb', line 7

def get(id:)
  response = client.connection.get("#{PATH}/#{id}")
  response.body
end