Reinforcement Learning  1.1
reinforcement_learning::live_model Class Reference

Interface class for the Inference API. More...

#include <live_model.h>

Public Types

using error_fn = void(*)(const api_status &, void *)
 Error callback function. When live_model is constructed, a background error callback and a context (void*) is registered. If there is an error in the background thread, error callback will get invoked with api_status and the context (void*). More...
 
template<typename ErrCntxt >
using error_fn_t = void(*)(const api_status &, ErrCntxt *)
 Error callback function. When live_model is constructed, a background error callback and a context (void*) is registered. If there is an error in the background thread, error callback will get invoked with api_status and the context (void*). This error callback is typed by the context used in the callback. More...
 

Public Member Functions

 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. More...
 
 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. More...
 
int init (api_status *status=nullptr)
 Initialize inference library. Initialize the library and start the background threads used for model managment and sending actions and outcomes to the online trainer. More...
 
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 library chooses an action by creating a probability distribution over the actions and then sampling from it. More...
 
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 library chooses an action by creating a probability distribution over the actions and then sampling from it. A unique event_id will be generated and returned in the ranking_response. The same event_id should be used when reporting the outcome for this action. More...
 
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 library chooses an action by creating a probability distribution over the actions and then sampling from it. More...
 
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 library chooses an action by creating a probability distribution over the actions and then sampling from it. A unique event_id will be generated and returned in the ranking_response. The same event_id should be used when reporting the outcome for this action. More...
 
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 library chooses an action by sampling the probability density function produced per continuous action range. The corresponding event_id should be used when reporting the outcome for the continuous action. More...
 
int request_continuous_action (const char *event_id, string_view context_json, continuous_action_response &response, api_status *status=nullptr)
 (DEPRECATED) Choose an action from a continuous range, given a list of context features The inference library chooses an action by sampling the probability density function produced per continuous action range. The corresponding event_id should be used when reporting the outcome for the continuous action. More...
 
