api package

Submodules

api.learn module

class api.learn.Learn[source]

Bases: object

The class Learn implements the methods used for performing the train

static act(request: ~flask.wrappers.Request) -> (<class 'bool'>, <class 'models.ActOutput'>)[source]

Decide the action according to the passed state

static train(request: Request) bool[source]

Train a single learning entry

static train_batch(request: Request) bool[source]

Perform the train in batch, we expect a list of samples in the request

api.utils module

class api.utils.Utils[source]

Bases: object

Implements useful methods for the package

HEADER_EPSILON = 'X-P2pfaas-Eps'
HEADER_LEARNING_ACTION = 'X-P2pfaas-Learning-Action'
HEADER_LEARNING_EID = 'X-P2pfaas-Learning-Eid'
HEADER_LEARNING_REWARD = 'X-P2pfaas-Learning-Reward'
HEADER_LEARNING_STATE = 'X-P2pfaas-Learning-State'
static prepare_res(status_code: int, headers: dict | None = None, content_str: str = '') Response[source]

Prepare the response

static prepare_res_json(response: dict) Response[source]

Prepare the json for the request

Module contents

The package implements the api endpoints of the service