diff --git a/pom.xml b/pom.xml index 8558826..0e9c832 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cloud.eppo eppo-server-sdk - 2.4.5 + 2.4.6 ${project.groupId}:${project.artifactId} Eppo Server-Side SDK for Java diff --git a/src/main/java/com/eppo/sdk/deserializer/BanditsDeserializer.java b/src/main/java/com/eppo/sdk/deserializer/BanditsDeserializer.java index 8d93c4d..7404f0f 100644 --- a/src/main/java/com/eppo/sdk/deserializer/BanditsDeserializer.java +++ b/src/main/java/com/eppo/sdk/deserializer/BanditsDeserializer.java @@ -53,9 +53,10 @@ public Map deserialize( JsonNode coefficientsNode = modelDataNode.get("coefficients"); Map coefficients = new HashMap<>(); - coefficientsNode.iterator().forEachRemaining(actionCoefficientsNode -> { - BanditCoefficients actionCoefficients = this.parseActionCoefficientsNode(actionCoefficientsNode); - coefficients.put(actionCoefficients.getActionKey(), actionCoefficients); + Iterator> coefficientIterator = coefficientsNode.fields(); + coefficientIterator.forEachRemaining(field -> { + BanditCoefficients actionCoefficients = this.parseActionCoefficientsNode(field.getValue()); + coefficients.put(field.getKey(), actionCoefficients); }); modelData.setCoefficients(coefficients); diff --git a/src/test/resources/bandits/bandits-parameters-1.json b/src/test/resources/bandits/bandits-parameters-1.json index 16a1a38..82d20fc 100644 --- a/src/test/resources/bandits/bandits-parameters-1.json +++ b/src/test/resources/bandits/bandits-parameters-1.json @@ -10,8 +10,8 @@ "gamma": 1.0, "defaultActionScore": 0.0, "actionProbabilityFloor": 0.0, - "coefficients": [ - { + "coefficients": { + "nike": { "actionKey": "nike", "intercept": 1.0, "actionNumericCoefficients": [ @@ -50,7 +50,7 @@ } ] }, - { + "adidas": { "actionKey": "adidas", "intercept": 1.1, "actionNumericCoefficients": [ @@ -82,7 +82,7 @@ } ] } - ] + } } }, { @@ -94,7 +94,7 @@ "gamma": 1.0, "defaultActionScore": 0.0, "actionProbabilityFloor": 0.0, - "coefficients": [] + "coefficients": {} } } ]