int request_continuous_action (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 library chooses an action by sampling the probability density function produced per continuous action range. A unique event_id will be generated and returned in the continuous_action_response. The same event_id should be used when reporting the outcome for this action. More...
 
int request_continuous_action (string_view context_json, continuous_action_response &response, api_status *status=nullptr)
 (DEPRECATED) Choose an action from a continuous range, given a list of context features The inference library chooses an action by sampling the probability density function produced per continuous action range. A unique event_id will be generated and returned in the continuous_action_response. The same event_id should be used when reporting the outcome for this action. More...
 
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, slots, action features, slot feautres and context features. The inference library chooses an action per slot by sampling the probability distribution produced per slot. A unique event_id can be supplied for each slot using the _id json field. The corresponding event_id should be used when reporting the outcome for each slot. More...
 
int request_decision (string_view context_json, decision_response &resp, api_status *status=nullptr)
 (DEPRECATED) Choose an action from the given set for each slot, given a list of actions, slots, action features, slot feautres and context features. The inference library chooses an action per slot by sampling the probability distribution produced per slot. A unique event_id can be supplied for each slot using the _id json field. The corresponding event_id should be used when reporting the outcome for each slot. More...
 
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, slots, action features, slot features and context features. The inference library chooses an action per slot by sampling the probability distribution produced per slot. The corresponding event_id should be used when reporting the outcome for each slot. More...
 
int request_multi_slot_decision (const char *event_id, string_view context_json, multi_slot_response &resp, api_status *status=nullptr)
 
int request_multi_slot_decision (string_view context_json, unsigned int flags, multi_slot_response &resp, api_status *status=nullptr)
 
int request_multi_slot_decision (string_view context_json, multi_slot_response &resp, api_status *status=nullptr)
 
int request_multi_slot_decision (const char *event_id, string_view context_json, unsigned int flags, multi_slot_response &resp, const int *baseline_actions, size_t baseline_actions_size, api_status *status=nullptr)
 
int request_multi_slot_decision (const char *event_id, string_view context_json, unsigned int flags, multi_slot_response_detailed &resp, api_status *status=nullptr)
 
int request_multi_slot_decision (const char *event_id, string_view context_json, multi_slot_response_detailed &resp, api_status *status=nullptr)
 
int request_multi_slot_decision (string_view context_json, unsigned int flags, multi_slot_response_detailed &resp, api_status *status=nullptr)
 
int request_multi_slot_decision (string_view context_json, multi_slot_response_detailed &resp, api_status *status=nullptr)
 
int request_multi_slot_decision (const char *event_id, string_view context_json, unsigned int flags, multi_slot_response_detailed &resp, const int *baseline_actions, size_t baseline_actions_size, api_status *status=nullptr)
 
int request_episodic_decision (const char *event_id, const char *previous_id, string_view context_json, ranking_response &resp, episode_state &episode, api_status *status=nullptr)
 
int request_episodic_decision (const char *event_id, const char *previous_id, string_view context_json, unsigned int flags, ranking_response &resp, episode_state &episode, api_status *status=nullptr)
 
int report_action_taken (const char *event_id, api_status *status=nullptr)
 Report that action was taken. More...
 
int report_action_taken (const char *primary_id, const char *secondary_id, api_status *status=nullptr)
 Report that action was taken. More...
 
int report_outcome (const char *event_id, const char *outcome, api_status *status=nullptr)
 Report the outcome for the top action. More...
 
int report_outcome (const char *event_id, float outcome, api_status *status=nullptr)
 Report the outcome for the top action. More...
 
int report_outcome (const char *primary_id, int secondary_id, float outcome, api_status *status=nullptr)
 Report outcome of a decision based on a pair of primary and secondary indentifiers. This identifier pair is problem specific. For CCB, the primary is the event id and the secondary is the index of the slot. More...
 
int report_outcome (const char *primary_id, const char *secondary_id, float outcome, api_status *status=nullptr)
 Report outcome of a decision based on a pair of primary and secondary indentifiers. This identifier pair is problem specific. For CCB, the primary is the event id and the secondary is the index of the slot. More...
 
int report_outcome (const char *primary_id, int secondary_id, const char *outcome, api_status *status=nullptr)
 Report outcome of a decision based on a pair of primary and secondary indentifiers. This identifier pair is problem specific. For CCB, the primary is the event id and the secondary is the index of the slot. More...
 
int report_outcome (const char *primary_id, const char *secondary_id, const char *outcome, api_status *status=nullptr)
 Report outcome of a decision based on a pair of primary and secondary indentifiers. This identifier pair is problem specific. For CCB, the primary is the event id and the secondary is the index of the slot. More...
 
int refresh_model (api_status *status=nullptr)
 
template<typename ErrCntxt >
 live_model (const utility::configuration &config, error_fn_t< ErrCntxt > fn, ErrCntxt *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. More...
 
 live_model (live_model &&other) noexcept
 Move constructor for live model object.
 
live_modeloperator= (live_model &&other) noexcept
 Move assignment operator swaps implementation.
 
 live_model (const live_model &)=delete
 
live_modeloperator= (live_model &)=delete
 Prevent accidental copy, since destructor will deallocate the implementation.
 
 ~live_model ()
 Prevent accidental copy, since destructor will deallocate the implementation.
 

Detailed Description

Interface class for the Inference API.

  • (1) Instantiate and Initialize
  • (2) choose_rank() to choose an action from a list of actions
  • (3) report_outcome() to provide feedback on chosen action

Member Typedef Documentation

◆ error_fn

Error callback function. When live_model is constructed, a background error callback and a context (void*) is registered. If there is an error in the background thread, error callback will get invoked with api_status and the context (void*).

NOTE: Error callback will get invoked in a background thread.

◆ error_fn_t

template<typename ErrCntxt >
using reinforcement_learning::live_model::error_fn_t = void (*)(const api_status&, ErrCntxt*)

Error callback function. When live_model is constructed, a background error callback and a context (void*) is registered. If there is an error in the background thread, error callback will get invoked with api_status and the context (void*). This error callback is typed by the context used in the callback.

NOTE: Error callback will get invoked in a background thread.

Template Parameters
ErrCntxtContext type used when the error callback is invoked

Constructor & Destructor Documentation

◆ live_model() [1/3]

reinforcement_learning::live_model::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 
)
explicit

Construct a new live model object.

Parameters
configName-Value based configuration
fnError callback for handling errors in background thread
err_contextContext passed back during Error callback
t_factoryTransport factory. The default transport factory is initialized with a REST based transport that gets data from an Azure storage account
m_factoryModel factory. The default model factory hydrates vw models used for local inference.
sender_factorySender factory. The default factory provides two senders, one for interaction and the other for observation which logs to Event Hub.

◆ live_model() [2/3]

reinforcement_learning::live_model::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 
)
explicit

