Apex を使用した AI アクセラレーター予測 API
Apex クラスからの AI アクセラレーター予測 API に対する呼び出し/アクセスの詳細は次のとおりです。
- 開発者コンソールで、[File (ファイル)] | [New Apex Class (新規 Apex クラス)] を選択します。
- Apex クラス内で AI アクセラレーター Connect API 要求を実装します。次の例は、Apex クラスからの Connect API 要求の実装を示しています。
1ConnectApi.PredictionRequest predictionInputRepresentation = new ConnectApi.PredictionRequest(); 2predictionInputRepresentation.async = false; 3predictionInputRepresentation.enableScorePersistence = false; 4predictionInputRepresentation.enableInsightPersistence = false; 5predictionInputRepresentation.enableFeaturePersistence = false; 6predictionInputRepresentation.enableSuggestionPersistence = false; 7predictionInputRepresentation.usecaseDefinition = '0sIx00000000006EAA'; 8predictionInputRepresentation.predictionDefinition = '0sIx00000000006EAB'; 9predictionInputRepresentation.inputType = 'ExtractedRawData'; 10predictionInputRepresentation.featureExtractorId = '0sIx00000000006EAC'; 11Map < String, Integer > insightsSettings = new Map < String, Integer > (); 12insightsSettings.put('maxInsights', 0); 13insightsSettings.put('suggestionImpactMinimumPct', 0); 14predictionInputRepresentation.insightsSettings = insightsSettings; 15List < String > recordIds = new List < String > (); 16recordIds.add('subscriptionId'); 17predictionInputRepresentation.records = recordIds; 18 19//Create a Map with feature extraction parameters 20//Replace 'key1', 'recordId' with the required params in your feature extractor 21Map < String, Object > map1 = new Map < String, Object > (); 22map1.put('recordId', '0sIx000000000068EAC'); 23map1.put('key1', 'value1'); 24Object objForList = map1; 25ConnectApi.FeatureExtractionParametersFieldMapValue features = new ConnectApi.FeatureExtractionParametersFieldMapValue(); 26features.featureExtractionParametersMapValue = objForList; 27List < ConnectApi.FeatureExtractionParametersFieldMapValue > featuresList = new List < ConnectApi.FeatureExtractionParametersFieldMapValue > (); 28featuresList.add(features); 29predictionInputRepresentation.featureExtractionParameters = featuresList; 30//Act 31ConnectApi.PredictionResponse predictionOutputRepresentation = ConnectApi.AIAcceleratorConnectFamily.predictions(predictionInputRepresentation);