diff --git a/src/resources/MachineLearning/DocumentInterfaces.ts b/src/resources/MachineLearning/DocumentInterfaces.ts new file mode 100644 index 000000000..088cb683c --- /dev/null +++ b/src/resources/MachineLearning/DocumentInterfaces.ts @@ -0,0 +1 @@ +export type DocumentRequirementStatus = 'OK' | 'INSUFFICIENT_DOCUMENTS' | 'NB_OF_DOCUMENTS_OVER_LIMIT'; diff --git a/src/resources/MachineLearning/MachineLearning.ts b/src/resources/MachineLearning/MachineLearning.ts index 02b8762cc..9960d1886 100644 --- a/src/resources/MachineLearning/MachineLearning.ts +++ b/src/resources/MachineLearning/MachineLearning.ts @@ -9,6 +9,7 @@ import PQSConfiguration from './PQSConfiguration/PQSConfiguration.js'; import UserActionHistoryConfiguration from './UserActionHistoryConfiguration/UserActionHistoryConfiguration.js'; import IAPRConfiguration from './IAPRConfiguration/IAPRConfiguration.js'; import ModelListing from './ModelListing/ModelListing.js'; +import SemanticSearchConfiguration from './SemanticSearchConfiguration/SemanticSearchConfiguration.js'; export default class MachineLearning extends Resource { static baseUrl = `/rest/organizations/${API.orgPlaceholder}/machinelearning`; @@ -21,8 +22,12 @@ export default class MachineLearning extends Resource { pqsConfig: PQSConfiguration; iaprConfig: IAPRConfiguration; modelListing: ModelListing; + semanticSearchConfig: SemanticSearchConfiguration; - constructor(protected api: API, protected serverlessApi: API) { + constructor( + protected api: API, + protected serverlessApi: API, + ) { super(api, serverlessApi); this.models = new Models(api, serverlessApi); @@ -33,6 +38,7 @@ export default class MachineLearning extends Resource { this.iaprConfig = new IAPRConfiguration(api, serverlessApi); this.userActionHistoryConfig = new UserActionHistoryConfiguration(api, serverlessApi); this.modelListing = new ModelListing(api, serverlessApi); + this.semanticSearchConfig = new SemanticSearchConfiguration(api, serverlessApi); } register(registration: RegistrationModel) { diff --git a/src/resources/MachineLearning/SemanticSearchConfiguration/SemanticSearchConfiguration.ts b/src/resources/MachineLearning/SemanticSearchConfiguration/SemanticSearchConfiguration.ts new file mode 100644 index 000000000..7779a354d --- /dev/null +++ b/src/resources/MachineLearning/SemanticSearchConfiguration/SemanticSearchConfiguration.ts @@ -0,0 +1,15 @@ +import API from '../../../APICore.js'; +import Resource from '../../Resource.js'; +import { + SemanticSearchDocumentGroupPreview, + SemanticSearchDocumentGroupPreviewParams, +} from './SemanticSearchConfigurationInterfaces.js'; + +export default class SemanticSearchConfiguration extends Resource { + static baseUrl = `/rest/organizations/${API.orgPlaceholder}/machinelearning/configuration/ses`; + static previewUrl = `${SemanticSearchConfiguration.baseUrl}/preview`; + + preview(params: SemanticSearchDocumentGroupPreviewParams) { + return this.api.post(SemanticSearchConfiguration.previewUrl, params); + } +} diff --git a/src/resources/MachineLearning/SemanticSearchConfiguration/SemanticSearchConfigurationInterfaces.ts b/src/resources/MachineLearning/SemanticSearchConfiguration/SemanticSearchConfigurationInterfaces.ts new file mode 100644 index 000000000..9dea2b43d --- /dev/null +++ b/src/resources/MachineLearning/SemanticSearchConfiguration/SemanticSearchConfigurationInterfaces.ts @@ -0,0 +1,52 @@ +import {DocumentRequirementStatus} from '../DocumentInterfaces.js'; +import {FilterConditions} from '../FilterConditions.js'; + +export interface SemanticSearchDocumentGroupPreviewParams { + /** + * The names of the sources containing the items that the model should use to extract chunks. + */ + sources?: string[]; + /** + * The custom filter conditions to target specific documents. + */ + filterConditions?: FilterConditions[]; + /** + * The query that determines the documents to extract. Cannot be used with other document extraction parameters, e.g. sources, filter conditions, etc. + * + * @Example @source==("My source") AND @permanentid AND @language="English"; + */ + advancedQuery?: string; +} + +export interface SemanticSearchDocumentGroupPreview { + /** + * The query that was used to fetch document information. + * + * @Example @source==("Salesforce Notifier") + */ + query: string; + /** + * The total number of documents in the selected sources. + */ + numberOfDocumentsInSources: number; + /** + * The number of documents that are candidates for learning. + */ + numberOfValidDocuments: number; + /** + * The number of documents in the selected sources that match the conditions. + */ + numberOfDocumentsInSourcesMatchingFilters: number; + /** + * The number of documents in the selected sources that match the conditions and have a `permanentid`. + */ + numberOfDocumentsInSourcesMatchingFiltersWithPermanentId: number; + /** + * The maximum number of documents allowed to learn from. + */ + documentLimit: number; + /** + * Status for the number of required documents to build the model. + */ + documentRequirementStatus: DocumentRequirementStatus; +} diff --git a/src/resources/MachineLearning/SemanticSearchConfiguration/index.ts b/src/resources/MachineLearning/SemanticSearchConfiguration/index.ts new file mode 100644 index 000000000..f03902184 --- /dev/null +++ b/src/resources/MachineLearning/SemanticSearchConfiguration/index.ts @@ -0,0 +1,2 @@ +export * from './SemanticSearchConfiguration.js'; +export * from './SemanticSearchConfigurationInterfaces.js'; diff --git a/src/resources/MachineLearning/SmartSnippetsConfiguration/SmartSnippetsConfigurationInterfaces.ts b/src/resources/MachineLearning/SmartSnippetsConfiguration/SmartSnippetsConfigurationInterfaces.ts index 496491f8f..7912805f1 100644 --- a/src/resources/MachineLearning/SmartSnippetsConfiguration/SmartSnippetsConfigurationInterfaces.ts +++ b/src/resources/MachineLearning/SmartSnippetsConfiguration/SmartSnippetsConfigurationInterfaces.ts @@ -1,3 +1,4 @@ +import {DocumentRequirementStatus} from '../DocumentInterfaces.js'; import {FilterConditions} from '../FilterConditions.js'; export interface DocumentType { @@ -39,8 +40,6 @@ export interface SmartSnippetsConfigurationModel { documentTypes?: DocumentType[]; } -export type SmartSnippetsDocumentRequirementStatus = 'OK' | 'INSUFFICIENT_DOCUMENTS' | 'NB_OF_DOCUMENTS_OVER_LIMIT'; - export interface SmartSnippetsDocumentGroupPreviewParams { /** * The sources to consider. @@ -94,7 +93,7 @@ export interface SmartSnippetsDocumentGroupPreview { /** * Status for the number of required documents to build the model. */ - documentRequirementStatus: SmartSnippetsDocumentRequirementStatus; + documentRequirementStatus: DocumentRequirementStatus; } export interface SmartSnippetsContentFieldsParams { diff --git a/src/resources/MachineLearning/index.ts b/src/resources/MachineLearning/index.ts index 3ecc061a4..c8cfb4b90 100644 --- a/src/resources/MachineLearning/index.ts +++ b/src/resources/MachineLearning/index.ts @@ -1,6 +1,7 @@ export * from './MachineLearning.js'; export * from './MachineLearningInterfaces.js'; export * from './FilterConditions.js'; +export * from './DocumentInterfaces.js'; export * from './Models/index.js'; export * from './ModelInformation/index.js'; export * from './ModelListing/index.js'; @@ -8,5 +9,6 @@ export * from './DNEConfiguration/index.js'; export * from './CaseClassificationConfiguration/index.js'; export * from './SmartSnippetsConfiguration/index.js'; export * from './PQSConfiguration/index.js'; +export * from './SemanticSearchConfiguration/index.js'; export * from './IAPRConfiguration/index.js'; export * from './UserActionHistoryConfiguration/index.js';