Construct a new live model object.

Parameters
configName-Value based configuration
error_cbError callback that takes no context
t_factoryTransport factory. The default transport factory is initialized with a REST based transport that gets data from an Azure storage account
m_factoryModel factory. The default model factory hydrates vw models used for local inference.
sender_factorySender factory. The default factory provides two senders, one for interaction and the other for observation which logs to Event Hub.

◆ live_model() [3/3]

template<typename ErrCntxt >
reinforcement_learning::live_model::live_model ( const utility::configuration config,
error_fn_t< ErrCntxt >  fn,
ErrCntxt *  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 
)
explicit

Construct a new live model object.

Template Parameters
ErrCntxtContext type used in error callback.
Parameters
configName-Value based configuration
fnError callback for handling errors in background thread
err_contextContext passed back during Error callback
t_factoryTransport factory. The default transport factory is initialized with a REST based transport that gets data from an Azure storage account
m_factoryModel factory. The default model factory hydrates vw models used for local inference.
sender_factorySender factory. The default factory provides two senders, one for interaction and the other for observation which logs to Event Hub.
Template Parameters
ErrCntxtContext type used in error callback.
Parameters
configName-Value based configuration
fnError callback for handling errors in background thread
err_contextContext passed back during Error callback
t_factoryTransport factory. The default transport factory is initialized with a REST based transport that gets data from an Azure storage account
m_factoryModel factory. The default model factory hydrates vw models used for local inference.
sender_factorySender factory. The default factory provides two senders, one for interaction and the other for observations which logs to Event Hub.

Member Function Documentation

◆ choose_rank() [1/4]

int reinforcement_learning::live_model::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 library chooses an action by creating a probability distribution over the actions and then sampling from it.

Parameters
event_idThe unique identifier for this interaction. The same event_id should be used when reporting the outcome for this action.
context_jsonContains action, action features and context features in json format
respRanking response contains the chosen action, probability distribution used for sampling actions and ranked actions
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ choose_rank() [2/4]

int reinforcement_learning::live_model::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 library chooses an action by creating a probability distribution over the actions and then sampling from it.

Parameters
event_idThe unique identifier for this interaction. The same event_id should be used when reporting the outcome for this action.
context_jsonContains action, action features and context features in json format
flagsAction flags (see action_flags.h)
respRanking response contains the chosen action, probability distribution used for sampling actions and ranked actions
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ choose_rank() [3/4]

int reinforcement_learning::live_model::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 library chooses an action by creating a probability distribution over the actions and then sampling from it. A unique event_id will be generated and returned in the ranking_response. The same event_id should be used when reporting the outcome for this action.

Parameters
context_jsonContains action, action features and context features in json format
respRanking response contains the chosen action, probability distribution used for sampling actions and ranked actions
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ choose_rank() [4/4]

int reinforcement_learning::live_model::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 library chooses an action by creating a probability distribution over the actions and then sampling from it. A unique event_id will be generated and returned in the ranking_response. The same event_id should be used when reporting the outcome for this action.

