internal async ValueTask <ResponseWithHeaders <AnalyzeWithCustomModelHeaders> > AnalyzeWithCustomModelAsync(Guid modelId, bool?includeTextDetails, Stream stream, FormContentType contentType, CancellationToken cancellationToken = default)
        {
            using var scope = clientDiagnostics.CreateScope("AllOperations.AnalyzeWithCustomModel");
            scope.Start();
            try
            {
                using var message = RestClient.CreateAnalyzeWithCustomModelRequest(modelId, includeTextDetails, stream, contentType);
                await pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

                switch (message.Response.Status)
                {
                case 202:
                    var headers = new AnalyzeWithCustomModelHeaders(message.Response);
                    return(ResponseWithHeaders.FromValue(headers, message.Response));

                default:
                    throw await clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
                }
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
        internal ResponseWithHeaders <AnalyzeWithCustomModelHeaders> AnalyzeWithCustomModel(Guid modelId, bool?includeTextDetails, Stream stream, FormContentType contentType, CancellationToken cancellationToken = default)
        {
            using var scope = clientDiagnostics.CreateScope("AllOperations.AnalyzeWithCustomModel");
            scope.Start();
            try
            {
                // TODO: Could refactor this so different AnalyzeWithCustomModels overload call the same implementation with different request messages.
                using var message = RestClient.CreateAnalyzeWithCustomModelRequest(modelId, includeTextDetails, stream, contentType);
                pipeline.Send(message, cancellationToken);
                switch (message.Response.Status)
                {
                case 202:
                    var headers = new AnalyzeWithCustomModelHeaders(message.Response);
                    return(ResponseWithHeaders.FromValue(headers, message.Response));

                default:
                    throw clientDiagnostics.CreateRequestFailedException(message.Response);
                }
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }