Skip to main content

API Reference

Essential API documentation for ElysGenAI classes and types.

Core Module

UERP_GenAISettings

Project settings for ElysGenAI Framework.

Path: Project Settings → Elys GenAI Framework

UCLASS(Config=Game)
class UERP_GenAISettings : public UDeveloperSettings
{
// Audio
UPROPERTY(Config, EditAnywhere, Category="Audio")
int32 DefaultSampleRate = 16000;

// STT
UPROPERTY(Config, EditAnywhere, Category="STT")
FString STTModelPath;

UPROPERTY(Config, EditAnywhere, Category="STT")
int32 STTNumThreads = 4;

// LLM
UPROPERTY(Config, EditAnywhere, Category="LLM")
FString LLMModelPath;

UPROPERTY(Config, EditAnywhere, Category="LLM")
int32 LLMContextLength = 4096;
};

IERP_GenAIService

Base interface for all GenAI services.

class IERP_GenAIService
{
public:
virtual bool Initialize() = 0;
virtual void Shutdown() = 0;
virtual bool IsReady() const = 0;
virtual EElysGenAIServiceState GetProcessingState() const = 0;
virtual EElysGenAIErrorCode GetLastError() const = 0;
virtual FString GetLastErrorMessage() const = 0;
};

FERP_AudioBuffer

Audio data container.

USTRUCT(BlueprintType)
struct FERP_AudioBuffer
{
GENERATED_BODY()

UPROPERTY(BlueprintReadOnly)
TArray<float> AudioData; // Normalized [-1.0, 1.0]

UPROPERTY(BlueprintReadOnly)
int32 SampleRate;

UPROPERTY(BlueprintReadOnly)
int32 NumChannels;

UPROPERTY(BlueprintReadOnly)
FDateTime Timestamp;
};

Audio Module

UERP_AudioCaptureSubsystem

Game instance subsystem for audio capture.

UCLASS()
class UERP_AudioCaptureSubsystem : public UGameInstanceSubsystem
{
GENERATED_BODY()

public:
// Capture control
UFUNCTION(BlueprintCallable)
void StartCapture();

UFUNCTION(BlueprintCallable)
void StopCapture();

UFUNCTION(BlueprintPure)
bool IsCapturing() const;

// Consumer management
UFUNCTION(BlueprintCallable)
void RegisterConsumer(TScriptInterface<IERP_AudioConsumer> Consumer);

UFUNCTION(BlueprintCallable)
void UnregisterConsumer(TScriptInterface<IERP_AudioConsumer> Consumer);

// Push-to-talk
UFUNCTION(BlueprintCallable)
void SetPushToTalkMode(EElysPushToTalkMode Mode);

UFUNCTION(BlueprintCallable)
void SetPushToTalkActive(bool bActive);

// Mute control
UFUNCTION(BlueprintCallable)
void SetMuted(bool bMuted);

UFUNCTION(BlueprintPure)
bool IsMuted() const;
};

STT Module

UERP_STTComponent

Actor component for speech-to-text.

UCLASS(BlueprintType, Blueprintable)
class UERP_STTComponent : public UActorComponent
{
GENERATED_BODY()

public:
// Control
UFUNCTION(BlueprintCallable, Category="ElysGenAI|STT")
void StartListening();

UFUNCTION(BlueprintCallable, Category="ElysGenAI|STT")
void StopListening();

UFUNCTION(BlueprintPure, Category="ElysGenAI|STT")
bool IsListening() const;

// Configuration
UFUNCTION(BlueprintCallable, Category="ElysGenAI|STT")
void SetLanguageCode(const FString& LanguageCode);

UFUNCTION(BlueprintCallable, Category="ElysGenAI|STT")
void SetEnableVAD(bool bEnable);

// Properties
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ElysGenAI|STT")
bool bAutoStartListening = false;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ElysGenAI|STT")
FString LanguageCode = TEXT("en");

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ElysGenAI|STT")
bool bEnableVAD = true;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ElysGenAI|STT")
float MinConfidence = 0.5f;

// Events
UPROPERTY(BlueprintAssignable, Category="ElysGenAI|STT")
FElysSTTResultDelegate OnTranscriptionComplete;
};

UERP_STTSubsystem

Game instance subsystem managing STT backend.

UCLASS()
class UERP_STTSubsystem : public UGameInstanceSubsystem
{
GENERATED_BODY()

public:
// Backend access
TScriptInterface<IERP_STTBackend> GetBackend() const;

// Context management
bool RegisterContext(FERP_STTContext* Context);
void UnregisterContext(FERP_STTContext* Context);
};