Parameters
context_jsonContains action, action features and context features in json format
flagsAction flags (see action_flags.h)
respRanking response contains the chosen action, probability distribution used for sampling actions and ranked actions
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ init()

int reinforcement_learning::live_model::init ( api_status status = nullptr)

Initialize inference library. Initialize the library and start the background threads used for model managment and sending actions and outcomes to the online trainer.

Parameters
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ report_action_taken() [1/2]

int reinforcement_learning::live_model::report_action_taken ( const char *  event_id,
api_status status = nullptr 
)

Report that action was taken.

Parameters
event_idThe unique event_id used when choosing an action should be presented here. This is so that the action taken can be matched with feedback received.
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ report_action_taken() [2/2]

int reinforcement_learning::live_model::report_action_taken ( const char *  primary_id,
const char *  secondary_id,
api_status status = nullptr 
)

Report that action was taken.

Parameters
primary_idThe unique primary_id used when choosing an action should be presented here. This is so that the action taken can be matched with feedback received.
secondary_idIndex of the partial outcome.
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ report_outcome() [1/6]

int reinforcement_learning::live_model::report_outcome ( const char *  event_id,
const char *  outcome,
api_status status = nullptr 
)

Report the outcome for the top action.

Parameters
event_idThe unique event_id used when choosing an action should be presented here. This is so that the action taken can be matched with feedback received.
outcomeOutcome serialized as a string
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ report_outcome() [2/6]

int reinforcement_learning::live_model::report_outcome ( const char *  event_id,
float  outcome,
api_status status = nullptr 
)

Report the outcome for the top action.

Parameters
event_idThe unique event_id used when choosing an action should be presented here. This is so that the action taken can be matched with feedback received.
outcomeOutcome as float
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ report_outcome() [3/6]

int reinforcement_learning::live_model::report_outcome ( const char *  primary_id,
const char *  secondary_id,
const char *  outcome,
api_status status = nullptr 
)

Report outcome of a decision based on a pair of primary and secondary indentifiers. This identifier pair is problem specific. For CCB, the primary is the event id and the secondary is the index of the slot.

Parameters
primary_idThe unique primary_id used when choosing an action should be presented here. This is so that the action taken can be matched with feedback received.
secondary_idIndex of the partial outcome.
outcomeOutcome as float.
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ report_outcome() [4/6]

int reinforcement_learning::live_model::report_outcome ( const char *  primary_id,
const char *  secondary_id,
float  outcome,
api_status status = nullptr 
)

Report outcome of a decision based on a pair of primary and secondary indentifiers. This identifier pair is problem specific. For CCB, the primary is the event id and the secondary is the index of the slot.

Parameters
primary_idThe unique primary_id used when choosing an action should be presented here. This is so that the action taken can be matched with feedback received.
secondary_idIndex of the partial outcome.
outcomeOutcome as float.
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ report_outcome() [5/6]

int reinforcement_learning::live_model::report_outcome ( const char *  primary_id,
int  secondary_id,
const char *  outcome,
api_status status = nullptr 
)

Report outcome of a decision based on a pair of primary and secondary indentifiers. This identifier pair is problem specific. For CCB, the primary is the event id and the secondary is the index of the slot.

Parameters
primary_idThe unique primary_id used when choosing an action should be presented here. This is so that the action taken can be matched with feedback received.
secondary_idIndex of the partial outcome.
outcomeOutcome as float.
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ report_outcome() [6/6]

int reinforcement_learning::live_model::report_outcome ( const char *  primary_id,
int  secondary_id,
float  outcome,
api_status status = nullptr 
)

Report outcome of a decision based on a pair of primary and secondary indentifiers. This identifier pair is problem specific. For CCB, the primary is the event id and the secondary is the index of the slot.

Parameters
primary_idThe unique primary_id used when choosing an action should be presented here. This is so that the action taken can be matched with feedback received.
secondary_idIndex of the partial outcome.
outcomeOutcome as float.
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ request_continuous_action() [1/4]

