Class: Cadenya::Resources::Objectives::Feedback

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/resources/objectives/feedback.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Feedback

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Feedback.

Parameters:



83
84
85
# File 'lib/cadenya/resources/objectives/feedback.rb', line 83

def initialize(client:)
  @client = client
end

Instance Method Details

#create(objective_id, workspace_id:, data:, metadata:, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveFeedback

Some parameter documentations has been truncated, see Models::Objectives::FeedbackCreateParams for more details.

Submits feedback for an objective’s execution. Feedback scores are used by the agent variation scoring system to evaluate and rank variation performance.

Parameters:

Returns:

See Also:



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cadenya/resources/objectives/feedback.rb', line 28

def create(objective_id, params)
  parsed, options = Cadenya::Objectives::FeedbackCreateParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["v1/workspaces/%1$s/objectives/%2$s/feedback", workspace_id, objective_id],
    body: parsed,
    model: Cadenya::Objectives::ObjectiveFeedback,
    options: options
  )
end

#list(objective_id, workspace_id:, cursor: nil, limit: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Objectives::ObjectiveFeedback>

Some parameter documentations has been truncated, see Models::Objectives::FeedbackListParams for more details.

Lists all feedback submitted for an objective

Parameters:

  • objective_id (String)

    Path param: The ID of the objective. Supports “external_id:” prefix for external

  • workspace_id (String)

    Path param

  • cursor (String)

    Query param: Pagination cursor from previous response

  • limit (Integer)

    Query param: Maximum number of results to return

  • request_options (Cadenya::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/cadenya/resources/objectives/feedback.rb', line 63

def list(objective_id, params)
  parsed, options = Cadenya::Objectives::FeedbackListParams.dump_request(params)
  query = Cadenya::Internal::Util.encode_query_params(parsed)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["v1/workspaces/%1$s/objectives/%2$s/feedback", workspace_id, objective_id],
    query: query,
    page: Cadenya::Internal::CursorPagination,
    model: Cadenya::Objectives::ObjectiveFeedback,
    options: options
  )
end