diff --git a/README.md b/README.md index 8b99713..ea51886 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,8 @@ Alternatively the project can be build and run with the following commands: Now open [http://localhost:9090/v1.0/ui/](http://localhost:9090/v1.0/ui/) in a browser to explore the API through Swagger UI +# Running tests + +Unit tetsts are located in the "tests" folder and can be run witht the following command + + python -m pytest diff --git a/optimizerapi/openapi/specification.yml b/optimizerapi/openapi/specification.yml index c7406f8..7123d2c 100644 --- a/optimizerapi/openapi/specification.yml +++ b/optimizerapi/openapi/specification.yml @@ -14,6 +14,11 @@ paths: responses: '200': description: Result of running the optimizer with the specified parameters + content: + text/plain: + schema: + type: string + example: hello parameters: - name: params in: query @@ -21,4 +26,25 @@ paths: required: false schema: type: string - example: "test" + example: "[1,2,3]" + - name: Xi + in: query + description: "Xi value to be passed to ProcessOptimizer" + required: false + schema: + type: number + example: 0.01 + - name: yi + in: query + description: "yi value to be passed to ProcessOptimizer" + required: false + schema: + type: number + example: 1.0 + - name: kappa + in: query + description: "Kappa value to be passed to ProcessOptimizer" + required: false + schema: + type: number + example: 1.96 diff --git a/optimizerapi/optimizer.py b/optimizerapi/optimizer.py index 62c23a9..1638adc 100644 --- a/optimizerapi/optimizer.py +++ b/optimizerapi/optimizer.py @@ -20,7 +20,7 @@ def run(params: str = None, Xi: [float] = [0.01], yi: [Number] = [1], kappa: flo } optimizer = Optimizer(space, **hyperparams) # TODO call optimizer with proper Xi and Yi values - result = optimizer.tell(Xi, yi) + result = optimizer.tell([Xi], yi) if params: return 'Run with {params} = {result}'.format(params=params, result=result) else: diff --git a/tests/test_optimizer.py b/tests/test_optimizer.py index 8023451..29b7696 100644 --- a/tests/test_optimizer.py +++ b/tests/test_optimizer.py @@ -3,6 +3,6 @@ def test_first_sample(): Xi = [0.01] yi = 1 - result = optimizer.run(params=None, Xi=Xi, yi=yi) + result = optimizer.run(params="{}", Xi=Xi, yi=yi) print(result) assert "Run with" in result \ No newline at end of file