コード例 #1
0
        /// <summary> Initializes a new instance of PersonalizerClient. </summary>
        /// <param name="endpoint"> Supported Cognitive Services endpoint. </param>
        /// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
        /// <param name="options"> The options for configuring the client. </param>
        public PersonalizerClient(Uri endpoint, TokenCredential credential, PersonalizerClientOptions options = null)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }
            if (credential == null)
            {
                throw new ArgumentNullException(nameof(credential));
            }

            options ??= new PersonalizerClientOptions();
            clientDiagnostics              = new ClientDiagnostics(options);
            pipeline                       = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes));
            stringEndpoint                 = endpoint.AbsoluteUri;
            RankRestClient                 = new RankRestClient(clientDiagnostics, pipeline, stringEndpoint);
            EventsRestClient               = new EventsRestClient(clientDiagnostics, pipeline, stringEndpoint);
            MultiSlotRestClient            = new MultiSlotRestClient(clientDiagnostics, pipeline, stringEndpoint);
            MultiSlotEventsRestClient      = new MultiSlotEventsRestClient(clientDiagnostics, pipeline, stringEndpoint);
            ServiceConfigurationRestClient = new ServiceConfigurationRestClient(clientDiagnostics, pipeline, stringEndpoint);
            PolicyRestClient               = new PolicyRestClient(clientDiagnostics, pipeline, stringEndpoint);
            tokenCredential                = credential;

            this.useLocalInference = options.UseLocalInference;
            if (useLocalInference)
            {
                validateAndAssignSampleRate(options.SubsampleRate);
                //lazy load Rankprocessor
                rlNetProcessor = new Lazy <RlNetProcessor>(() => GetConfigurationForRankProcessor());
            }
        }
コード例 #2
0
        public MultiSlotClient(string endpoint, AzureKeyCredential credential, PersonalizerClientOptions options = null)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }
            if (credential == null)
            {
                throw new ArgumentNullException(nameof(credential));
            }

            options ??= new PersonalizerClientOptions();
            _clientDiagnostics = new ClientDiagnostics(options);
            _pipeline          = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "Ocp-Apim-Subscription-Key"));
            RestClient         = new MultiSlotRestClient(_clientDiagnostics, _pipeline, endpoint);
        }
コード例 #3
0
        public MultiSlotClient(string endpoint, TokenCredential credential, PersonalizerClientOptions options = null)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }
            if (credential == null)
            {
                throw new ArgumentNullException(nameof(credential));
            }

            options ??= new PersonalizerClientOptions();
            _clientDiagnostics = new ClientDiagnostics(options);
            string[] scopes = { "https://cognitiveservices.azure.com/.default" };
            _pipeline  = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes));
            RestClient = new MultiSlotRestClient(_clientDiagnostics, _pipeline, endpoint);
        }
コード例 #4
0
        /// <summary> Initializes a new instance of PersonalizerClient. </summary>
        /// <param name="endpoint"> Supported Cognitive Services endpoint. </param>
        /// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
        /// <param name="options"> The options for configuring the client. </param>
        public PersonalizerAdministrationClient(Uri endpoint, AzureKeyCredential credential, PersonalizerClientOptions options = null)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }
            if (credential == null)
            {
                throw new ArgumentNullException(nameof(credential));
            }

            options ??= new PersonalizerClientOptions();
            _clientDiagnostics = new ClientDiagnostics(options);
            _pipeline          = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "Ocp-Apim-Subscription-Key"));
            string stringEndpoint = endpoint.AbsoluteUri;

            LogRestClient = new LogRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            ServiceConfigurationRestClient = new ServiceConfigurationRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            ModelRestClient       = new ModelRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            EvaluationsRestClient = new EvaluationsRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            PolicyRestClient      = new PolicyRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
        }
コード例 #5
0
        /// <summary> Initializes a new instance of PersonalizerClient. </summary>
        /// <param name="endpoint"> Supported Cognitive Services endpoint. </param>
        /// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
        /// <param name="options"> The options for configuring the client. </param>
        public PersonalizerAdministrationClient(Uri endpoint, TokenCredential credential, PersonalizerClientOptions options = null)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }
            if (credential == null)
            {
                throw new ArgumentNullException(nameof(credential));
            }

            options ??= new PersonalizerClientOptions();
            _clientDiagnostics = new ClientDiagnostics(options);
            string[] scopes = { "https://cognitiveservices.azure.com/.default" };
            _pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes));
            string stringEndpoint = endpoint.AbsoluteUri;

            LogRestClient = new LogRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            ServiceConfigurationRestClient = new ServiceConfigurationRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            ModelRestClient       = new ModelRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            EvaluationsRestClient = new EvaluationsRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            PolicyRestClient      = new PolicyRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
        }