コード例 #1
0
        /// <summary>
        /// Kicks off model load job
        /// </summary>
        /// <param name="request">Request object to be sent to the load endpoint</param>
        /// <returns>Job ID string</returns>
        private async Task <string> StartModelLoad(string collectionName)
        {
            FinetuneRequest loadModelRequest = new FinetuneRequest(APIKey, collectionName)
            {
                StartJob = true
            };
            HttpResponseMessage response = null;

            try
            {
                response = await Client.PostAsync(Endpoints.LoadCollection, FinetuneRequest.StringContentFromObject(loadModelRequest));

                HTTPMagic.CheckStatus(response);
                string responseBody = await response.Content.ReadAsStringAsync();

                return(JsonConvert.DeserializeObject <JobStartResponse>(responseBody).Results);
            }
            catch (HttpRequestException hre)
            {
                throw new IndicoAPIException(Resources.Application_API_Request_Failure, hre);
            }
            finally
            {
                if (response != null)
                {
                    response.Dispose();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets info for a finetune collection
        /// </summary>
        /// <param name="collectionName">Name of the collection</param>
        /// <returns>Finetune Collection object describing the details and status of the collection.</returns>
        public async Task <FinetuneCollection> Info(string collectionName)
        {
            FinetuneRequest requestBody = new FinetuneRequest(APIKey, collectionName);

            HttpResponseMessage response = null;

            try
            {
                response = await Client.PostAsync(Endpoints.CollectionInfo, FinetuneRequest.StringContentFromObject(requestBody));

                HTTPMagic.CheckStatus(response);
                string responseBody = await response.Content.ReadAsStringAsync();

                return(JsonConvert.DeserializeObject <FinetuneCollectionResponse>(responseBody).Results);
            }
            catch (HttpRequestException hre)
            {
                throw new IndicoAPIException(Resources.Application_API_Request_Failure, hre);
            }
            finally
            {
                if (response != null)
                {
                    response.Dispose();
                }
            }
        }