Search Results for

    Show / Hide Table of Contents

    Class UnifiedApiRequestBase<TSelf, TResult, TProviderOptions>

    Base class for all Fluent API requests. Provides common properties and methods for configuring and executing requests.

    Inheritance
    object
    UnifiedApiRequestBase<TSelf, TResult, TProviderOptions>
    AwsDeleteRequestBase<TRequest>
    LexiconRequest<TRequest, TResponse>
    TranscribeListRequestBase<TRequest, TResponse>
    VocabularyFilterRequest<TRequest>
    VocabularyRequest<TRequest>
    FileRequest<TSelf, TResult>
    FineTuningRequest
    GenerativeRequest<TSelf, TPrompt, TResult, TOptions>
    GetCreditsRequest
    ModelRequest<TSelf, TResult>
    VoiceRequest<TSelf, TResult>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Glitch9.AIDevKit
    Assembly: Glitch9.AIDevKit.dll
    Syntax
    public abstract class UnifiedApiRequestBase<TSelf, TResult, TProviderOptions> where TSelf : UnifiedApiRequestBase<TSelf, TResult, TProviderOptions> where TProviderOptions : IProviderRequestOptions
    Type Parameters
    Name Description
    TSelf
    TResult
    TProviderOptions

    Constructors

    | Edit this page View Source

    UnifiedApiRequestBase()

    Declaration
    protected UnifiedApiRequestBase()

    Fields

    | Edit this page View Source

    m_Api

    Declaration
    protected Api m_Api
    Field Value
    Type Description
    Api

    Properties

    | Edit this page View Source

    Api

    The cloud service provider associated with this task. Automatically resolved from the selected model if not explicitly set.

    Declaration
    public virtual Api Api { get; }
    Property Value
    Type Description
    Api
    | Edit this page View Source

    ContentType

    MIME type for the request content.

    Declaration
    public virtual MimeType ContentType { get; set; }
    Property Value
    Type Description
    MimeType
    | Edit this page View Source

    DownloadOptions

    Download options for this

    Declaration
    public DownloadOptions DownloadOptions { get; set; }
    Property Value
    Type Description
    DownloadOptions
    | Edit this page View Source

    HttpOptions

    HTTP options for this

    Declaration
    public RequestOptions HttpOptions { get; set; }
    Property Value
    Type Description
    RequestOptions
    | Edit this page View Source

    IsCanceled

    Indicates if the request has been canceled.

    Declaration
    public bool IsCanceled { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    LogOptions

    The log level for this

    Declaration
    public CurlLogOptions LogOptions { get; set; }
    Property Value
    Type Description
    CurlLogOptions
    | Edit this page View Source

    Metadata

    Optional metadata for the request (OpenAI-specific).

    Declaration
    public ServerDictionary Metadata { get; set; }
    Property Value
    Type Description
    ServerDictionary
    | Edit this page View Source

    Options

    Declaration
    [Obsolete("Use ProviderOptions instead.")]
    public TProviderOptions Options { get; }
    Property Value
    Type Description
    TProviderOptions
    | Edit this page View Source

    ProviderOptions

    Provider(Vendor)-specific options for this request.

    Declaration
    public TProviderOptions ProviderOptions { get; set; }
    Property Value
    Type Description
    TProviderOptions
    | Edit this page View Source

    RequestType

    The endpoint type for this

    Declaration
    public abstract RequestType RequestType { get; }
    Property Value
    Type Description
    RequestType
    | Edit this page View Source

    ResponseType

    MIME type for the response. Defaults to JSON.

    Declaration
    public virtual MimeType ResponseType { get; set; }
    Property Value
    Type Description
    MimeType
    | Edit this page View Source

    SafetyIdentifier

    Safety identifier for moderation and safety checks.

    Declaration
    public SafetyIdentifier SafetyIdentifier { get; set; }
    Property Value
    Type Description
    SafetyIdentifier
    | Edit this page View Source

    Sender

    The sender ID for tracking or attribution purposes.

    Declaration
    public string Sender { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    ServiceTier

    Service tier for the request (e.g., free, paid, premium).

    Declaration
    public ServiceTier? ServiceTier { get; set; }
    Property Value
    Type Description
    ServiceTier?
    | Edit this page View Source

    Stream

    If true, the model response data will be streamed to the client as it is generated.

    Declaration
    public bool Stream { get; set; }
    Property Value
    Type Description
    bool

    Methods

    | Edit this page View Source

    Cancel()

    Cancels the current task.

    Declaration
    public void Cancel()
    | Edit this page View Source

    ExecuteAsync(CancellationToken)

    Executes the task and returns the output of type TResult. This is the main entry point for executing the task.

    Declaration
    public virtual UniTask<TResult> ExecuteAsync(CancellationToken ct = default)
    Parameters
    Type Name Description
    CancellationToken ct
    Returns
    Type Description
    UniTask<TResult>
    | Edit this page View Source

    ExecuteAsyncInternal()

    Executes the actual task logic. Must be implemented in derived classes.

    Declaration
    protected abstract UniTask<TResult> ExecuteAsyncInternal()
    Returns
    Type Description
    UniTask<TResult>
    | Edit this page View Source

    GenerateDefaultFileName()

    Generates a default file name for downloaded content. Override in derived classes to provide type-specific file naming.

    Declaration
    protected virtual string GenerateDefaultFileName()
    Returns
    Type Description
    string
    | Edit this page View Source

    GetConfig<T>()

    Gets the specific options for this

    Declaration
    public T GetConfig<T>() where T : TProviderOptions
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    ResolveDownloadOptions(DownloadOptions)

    Resolves download options for this

    Declaration
    protected virtual DownloadOptions ResolveDownloadOptions(DownloadOptions options = null)
    Parameters
    Type Name Description
    DownloadOptions options
    Returns
    Type Description
    DownloadOptions
    | Edit this page View Source

    SetApi(Api)

    Sets API explicitly for requests that cannot infer it from model/context.

    Declaration
    protected void SetApi(Api api)
    Parameters
    Type Name Description
    Api api
    | Edit this page View Source

    SetDownloadOptions(DownloadOptions)

    Sets the download options for this

    Declaration
    public TSelf SetDownloadOptions(DownloadOptions downloadOptions)
    Parameters
    Type Name Description
    DownloadOptions downloadOptions
    Returns
    Type Description
    TSelf
    | Edit this page View Source

    SetLogOptions(CurlLogOptions)

    Sets the log options for this

    Declaration
    public TSelf SetLogOptions(CurlLogOptions logOptions)
    Parameters
    Type Name Description
    CurlLogOptions logOptions
    Returns
    Type Description
    TSelf
    | Edit this page View Source

    SetMetadata(ServerDictionary)

    Sets metadata for the request (OpenAI-specific).

    Declaration
    public TSelf SetMetadata(ServerDictionary metadata)
    Parameters
    Type Name Description
    ServerDictionary metadata
    Returns
    Type Description
    TSelf
    | Edit this page View Source

    SetOutputDirectory(string)

    Sets the output directory for this request. The file name will be auto-generated.

    Declaration
    public TSelf SetOutputDirectory(string directoryPath)
    Parameters
    Type Name Description
    string directoryPath
    Returns
    Type Description
    TSelf
    | Edit this page View Source

    SetOutputPath(string)

    Sets the output path for this

    Declaration
    public TSelf SetOutputPath(string fullPath)
    Parameters
    Type Name Description
    string fullPath
    Returns
    Type Description
    TSelf
    | Edit this page View Source

    SetOutputPath(string, string)

    Declaration
    public TSelf SetOutputPath(string directoryPath, string fileName)
    Parameters
    Type Name Description
    string directoryPath
    string fileName
    Returns
    Type Description
    TSelf
    | Edit this page View Source

    SetProviderOptions(TProviderOptions)

    Sets specific options for the

    Declaration
    public TSelf SetProviderOptions(TProviderOptions options)
    Parameters
    Type Name Description
    TProviderOptions options
    Returns
    Type Description
    TSelf
    | Edit this page View Source

    SetRequestMimeType(MimeType)

    Sets the MIME type for the request content.

    Declaration
    public TSelf SetRequestMimeType(MimeType mimeType)
    Parameters
    Type Name Description
    MimeType mimeType
    Returns
    Type Description
    TSelf
    | Edit this page View Source

    SetResponseMimeType(MimeType)

    Sets a custom MIME type for the output.

    Declaration
    public TSelf SetResponseMimeType(MimeType mimeType)
    Parameters
    Type Name Description
    MimeType mimeType
    Returns
    Type Description
    TSelf
    | Edit this page View Source

    SetSafetyIdentifier(string)

    Sets the safety identifier for moderation and safety checks.

    Declaration
    public TSelf SetSafetyIdentifier(string id)
    Parameters
    Type Name Description
    string id
    Returns
    Type Description
    TSelf
    | Edit this page View Source

    SetSender(string)

    Sets the sender ID for tracking or attribution purposes.

    Declaration
    public TSelf SetSender(string sender)
    Parameters
    Type Name Description
    string sender
    Returns
    Type Description
    TSelf
    | Edit this page View Source

    SetSpecificOptions(TProviderOptions)

    Declaration
    [Obsolete("Use SetProviderOptions(TProviderOptions) instead.")]
    public TSelf SetSpecificOptions(TProviderOptions options)
    Parameters
    Type Name Description
    TProviderOptions options
    Returns
    Type Description
    TSelf
    | Edit this page View Source

    SetStream(bool)

    Enables or disables streaming for this

    Declaration
    public TSelf SetStream(bool stream)
    Parameters
    Type Name Description
    bool stream
    Returns
    Type Description
    TSelf
    | Edit this page View Source

    ValidateRequest()

    Validates the request before execution. Override in derived classes to implement request validation logic.

    Declaration
    protected virtual void ValidateRequest()

    Extension Methods

    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation