class FuzzyAi::Account

Fuzzy.ai Account object

Attributes

key[R]

Public Class Methods

new(key) click to toggle source
# File lib/fuzzy.ai.rb, line 13
def initialize(key)
  @key = key
  @headers = {
    'Content-Type' => 'application/json',
    'Authorization' => 'Bearer ' + key,
    'User-Agent' => "fuzzy.ai-ruby/#{VERSION}"
  }
end

Public Instance Methods

evaluate(agent_id, inputs) click to toggle source
# File lib/fuzzy.ai.rb, line 22
def evaluate(agent_id, inputs)
  body = inputs.to_json
  headers = @headers.merge('Content-Length' => body.length.to_s)
  options = { headers: headers, body: body }

  response = self.class.post("/agent/#{agent_id}", options)
  id = response.headers['X-Evaluation-ID']
  [response, id]
end
feedback(evaluation_id, performance) click to toggle source
# File lib/fuzzy.ai.rb, line 32
def feedback(evaluation_id, performance)
  body = performance.to_json
  headers = @headers.merge('Content-Length' => body.length.to_s)
  options = { headers: headers, body: body }

  self.class.post("/evaluation/#{evaluation_id}/feedback", options)
end