int reinforcement_learning::live_model::request_continuous_action ( const char *  event_id,
string_view  context_json,
continuous_action_response &  response,
api_status status = nullptr 
)

(DEPRECATED) Choose an action from a continuous range, given a list of context features The inference library chooses an action by sampling the probability density function produced per continuous action range. The corresponding event_id should be used when reporting the outcome for the continuous action.

Parameters
event_idThe unique identifier for this interaction. The same event_id should be used when reporting the outcome for this action.
context_jsonContains context features in json format
responseContinuous action response contains the chosen action and the probability density value of the chosen action location from the continuous range.
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ request_continuous_action() [2/4]

int reinforcement_learning::live_model::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 library chooses an action by sampling the probability density function produced per continuous action range. The corresponding event_id should be used when reporting the outcome for the continuous action.

Parameters
event_idThe unique identifier for this interaction. The same event_id should be used when reporting the outcome for this action.
context_jsonContains context features in json format
flagsAction flags (see action_flags.h)
responseContinuous action response contains the chosen action and the probability density value of the chosen action location from the continuous range.
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ request_continuous_action() [3/4]

int reinforcement_learning::live_model::request_continuous_action ( string_view  context_json,
continuous_action_response &  response,
api_status status = nullptr 
)

(DEPRECATED) Choose an action from a continuous range, given a list of context features The inference library chooses an action by sampling the probability density function produced per continuous action range. A unique event_id will be generated and returned in the continuous_action_response. The same event_id should be used when reporting the outcome for this action.

Parameters
context_jsonContains context features in json format
responseContinuous action response contains the chosen action and the probability density value of the chosen action location from the continuous range.
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ request_continuous_action() [4/4]

int reinforcement_learning::live_model::request_continuous_action ( 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 library chooses an action by sampling the probability density function produced per continuous action range. A unique event_id will be generated and returned in the continuous_action_response. The same event_id should be used when reporting the outcome for this action.

Parameters
context_jsonContains context features in json format
flagsAction flags (see action_flags.h)
responseContinuous action response contains the chosen action and the probability density value of the chosen action location from the continuous range.
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ request_decision() [1/2]

int reinforcement_learning::live_model::request_decision ( string_view  context_json,
decision_response &  resp,
api_status status = nullptr 
)

(DEPRECATED) Choose an action from the given set for each slot, given a list of actions, slots, action features, slot feautres and context features. The inference library chooses an action per slot by sampling the probability distribution produced per slot. A unique event_id can be supplied for each slot using the _id json field. The corresponding event_id should be used when reporting the outcome for each slot.

Parameters
context_jsonContains slots, slot_features, slot ids, actions, action features and context features in json format
respDecision response contains the chosen action per slot, probability distribution used for sampling actions and ranked actions.
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ request_decision() [2/2]

int reinforcement_learning::live_model::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, slots, action features, slot feautres and context features. The inference library chooses an action per slot by sampling the probability distribution produced per slot. A unique event_id can be supplied for each slot using the _id json field. The corresponding event_id should be used when reporting the outcome for each slot.

Parameters
context_jsonContains slots, slot_features, slot ids, actions, action features and context features in json format
flagsAction flags (see action_flags.h)
respDecision response contains the chosen action per slot, probability distribution used for sampling actions and ranked actions.
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

◆ request_multi_slot_decision()

int reinforcement_learning::live_model::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, slots, action features, slot features and context features. The inference library chooses an action per slot by sampling the probability distribution produced per slot. The corresponding event_id should be used when reporting the outcome for each slot.

Parameters
event_idThe unique identifier for this interaction. The same event_id should be used when reporting the outcome for this action.
context_jsonContains slots, slot_features, slot ids, actions, action features and context features in json format
flagsAction flags (see action_flags.h)
respDecision response contains the chosen action per slot, probability distribution used for sampling actions and ranked actions.
statusOptional field with detailed string description if there is an error
Returns
int Return error code. This will also be returned in the api_status object

The documentation for this class was generated from the following file: