9 #include "action_flags.h"
10 #include "continuous_action_response.h"
11 #include "decision_response.h"
13 #include "factory_resolver.h"
14 #include "future_compat.h"
15 #include "multi_slot_response.h"
16 #include "multi_slot_response_detailed.h"
17 #include "multistep.h"
27 class live_model_impl;
31 namespace model_management
33 class i_data_transport;
78 trace_logger_factory_t* trace_factory = &trace_logger_factory,
79 data_transport_factory_t* t_factory = &data_transport_factory, model_factory_t* m_factory = &model_factory,
80 sender_factory_t* s_factory = &sender_factory,
81 time_provider_factory_t* time_prov_factory = &time_provider_factory);
96 trace_logger_factory_t* trace_factory = &trace_logger_factory,
97 data_transport_factory_t* t_factory = &data_transport_factory, model_factory_t* m_factory = &model_factory,
98 sender_factory_t* s_factory = &sender_factory,
99 time_provider_factory_t* time_prov_factory = &time_provider_factory);
183 RL_DEPRECATED(
"New unified example builder interface is coming")
185 continuous_action_response& response,
api_status* status =
nullptr);
199 RL_DEPRECATED("New unified example builder interface is coming")
215 RL_DEPRECATED("New unified example builder interface is coming")
217 string_view context_json,
unsigned int flags, continuous_action_response& response,
api_status* status =
nullptr);
230 RL_DEPRECATED("New unified example builder interface is coming")
232 string_view context_json, continuous_action_response& response,
api_status* status =
nullptr);
248 RL_DEPRECATED("New interface unifying CB with CCB is coming")
250 string_view context_json,
unsigned int flags, decision_response& resp,
api_status* status =
nullptr);
265 RL_DEPRECATED("New interface unifying CB with CCB is coming")
283 RL_DEPRECATED("New unified example builder interface is coming")
285 multi_slot_response& resp,
api_status* status =
nullptr);
286 RL_DEPRECATED("New unified example builder interface is coming")
288 const
char* event_id, string_view context_json, multi_slot_response& resp,
api_status* status =
nullptr);
289 RL_DEPRECATED("New unified example builder interface is coming")
291 string_view context_json,
unsigned int flags, multi_slot_response& resp,
api_status* status =
nullptr);
292 RL_DEPRECATED("New unified example builder interface is coming")
295 RL_DEPRECATED("New unified example builder interface is coming")
297 multi_slot_response& resp, const
int* baseline_actions,
size_t baseline_actions_size,
300 RL_DEPRECATED("New unified example builder interface is coming")
302 multi_slot_response_detailed& resp,
api_status* status =
nullptr);
303 RL_DEPRECATED("New unified example builder interface is coming")
305 const
char* event_id, string_view context_json, multi_slot_response_detailed& resp,
api_status* status =
nullptr);
306 RL_DEPRECATED("New unified example builder interface is coming")
308 string_view context_json,
unsigned int flags, multi_slot_response_detailed& resp,
api_status* status =
nullptr);
309 RL_DEPRECATED("New unified example builder interface is coming")
311 string_view context_json, multi_slot_response_detailed& resp,
api_status* status =
nullptr);
313 RL_DEPRECATED("New unified example builder interface is coming")
315 multi_slot_response_detailed& resp, const
int* baseline_actions,
size_t baseline_actions_size,
319 int request_episodic_decision(const
char* event_id, const
char* previous_id, string_view context_json,
321 int request_episodic_decision(const
char* event_id, const
char* previous_id, string_view context_json,
422 const
char* primary_id, const
char* secondary_id, const
char* outcome,
api_status* status =
nullptr);
429 int refresh_model(
api_status* status =
nullptr);
441 template <typename ErrCntxt>
458 template <typename ErrCntxt>
459 explicit
live_model(const utility::configuration& config,
error_fn_t<ErrCntxt> fn, ErrCntxt* err_context =
nullptr,
460 trace_logger_factory_t* trace_factory = &trace_logger_factory,
461 data_transport_factory_t* t_factory = &data_transport_factory, model_factory_t* m_factory = &model_factory,
462 sender_factory_t* s_factory = &sender_factory,
463 time_provider_factory_t* time_prov_factory = &time_provider_factory);
483 std::unique_ptr<live_model_impl>
485 bool _initialized = false;
487 const std::vector<
int> default_baseline_vector = std::vector<
int>();
488 static std::vector<
int> c_array_to_vector(
489 const
int* c_array,
size_t array_size);
506 template <typename ErrCntxt>
508 trace_logger_factory_t* trace_factory, data_transport_factory_t* t_factory, model_factory_t* m_factory,
509 sender_factory_t* s_factory, time_provider_factory_t* time_prov_factory)
510 :
live_model(config, std::bind(fn, std::placeholders::_1, err_context), trace_factory, t_factory, m_factory,
511 s_factory, time_prov_factory)
Report status of all API calls.
Definition: api_status.h:22
Interface class for the Inference API.
Definition: live_model.h:52
void(*)(const api_status &, void *) error_fn
Error callback function. When live_model is constructed, a background error callback and a context (v...
Definition: live_model.h:62
int choose_rank(string_view context_json, unsigned int flags, ranking_response &resp, api_status *status=nullptr)
Choose an action, given a list of actions, action features and context features. The inference librar...
int request_decision(string_view context_json, unsigned int flags, decision_response &resp, api_status *status=nullptr)
(DEPRECATED) Choose an action from the given set for each slot, given a list of actions,...
int choose_rank(string_view context_json, ranking_response &resp, api_status *status=nullptr)
Choose an action, given a list of actions, action features and context features. The inference librar...
live_model(const utility::configuration &config, error_fn fn=nullptr, void *err_context=nullptr, trace_logger_factory_t *trace_factory=&trace_logger_factory, data_transport_factory_t *t_factory=&data_transport_factory, model_factory_t *m_factory=&model_factory, sender_factory_t *s_factory=&sender_factory, time_provider_factory_t *time_prov_factory=&time_provider_factory)
Construct a new live model object.
void(*)(const api_status &, ErrCntxt *) error_fn_t
Error callback function. When live_model is constructed, a background error callback and a context (v...
Definition: live_model.h:442
int choose_rank(const char *event_id, string_view context_json, unsigned int flags, ranking_response &resp, api_status *status=nullptr)
Choose an action, given a list of actions, action features and context features. The inference librar...
int init(api_status *status=nullptr)
Initialize inference library. Initialize the library and start the background threads used for model ...
int choose_rank(const char *event_id, string_view context_json, ranking_response &resp, api_status *status=nullptr)
Choose an action, given a list of actions, action features and context features. The inference librar...
int request_multi_slot_decision(const char *event_id, string_view context_json, unsigned int flags, multi_slot_response &resp, api_status *status=nullptr)
(DEPRECATED) Choose an action from the given set for each slot, given a list of actions,...
int report_action_taken(const char *event_id, api_status *status=nullptr)
Report that action was taken.
int report_outcome(const char *event_id, const char *outcome, api_status *status=nullptr)
Report the outcome for the top action.
live_model(const utility::configuration &config, std::function< void(const api_status &)> error_cb, trace_logger_factory_t *trace_factory=&trace_logger_factory, data_transport_factory_t *t_factory=&data_transport_factory, model_factory_t *m_factory=&model_factory, sender_factory_t *s_factory=&sender_factory, time_provider_factory_t *time_prov_factory=&time_provider_factory)
Construct a new live model object.
int request_continuous_action(const char *event_id, string_view context_json, unsigned int flags, continuous_action_response &response, api_status *status=nullptr)
(DEPRECATED) Choose an action from a continuous range, given a list of context features The inference...
choose_rank() returns the action choice using ranking_response. ranking_response contains all the act...
Definition: ranking_response.h:29
Configuration class to initialize the API Represents a collection of (name,value) pairs used to confi...
Definition: configuration.h:31
Definition of all API error return codes and descriptions.
[Error Generator]
Definition: live_model.h:25
ranking_response definition. ranking_response is returned from choose_rank call. It contains the chos...