From f5ddbcaea3b4445beda057bddd164973c86619fb Mon Sep 17 00:00:00 2001 From: JTangCoveo <113382897+JTangCoveo@users.noreply.github.com> Date: Mon, 13 Nov 2023 10:26:34 -0500 Subject: [PATCH] feat(ml)!: Enforce trackingIds parameter in the creation of PQS and IAPR model (#762) feat(ml): enforce trackingIds parameter in the creation of PQS and IAPR model BREAKING CHANGE: For creation of PQS / IAPR models, trackingIds will be a mandatory parameter to be included --- .../IAPRConfiguration/IAPRConfigurationInterfaces.ts | 6 ++++++ .../IAPRConfiguration/tests/IAPRConfiguration.spec.ts | 1 + .../PQSConfiguration/PQSConfigurationInterfaces.ts | 6 ++++++ .../PQSConfiguration/tests/PQSConfiguration.spec.ts | 6 +++++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/resources/MachineLearning/IAPRConfiguration/IAPRConfigurationInterfaces.ts b/src/resources/MachineLearning/IAPRConfiguration/IAPRConfigurationInterfaces.ts index 81321c7fe..710e522cd 100644 --- a/src/resources/MachineLearning/IAPRConfiguration/IAPRConfigurationInterfaces.ts +++ b/src/resources/MachineLearning/IAPRConfiguration/IAPRConfigurationInterfaces.ts @@ -8,4 +8,10 @@ export interface IAPRConfigurationModel { * The model display name in the Coveo Administration console. */ modelDisplayName: string; + /** + * The trackingIds that usage analytics events must contain for the model to use those events in its learning process. The model will use an event if it contains at least one of the specified IDs + * + * @Example: [ "sport" ] + */ + trackingIds: string[]; } diff --git a/src/resources/MachineLearning/IAPRConfiguration/tests/IAPRConfiguration.spec.ts b/src/resources/MachineLearning/IAPRConfiguration/tests/IAPRConfiguration.spec.ts index c2d607dc1..123fb4a53 100644 --- a/src/resources/MachineLearning/IAPRConfiguration/tests/IAPRConfiguration.spec.ts +++ b/src/resources/MachineLearning/IAPRConfiguration/tests/IAPRConfiguration.spec.ts @@ -21,6 +21,7 @@ describe('IAPRConfiguration', () => { const model: IAPRConfigurationModel = { modelDisplayName: 'kiki soudane', catalogId: 'catalog_mock', + trackingIds: ['sport'], }; iaprConfig.create(model); expect(api.post).toHaveBeenCalledTimes(1); diff --git a/src/resources/MachineLearning/PQSConfiguration/PQSConfigurationInterfaces.ts b/src/resources/MachineLearning/PQSConfiguration/PQSConfigurationInterfaces.ts index 122ecfd9d..bb9821ac8 100644 --- a/src/resources/MachineLearning/PQSConfiguration/PQSConfigurationInterfaces.ts +++ b/src/resources/MachineLearning/PQSConfiguration/PQSConfigurationInterfaces.ts @@ -38,4 +38,10 @@ export interface PQSConfigurationModel { * The filter to apply to the 'Click' and 'Search' event dimensions of the UA data to learn from when rebuilding the model. */ searchEventFilter?: string; + /** + * The trackingIds that usage analytics events must contain for the model to use those events in its learning process. The model will use an event if it contains at least one of the specified IDs + * + * @Example: [ "sport" ] + */ + trackingIds: string[]; } diff --git a/src/resources/MachineLearning/PQSConfiguration/tests/PQSConfiguration.spec.ts b/src/resources/MachineLearning/PQSConfiguration/tests/PQSConfiguration.spec.ts index 268ed48f4..c28613313 100644 --- a/src/resources/MachineLearning/PQSConfiguration/tests/PQSConfiguration.spec.ts +++ b/src/resources/MachineLearning/PQSConfiguration/tests/PQSConfiguration.spec.ts @@ -18,7 +18,11 @@ describe('PQSConfiguration', () => { describe('createPQSModel', () => { it('should make a POST call to the specific PQSConfiguration url', () => { - const model: PQSConfigurationModel = {modelDisplayName: 'kiki soudane', catalogId: 'sekia'}; + const model: PQSConfigurationModel = { + modelDisplayName: 'kiki soudane', + catalogId: 'sekia', + trackingIds: ['sport'], + }; pqsConfig.createPQSModel(model); expect(api.post).toHaveBeenCalledTimes(1); expect(api.post).toHaveBeenCalledWith(`${PQSConfiguration.baseUrl}/model`, model);