FERP_STTResult

Speech-to-text result.

USTRUCT(BlueprintType)
struct FERP_STTResult
{
GENERATED_BODY()

UPROPERTY(BlueprintReadOnly)
FString TranscribedText;

UPROPERTY(BlueprintReadOnly)
float Confidence; // 0.0-1.0

UPROPERTY(BlueprintReadOnly)
FString Language;

UPROPERTY(BlueprintReadOnly)
bool bIsFinal; // True for final result
};

LLM Module

UERP_LLMComponent

Actor component for language models.

UCLASS(BlueprintType, Blueprintable)
class UERP_LLMComponent : public UActorComponent
{
GENERATED_BODY()

public:
// Generation
UFUNCTION(BlueprintCallable, Category="ElysGenAI|LLM")
void SendMessage(const FString& Message);

UFUNCTION(BlueprintCallable, Category="ElysGenAI|LLM")
void ClearHistory();

// Configuration
UFUNCTION(BlueprintCallable, Category="ElysGenAI|LLM")
void SetSystemPrompt(const FString& Prompt);

UFUNCTION(BlueprintCallable, Category="ElysGenAI|LLM")
void SetTemperature(float Temperature);

UFUNCTION(BlueprintCallable, Category="ElysGenAI|LLM")
void SetMaxTokens(int32 MaxTokens);

// Properties
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ElysGenAI|LLM")
FString SystemPrompt = TEXT("You are a helpful assistant.");

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ElysGenAI|LLM")
int32 MaxTokens = 256;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ElysGenAI|LLM")
float Temperature = 0.7f;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ElysGenAI|LLM")
int32 MaxHistoryMessages = 20;

// Events
UPROPERTY(BlueprintAssignable, Category="ElysGenAI|LLM")
FERP_LLMResultDelegate OnGenerationComplete;

UPROPERTY(BlueprintAssignable, Category="ElysGenAI|LLM")
FERP_LLMTokenDelegate OnTokenGenerated;
};

FERP_LLMResult

Language model generation result.

USTRUCT(BlueprintType)
struct FERP_LLMResult
{
GENERATED_BODY()

UPROPERTY(BlueprintReadOnly)
FString GeneratedText;

UPROPERTY(BlueprintReadOnly)
int32 TokenCount;

UPROPERTY(BlueprintReadOnly)
EElysLLMFinishReason FinishReason; // Completed, Length, Stop, Error
};

FERP_LLMGenerationConfig

Language model generation configuration.

USTRUCT(BlueprintType)
struct FERP_LLMGenerationConfig
{
GENERATED_BODY()

UPROPERTY(BlueprintReadWrite)
int32 MaxTokens = 256;

UPROPERTY(BlueprintReadWrite)
float Temperature = 0.7f;

UPROPERTY(BlueprintReadWrite)
float TopP = 0.9f;

UPROPERTY(BlueprintReadWrite)
int32 TopK = 40;

UPROPERTY(BlueprintReadWrite)
float RepetitionPenalty = 1.1f;
};

Editor Module (Model Downloader)

UERP_LLMModelDownloader

Model downloader for LLM models (llama.cpp / GGUF format).

UCLASS(BlueprintType)
class UERP_LLMModelDownloader : public UObject
{
GENERATED_BODY()

public:
// Get available models
UFUNCTION(BlueprintCallable, Category="Elys GenAI|LLM Downloader")
static TArray<FERP_LLMModelInfo> GetAvailableModels();

// Download a model
UFUNCTION(BlueprintCallable, Category="Elys GenAI|LLM Downloader")
bool DownloadModel(const FString& ModelId);

// Cancel download
UFUNCTION(BlueprintCallable, Category="Elys GenAI|LLM Downloader")
void CancelDownload();

// Check if model is downloaded
UFUNCTION(BlueprintCallable, Category="Elys GenAI|LLM Downloader")
static bool IsModelDownloaded(const FString& ModelId);

// Get model file path
UFUNCTION(BlueprintCallable, Category="Elys GenAI|LLM Downloader")
static FString GetModelPath(const FString& ModelId);

// Delete a model
UFUNCTION(BlueprintCallable, Category="Elys GenAI|LLM Downloader")
static bool DeleteModel(const FString& ModelId);

// Get download status
UFUNCTION(BlueprintCallable, Category="Elys GenAI|LLM Downloader")
ERP_LLMModelDownloadStatus GetDownloadStatus() const;

// Get current model being downloaded
UFUNCTION(BlueprintCallable, Category="Elys GenAI|LLM Downloader")
FString GetCurrentModelId() const;

// Events
UPROPERTY(BlueprintAssignable, Category="Elys GenAI|LLM Downloader")
FOnDownloadProgressNative OnDownloadProgressNative;

UPROPERTY(BlueprintAssignable, Category="Elys GenAI|LLM Downloader")
FOnDownloadCompleteNative OnDownloadCompleteNative;
};

