-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mlx): add the modeldetailedinfo call (#874)
* feat(mlx): add the modeldetailedinfo call * fix(SRC-5281): drop call that was removed (#873) fix(SRC-5281)!: drop call that was removed * fix: double status interface * fix(test): add test for modeldetailedinfo * fix: lint fix interface * fix: add point --------- Co-authored-by: Tahar Mustapha <[email protected]> Co-authored-by: JTangCoveo <[email protected]>
- Loading branch information
1 parent
da19840
commit 584a82d
Showing
16 changed files
with
258 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/resources/MachineLearning/ModelDetailedInfo/ModelDetailedInfo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import API from '../../../APICore.js'; | ||
import Resource from '../../Resource.js'; | ||
import {ModelWithDetails} from './ModelDetailedInfoInterfaces.js'; | ||
|
||
export default class ModelDetailedInfo extends Resource { | ||
static baseUrl = `/rest/organizations/${API.orgPlaceholder}/machinelearning/configuration/modeldetailedinfo`; | ||
|
||
get(modelId: string) { | ||
return this.api.get<ModelWithDetails>(`${ModelDetailedInfo.baseUrl}/${modelId}`); | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
src/resources/MachineLearning/ModelDetailedInfo/ModelDetailedInfoInterfaces.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import {MLModelStatus} from '../MachineLearningInterfaces.js'; | ||
import {ModelDetails} from './details/ModelDetails.js'; | ||
|
||
export interface ModelAssociation { | ||
/** | ||
* The unique identifier of the query pipeline to which the model is associated. | ||
* @example 38b08160-d7d4-4626-8e03-53587c23415d | ||
*/ | ||
parentId: string; | ||
/** | ||
* The unique identifier of the model association. | ||
* @example 917af358-13fd-4c8e-94af-7cf649bddc48 | ||
*/ | ||
id: string; | ||
/** | ||
* The name of the query pipeline or case assist configuration the model is associated with. | ||
* @example association name | ||
*/ | ||
name: string; | ||
/** | ||
* The type of the association. | ||
* @example QUERY_PIPELINE | ||
*/ | ||
associationType: 'QUERY_PIPELINE' | 'CASE_ASSIST'; | ||
} | ||
|
||
export interface ModelIssues { | ||
/** | ||
* A description of an error or limitation present in the model. | ||
*/ | ||
description: string; | ||
/** | ||
* The recommended action to perform to resolve the error or limitation. | ||
*/ | ||
troubleshoot: string; | ||
} | ||
|
||
export interface ModelStatusInfo { | ||
/** | ||
* The status of the model. | ||
* @example ACTIVE | ||
*/ | ||
modelStatus: MLModelStatus; | ||
/** | ||
* The remaining days until the model is archived. | ||
* @example 2 | ||
*/ | ||
daysUntilArchival: number; | ||
} | ||
|
||
export interface ModelWithDetails { | ||
/** | ||
* The id of the engine. | ||
* @Example topclicks | ||
*/ | ||
engineId: string; | ||
/** | ||
* The unique identifier of the target machine learning model. | ||
* @example My_Model_ID | ||
*/ | ||
modelId: string; | ||
/** | ||
* The name of the model configuration. | ||
* @example My model | ||
*/ | ||
modelDisplayName: string; | ||
/** | ||
* The associations related to this model. | ||
* @example [{ | ||
* "parentId": "38b08160-d7d4-4626-8e03-53587c23415d", | ||
* "id": "917af358-13fd-4c8e-94af-7cf649bddc48", | ||
* "name": "test pipeline", | ||
* "associationType": "QUERY_PIPELINE" | ||
* }] | ||
*/ | ||
modelAssociations: ModelAssociation[]; | ||
/** | ||
* The date and time the model was last updated. | ||
* @example 1691762520000 | ||
*/ | ||
estimatedPreviousModelUpdateTime: number; | ||
/** | ||
* The date and time the model is scheduled to start its next update. | ||
* @example 1691762520000 | ||
*/ | ||
nextModelUpdateTime: number; | ||
/** | ||
* The description and troubleshooting messages for a model error or limitation. | ||
*/ | ||
modelIssues: ModelIssues[]; | ||
/** | ||
* The detailed information about the model. | ||
*/ | ||
modelDetails?: ModelDetails; | ||
/** | ||
* The current status of the model. | ||
*/ | ||
modelStatusInfo: ModelStatusInfo; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/resources/MachineLearning/ModelDetailedInfo/details/ModelDetails.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {ModelDetailsBuildingStats} from './ModelDetailsBuildingStats.js'; | ||
import {ModelDetailsLanguages} from './ModelDetailsLanguages.js'; | ||
import {ModelDetailsSubModels} from './ModelDetailsSubModels.js'; | ||
|
||
export interface ModelDetails { | ||
possibleRecommendations?: number; | ||
totalQueries?: number; | ||
recommendationsPerLanguage?: Map<string, number>; | ||
userContextFields?: string[]; | ||
contentIDKeys?: string[]; | ||
candidatesPerFilters?: Map<string, number>; | ||
contextCandidateExamples?: Map<string, string[]>; | ||
languages?: Map<string, ModelDetailsLanguages>; | ||
candidateExamples?: Map<string, string[]>; | ||
candidatesPerLanguages?: Map<string, number>; | ||
minClickCountPerLang?: Map<string, number>; | ||
subModels?: {[key: string]: ModelDetailsSubModels}; | ||
candidates?: number; | ||
modelDetailedBuildingStats?: ModelDetailsBuildingStats; | ||
} |
31 changes: 31 additions & 0 deletions
31
src/resources/MachineLearning/ModelDetailedInfo/details/ModelDetailsBuildingStats.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import {ModelDetailsCommerceEvents} from './ModelDetailsCommerceEvents.js'; | ||
import {ModelDetailsStatsPerSource} from './ModelDetailsStatsPerSource.js'; | ||
|
||
export interface ModelDetailsBuildingStats { | ||
documentWithSnippetRatio?: number; | ||
headerCount?: number; | ||
snippetCount?: number; | ||
meanSnippetLength?: number; | ||
documentCount?: number; | ||
documentWithSnippetCount?: number; | ||
searchEventCount?: number; | ||
clickEventCount?: number; | ||
viewEventCount?: number; | ||
customEventCount?: number; | ||
segmentedVisitsCount?: number; | ||
searchCount?: number; | ||
clickCount?: number; | ||
viewCount?: number; | ||
visitsCount?: number; | ||
facetSelectEventCount?: number; | ||
snippetsPerDocument?: { | ||
min?: number; | ||
max?: number; | ||
mean?: number; | ||
}; | ||
invalidHtmlDocumentCount?: number; | ||
documentWithoutIdCount?: number; | ||
documentWithDuplicatedIdCount?: number; | ||
commerceEventCounts?: ModelDetailsCommerceEvents; | ||
modelDetailedStatsPerSource?: ModelDetailsStatsPerSource[]; | ||
} |
6 changes: 6 additions & 0 deletions
6
src/resources/MachineLearning/ModelDetailedInfo/details/ModelDetailsCommerceEvents.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface ModelDetailsCommerceEvents { | ||
removeFromCart?: number; | ||
addToCart?: number; | ||
addPurchase?: number; | ||
detailView?: number; | ||
} |
8 changes: 8 additions & 0 deletions
8
src/resources/MachineLearning/ModelDetailedInfo/details/ModelDetailsLanguages.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export interface ModelDetailsLanguages { | ||
queries?: number; | ||
words?: number; | ||
stopwords?: number; | ||
topfacets?: string[]; | ||
contextKeysToDocuments?: Map<string, number>; | ||
docPerFilters?: Map<string, number>; | ||
} |
7 changes: 7 additions & 0 deletions
7
src/resources/MachineLearning/ModelDetailedInfo/details/ModelDetailsStatsPerSource.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export interface ModelDetailsStatsPerSource { | ||
sourceName: string; | ||
documentCount: number; | ||
invalidHtmlDocumentCount: number; | ||
documentWithoutIdCount: number; | ||
documentWithDuplicatedIdCount: number; | ||
} |
5 changes: 5 additions & 0 deletions
5
src/resources/MachineLearning/ModelDetailedInfo/details/ModelDetailsSubModels.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface ModelDetailsSubModels { | ||
numOfItems?: number; | ||
candidates?: string[] | string[][]; | ||
numOfUsers?: number; | ||
} |
6 changes: 6 additions & 0 deletions
6
src/resources/MachineLearning/ModelDetailedInfo/details/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export * from './ModelDetails.js'; | ||
export * from './ModelDetailsBuildingStats.js'; | ||
export * from './ModelDetailsCommerceEvents.js'; | ||
export * from './ModelDetailsLanguages.js'; | ||
export * from './ModelDetailsStatsPerSource.js'; | ||
export * from './ModelDetailsSubModels.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './details/index.js'; | ||
export * from './ModelDetailedInfo.js'; | ||
export * from './ModelDetailedInfoInterfaces.js'; |
25 changes: 25 additions & 0 deletions
25
src/resources/MachineLearning/ModelDetailedInfo/tests/ModelDetailedInfo.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import API from '../../../../APICore.js'; | ||
import ModelDetailedInfo from '../ModelDetailedInfo.js'; | ||
|
||
jest.mock('../../../../APICore.js'); | ||
|
||
describe('ModelDetailedInfo', () => { | ||
let modelDetailedConfig: ModelDetailedInfo; | ||
const api = new API({accessToken: 'some-token'}); | ||
const serverlessApi = new API({accessToken: 'some-token'}); | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
modelDetailedConfig = new ModelDetailedInfo(api, serverlessApi); | ||
}); | ||
|
||
describe('get', () => { | ||
it('should make a GET call to the specific ModelDetailedInfo url', async () => { | ||
const modelId = '🦆'; | ||
await modelDetailedConfig.get(modelId); | ||
|
||
expect(api.get).toHaveBeenCalledTimes(1); | ||
expect(api.get).toHaveBeenCalledWith(`${ModelDetailedInfo.baseUrl}/${modelId}`); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
export * from './CaseClassificationConfiguration/index.js'; | ||
export * from './DNEConfiguration/index.js'; | ||
export * from './DocumentInterfaces.js'; | ||
export * from './FilterConditions.js'; | ||
export * from './IAPRConfiguration/index.js'; | ||
export * from './MachineLearning.js'; | ||
export * from './MachineLearningInterfaces.js'; | ||
export * from './FilterConditions.js'; | ||
export * from './DocumentInterfaces.js'; | ||
export * from './Models/index.js'; | ||
export * from './ModelDetailedInfo/index.js'; | ||
export * from './ModelInformation/index.js'; | ||
export * from './ModelListing/index.js'; | ||
export * from './DNEConfiguration/index.js'; | ||
export * from './CaseClassificationConfiguration/index.js'; | ||
export * from './SmartSnippetsConfiguration/index.js'; | ||
export * from './Models/index.js'; | ||
export * from './PQSConfiguration/index.js'; | ||
export * from './RGAConfiguration/index.js'; | ||
export * from './SemanticEncoderConfiguration/index.js'; | ||
export * from './IAPRConfiguration/index.js'; | ||
export * from './SmartSnippetsConfiguration/index.js'; | ||
export * from './UserActionHistoryConfiguration/index.js'; | ||
export * from './RGAConfiguration/index.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters