protected async Task <PersonalizerClient> GetPersonalizerClientAsync(bool isSingleSlot = false, bool useLocalInference = false, float subsampleRate = 1.0f) { string endpoint = isSingleSlot ? TestEnvironment.SingleSlotEndpoint : TestEnvironment.MultiSlotEndpoint; string apiKey = isSingleSlot ? TestEnvironment.SingleSlotApiKey : TestEnvironment.MultiSlotApiKey; PersonalizerAdministrationClient adminClient = GetAdministrationClient(isSingleSlot); if (!isSingleSlot) { await EnableMultiSlot(adminClient); } var credential = new AzureKeyCredential(apiKey); var options = InstrumentClientOptions(new PersonalizerClientOptions(useLocalInference: useLocalInference, subsampleRate: subsampleRate)); PersonalizerClient personalizerClient = null; if (useLocalInference) { if (Mode == RecordedTestMode.Playback) { RlNetProcessor rlNetProcessor = SetupRlNetProcessor(); personalizerClient = new PersonalizerClientForTest(new Uri(endpoint), credential, true, rlNetProcessor, options: options, subsampleRate: subsampleRate); } else { personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, options: options); } } else { personalizerClient = new PersonalizerClient(new Uri(endpoint), credential, options); } personalizerClient = InstrumentClient(personalizerClient); return(personalizerClient); }
public PersonalizerClientForTest(Uri endpoint, AzureKeyCredential credential, bool useLocalInference, RlNetProcessor rlNetProcessor, float subsampleRate = 1.0f, PersonalizerClientOptions options = null) : base(endpoint, credential, options) { this.rlNetProcessor = rlNetProcessor; }