Available Model IDs:

  • "phi-3-mini-4k" - Microsoft Phi-3-mini (2.3 GB, MIT)
  • "llama-3.2-1b" - Meta Llama 3.2 1B (800 MB)
  • "gemma-2-2b" - Google Gemma 2 2B (1.6 GB)
  • "tinyllama-1.1b" - TinyLlama 1.1B (700 MB, Apache 2.0)

FERP_LLMModelInfo

Model metadata for downloadable LLM models.

USTRUCT(BlueprintType)
struct FERP_LLMModelInfo
{
GENERATED_BODY()

UPROPERTY(BlueprintReadOnly)
FString ModelId; // e.g., "phi-3-mini-4k"

UPROPERTY(BlueprintReadOnly)
FString DisplayName; // e.g., "Phi-3-mini (4K context)"

UPROPERTY(BlueprintReadOnly)
FString Description;

UPROPERTY(BlueprintReadOnly)
int64 FileSizeBytes; // e.g., 2400000000 for 2.3 GB

UPROPERTY(BlueprintReadOnly)
FString DownloadURL; // HuggingFace URL

UPROPERTY(BlueprintReadOnly)
FString Filename;

UPROPERTY(BlueprintReadOnly)
FString Quantization; // "Q4_K_M"

UPROPERTY(BlueprintReadOnly)
int32 ContextLength; // 4096, 8192, 128K, etc.
};

ERP_LLMModelDownloadStatus

Download status enum.

UENUM(BlueprintType)
enum class ERP_LLMModelDownloadStatus : uint8
{
NotStarted UMETA(DisplayName = "Not Started"),
Downloading UMETA(DisplayName = "Downloading"),
Completed UMETA(DisplayName = "Completed"),
Failed UMETA(DisplayName = "Failed"),
Cancelled UMETA(DisplayName = "Cancelled")
};

UERP_ModelDownloaderEditorSubsystem

Editor subsystem for managing both Whisper STT and LLM model downloads.

UCLASS()
class UERP_ModelDownloaderEditorSubsystem : public UEditorSubsystem
{
GENERATED_BODY()

public:
// Whisper model download
UFUNCTION(BlueprintCallable, Category="Elys GenAI|Model Downloader")
bool DownloadWhisperModel(const FString& ModelId);

// Open the model manager window (tabbed UI)
UFUNCTION(BlueprintCallable, Category="Elys GenAI|Model Downloader")
void OpenDownloaderWindow();

// Get the model downloader instance
UERP_WhisperModelDownloader* GetModelDownloader();

// Get available Whisper models
UFUNCTION(BlueprintCallable, Category="Elys GenAI|Model Downloader")
TArray<FERP_WhisperModelInfo> GetAvailableWhisperModels();

// Check if Whisper model is downloaded
UFUNCTION(BlueprintCallable, Category="Elys GenAI|Model Downloader")
bool IsWhisperModelDownloaded(const FString& ModelId);
};

Enums

EElysGenAIServiceState

UENUM(BlueprintType)
enum class EElysGenAIServiceState : uint8
{
Uninitialized,
Ready,
Processing,
Error
};

EElysPushToTalkMode

UENUM(BlueprintType)
enum class EElysPushToTalkMode : uint8
{
AlwaysOn, // Continuous capture
PushToTalk, // Hold key to talk
PushToMute // Hold key to mute
};

EElysLLMFinishReason

UENUM(BlueprintType)
enum class EElysLLMFinishReason : uint8
{
Completed, // Generation finished naturally
Length, // Hit max tokens
Stop, // Hit stop sequence
Error // Generation error
};

Delegates

// STT
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FElysSTTResultDelegate, const FERP_STTResult&, Result);

// LLM
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FERP_LLMResultDelegate, const FERP_LLMResult&, Result);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FERP_LLMTokenDelegate, const FString&, Token);

Next Steps