class MAGES::Experimental::EmbodimentJARIA::EmbodiedAIRequest

Overview

Handles requests of the embodiment AI module. More…

class EmbodiedAIRequest
{
public:
    // structs

    struct ResourceUsageSummary;

    // classes

    class AIUsageCreditLimitsResponse;

    // methods

    static async Task<ResourceUsageSummary> GetResourceUsageSummary(IAuthenticationAPI authAPI);

    static async Task HandleStreamingResponseAsync(
        HttpResponseMessage response,
        AgentConfiguration agentConfig,
        Agent.FilterMessageDelegate filterMessageDelegate = null
    );

    static List GetIgnoreCharacters();
    static void SetIgnoreCharacters(List value);

    static async Task GetAgentFromID(
        string agentID,
        IAuthenticationAPI authAPI
    );

    static async Task GetAssociatedAgents(
        string agentID,
        IAuthenticationAPI authAPI
    );

    static async Task ChargeTokensAsync(
        ChargeType type,
        int amount,
        IAuthenticationAPI authAPI = null
    );

    static async Task ClearAgentHistoty(IAuthenticationAPI authAPI);
};

Detailed Documentation

Handles requests of the embodiment AI module.

Methods

static async Task<ResourceUsageSummary> GetResourceUsageSummary(IAuthenticationAPI authAPI)

Gets the resource usage summary for the tenant baked into this build.

Parameters:

authAPI

Authentication manager reference. May be unauthenticated; the tenant is read from the baked config.

Returns:

The resource usage summary.

static async Task HandleStreamingResponseAsync(
    HttpResponseMessage response,
    AgentConfiguration agentConfig,
    Agent.FilterMessageDelegate filterMessageDelegate = null
)

Handles the streaming response from JARIA.

Parameters:

response

The response.

agentConfig

The agent configuration.

filterMessageDelegate

The filter message delegate function.

Returns:

Task.

static List GetIgnoreCharacters()

Gets the characters which the agent will ignore.

Returns:

A list containing the characters that will be ignored.

static void SetIgnoreCharacters(List value)

Sets the characters which the agent will ignore.

Parameters:

value

The list containing the characters which will be ignored.

static async Task GetAgentFromID(
    string agentID,
    IAuthenticationAPI authAPI
)

Gets the agent info from ID.

Parameters:

agentID

The agent’s ID.

authAPI

Authentication manager reference.

Returns:

Returns the agent info.

static async Task GetAssociatedAgents(
    string agentID,
    IAuthenticationAPI authAPI
)

Gets the sub-agent info from ID.

Parameters:

agentID

The agent’s ID.

authAPI

Authentication manager reference.

Returns:

Returns the agent info.

static async Task ChargeTokensAsync(
    ChargeType type,
    int amount,
    IAuthenticationAPI authAPI = null
)

Reports usage of one of the three billable channels (STT / LLM / TTS) to the cloud so the user’s AI-usage credit bucket is debited. The user id is resolved from the principal of the bearer attached by IAuthenticationAPI.SendRequestAsync(HttpRequestMessage) — the developer’s baked JWT by default, or the end-user’s session when the player is in user-login mode. Fire-and-forget: errors (including transient network failures) are logged and swallowed, because billing must never block STT/TTS playback in VR.

Parameters:

type

Which usage channel the amount applies to.

amount

Raw count in the unit implied by type (words for STT, tokens for LLM, characters for TTS). No-op when <= 0.

authAPI

Authentication manager reference.

Returns:

A task that completes once the charge attempt finishes (success or swallowed failure).

static async Task ClearAgentHistoty(IAuthenticationAPI authAPI)

Clears the agent’s history.

Parameters:

authAPI

Authentication manager reference.

Returns:

Task.