using Microsoft.TypeSpec.Generator.Customizations; using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Diagnostics.CodeAnalysis; using System.Threading; namespace OpenAI.Evals; // CUSTOM: // - Renamed. // - Suppressed constructor that takes endpoint parameter; endpoint is now a property in the options class. // - Suppressed convenience methods for now. /// The service client for OpenAI Evaluation operations. [CodeGenType("Evals")] [CodeGenSuppress("CreateEval", typeof(InternalCreateEvalRequest), typeof(CancellationToken))] [CodeGenSuppress("CreateEvalAsync", typeof(InternalCreateEvalRequest), typeof(CancellationToken))] [CodeGenSuppress("GetEval", typeof(string), typeof(CancellationToken))] [CodeGenSuppress("GetEvalAsync", typeof(string), typeof(CancellationToken))] [CodeGenSuppress("UpdateEval", typeof(string), typeof(InternalUpdateEvalRequest), typeof(CancellationToken))] [CodeGenSuppress("UpdateEvalAsync", typeof(string), typeof(InternalUpdateEvalRequest), typeof(CancellationToken))] [CodeGenSuppress("DeleteEval", typeof(string), typeof(CancellationToken))] [CodeGenSuppress("DeleteEvalAsync", typeof(string), typeof(CancellationToken))] [CodeGenSuppress("CreateEvalRun", typeof(string), typeof(InternalCreateEvalRunRequest), typeof(CancellationToken))] [CodeGenSuppress("CreateEvalRunAsync", typeof(string), typeof(InternalCreateEvalRunRequest), typeof(CancellationToken))] [CodeGenSuppress("GetEvalRun", typeof(string), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("GetEvalRunAsync", typeof(string), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("CancelEvalRun", typeof(string), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("CancelEvalRunAsync", typeof(string), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("DeleteEvalRun", typeof(string), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("DeleteEvalRunAsync", typeof(string), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("GetEvalRunOutputItem", typeof(string), typeof(string), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("GetEvalRunOutputItemAsync", typeof(string), typeof(string), typeof(string), typeof(CancellationToken))] public partial class EvaluationClient { // CUSTOM: Added as a convenience. /// Initializes a new instance of . /// The API key to authenticate with the service. /// is null. public EvaluationClient(string apiKey) : this(new ApiKeyCredential(apiKey), new OpenAIClientOptions()) { } // CUSTOM: // - Used a custom pipeline. // - Demoted the endpoint parameter to be a property in the options class. /// Initializes a new instance of . /// The to authenticate with the service. /// is null. public EvaluationClient(ApiKeyCredential credential) : this(credential, new OpenAIClientOptions()) { } /// /// Initializes a new instance of that will use an API key when authenticating. /// /// The to authenticate with the service. /// Additional options to customize the client. /// The provided was null. public EvaluationClient(ApiKeyCredential credential, OpenAIClientOptions options) : this(OpenAIClient.CreateApiKeyAuthenticationPolicy(credential), options) { } // CUSTOM: Added as a convenience. /// Initializes a new instance of . /// The authentication policy used to authenticate with the service. /// is null. public EvaluationClient(AuthenticationPolicy authenticationPolicy) : this(authenticationPolicy, new OpenAIClientOptions()) { } // CUSTOM: Added as a convenience. /// Initializes a new instance of . /// The authentication policy used to authenticate with the service. /// The options to configure the client. /// is null. public EvaluationClient(AuthenticationPolicy authenticationPolicy, OpenAIClientOptions options) { Argument.AssertNotNull(authenticationPolicy, nameof(authenticationPolicy)); options ??= new OpenAIClientOptions(); Pipeline = OpenAIClient.CreatePipeline(authenticationPolicy, options); _endpoint = OpenAIClient.GetEndpoint(options); } // CUSTOM: // - Used a custom pipeline. // - Demoted the endpoint parameter to be a property in the options class. // - Made protected. /// Initializes a new instance of . /// The HTTP pipeline to send and receive REST requests and responses. /// The options to configure the client. /// is null. protected internal EvaluationClient(ClientPipeline pipeline, OpenAIClientOptions options) { Argument.AssertNotNull(pipeline, nameof(pipeline)); options ??= new OpenAIClientOptions(); Pipeline = pipeline; _endpoint = OpenAIClient.GetEndpoint(options); } [Experimental("SCME0002")] public EvaluationClient(EvaluationClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Options) { } /// /// Gets the endpoint URI for the service. /// [Experimental("OPENAI001")] public Uri Endpoint => _endpoint; }