Lokutor. Install it as in
Unity: introduction. The names match the JavaScript and
Python SDKs; the parity table puts the four
side by side.
The components (LokutorAgent, LokutorLipSync, LokutorVoice, LokutorAudioManager) raise their events on the main
thread. Everything else is plain C# without UnityEngine, and raises its events when you call Update().
Components
LokutorAgent
class LokutorAgent : MonoBehaviour
A component (Lokutor > Lokutor Agent, needs an AudioSource). Makes a character a voice agent: it listens through the microphone, answers in its own voice from where it stands (3D audio), moves its mouth, and calls your game’s functions (“actions”) when the conversation calls for it.
Account (in the Inspector)
Character (in the Inspector)
Microphone (in the Inspector)
Lip sync (optional) (in the Inspector)
Game actions the character can use (in the Inspector)
Events (in the Inspector)
From code
Events
LokutorAgent AddAction(string name, string description, Func<ActionArgs, string> handler, params ActionParam[] parameters)
Lets the character call a game function. Works before or during a conversation. The handler runs on the main thread and returns a short sentence saying what happened.
LokutorAgent AddActionAsync(string name, string description, Func<ActionArgs, Task<string>> handler, params ActionParam[] parameters)
An action that takes a while (a walk, a web request): the character waits for the result.
LokutorAgent AddAction(AgentAction action)
The same, from an AgentAction.
void RemoveAction(string name)
The character can no longer call it.
void StartConversation()
Opens the conversation: the character greets the player and starts listening.
void StopConversation()
Ends the conversation and releases the microphone.
void SetPersona(string newPersona)
Changes who the character is, mid-conversation.
void SetContext(string key, string value)
Tells the character something about the game right now ("Time left", "20 seconds"), without rewriting its persona. Null takes it out. Changes in the same quarter second are sent together. A dashboard agent needs a persona for this: its own prompt cannot be extended from the game.
void SetVoice(string newVoice)
Changes the voice, mid-conversation.
void SetLanguage(string newLanguage)
Changes the language, mid-conversation. "auto": the character follows the language the player speaks.
void SetPitch(float newPitch)
Shifts the voice up or down, mid-conversation.
void ResetConversation()
Forgets the conversation so far (the character starts fresh).
List<TranscriptLine> GetTranscript()
The conversation so far, or the last one.
void SetTalking(bool talking)
Push-to-talk from any input: true while the player holds the button.
void FeedMicrophone(float[] samples, int offset, int count, int sampleRate)
What the character hears, when it does not come from the microphone (MicMode.Off): mono samples at any rate.
LokutorLipSync
class LokutorLipSync : MonoBehaviour
A component (Lokutor > Lokutor Lip Sync). Moves a mouth with a voice: blend shapes, a jaw, or 2D drawings. LokutorAgent and LokutorVoice feed it; or feed it yourself with PushVisemes and Advance. See Lip sync.
Blend shapes (in the Inspector)
Jaw (in the Inspector)
2D (in the Inspector)
Feel (in the Inspector)
Events (in the Inspector)
From code
void Bind()
Finds the mouth. Done by itself the first time; call it after changing faces or mapping.
void PushVisemes(IEnumerable<Viseme> list)
The visemes of the reply being heard, as they arrive.
void Clear()
A new reply, or silence: the mouth closes.
void Advance(float heard, float level, bool speaking, float delta)
One frame of the mouth. heard is how much of the reply has been heard, in seconds; level its loudness (RMS); speaking whether it is playing at all. Called for you by LokutorAgent and LokutorVoice.
void Apply()
Puts the mouth’s shape on the face. Done by itself every frame.
Sprite MouthSprite()
The drawing of the mouth’s shape, for a UI Image or a material of yours. Null when there are none.
LokutorVoice
class LokutorVoice : MonoBehaviour
A component (Lokutor > Lokutor Voice, needs an AudioSource). Says written lines (barks, narration, tutorials) in a character’s voice, from its place in the world, moving its mouth. Lines are kept on disk, so each is made once; they can also ship with the game and need no network at all. See Speech.
In the Inspector
Events (in the Inspector)
From code
Events
Task<bool> Say(string text, SayOptions options = null)
Says a line; awaited, returns when it has been heard (true) or could not be said (false). Lines wait for each other, unless options.Interrupt.
void SayLine(string text)
The same for a UnityEvent or a coroutine’s fire and forget.
IEnumerator SayAndWait(string text, SayOptions options = null)
For coroutines: yield return voice.SayAndWait("...");
void Stop()
Stops at once and forgets the lines waiting.
Task PreloadLines(IEnumerable<string> texts, SayOptions options = null)
Makes lines before they are needed, so they start at once.
bool HasLine(string text, SayOptions options = null)
Whether a line is on disk or ships with the game.
Task SaveLinesTo(string folder, IEnumerable<string> texts, SayOptions options = null)
Writes lines into a folder of the project, so they ship with the game and need no network or key: in the editor, SaveLinesTo("Assets/Resources/LokutorVoices", lines).
LokutorAudioManager
class LokutorAudioManager : MonoBehaviour, IAudioManager
A component (Lokutor > Lokutor Audio Manager, needs an AudioSource): Unity’s microphone and speakers for the clients of the SDK. A whole conversation with VoiceAgentClient, or dictation with SpeechToTextClient, without a LokutorAgent.
In the Inspector
From code
Task<bool> StartManaged(VoiceAgentClient voiceAgent)
Connects the client with this microphone and speaker, and raises its events on the main thread.
Task<bool> StartManaged(SpeechToTextClient speechToText)
Connects the client with this microphone, and raises its events on the main thread.
bool StartMicrophone(Action<float[], int, int> handler)
As IAudioManager.
void StopMicrophone()
As IAudioManager.
void PlayAudio(byte[] pcm16, int sampleRate)
As IAudioManager.
void StopPlayback()
As IAudioManager.
float GetAmplitude()
The microphone’s loudness, 0 to 1.
Actions
AgentAction
class AgentAction
A game function the character can decide to call: open a door, give an item, start a quest. The handler returns a short sentence that tells the character what happened (“Gave the iron sword. The player now has 5 gold.”), which it uses to answer. See Actions.
static AgentAction Async(string name, string description, Func<ActionArgs, Task<string>> handler, params ActionParam[] parameters)
An action that takes a while: the character waits for the result.
ToolDefinition ToTool()
The definition the language model sees.
ActionParam
class ActionParam
One argument an action takes, e.g. new ActionParam("item", "Which item to give").
ParamType
The type of one action parameter, as the language model sees it. Values: String, Number, Integer, Boolean.
ActionArgs
class ActionArgs
The arguments the character chose when it called an action.
bool Has(string name)
Whether the character gave this argument.
string GetString(string name, string fallback = "")
An argument as text.
double GetNumber(string name, double fallback = 0)
An argument as a number.
int GetInt(string name, int fallback = 0)
An argument as a whole number.
bool GetBool(string name, bool fallback = false)
An argument as true or false.
LokutorActionBinding
class LokutorActionBinding
A game action set up in the Inspector: the character calls it, onCalled runs.
Conversations
VoiceAgentClient
class VoiceAgentClient : EventPump, IDisposable
A voice conversation over /ws/agent, with the same options, methods and events as VoiceAgentClient in the JavaScript and Python SDKs. It does not need Unity. Call its Update() every frame: that is when its events are raised.
For a character in a scene use LokutorAgent, which adds the microphone, the 3D voice, lip sync and actions on top of this.
Events
Task<bool> ConnectAsync()
Opens the session and sends the configuration. false if it could not: the reason is raised as Error and kept in LastError.
void Disconnect()
Ends the session and releases the microphone.
Task DisconnectAsync()
The same, awaited.
void Dispose()
Ends the session and releases everything.
Task<bool> StartManagedAsync(IAudioManager audio)
Runs the microphone and the speaker too: a whole conversation in one call.
bool ToggleMute()
Mutes or unmutes the managed microphone; returns whether it is now muted.
float GetAmplitude()
The managed microphone’s loudness, 0 to 1.
void SendAudio(byte[] pcm16)
Microphone audio: 16-bit PCM, 16 kHz, mono. Keep sending it (silence too): the server measures pauses in it.
void SendAudioFloat(float[] samples, int rate)
The same from float samples at any rate.
void SendAudioFloat(float[] samples, int offset, int count, int rate)
The same from part of an array.
void UpdatePrompt(string prompt)
Replaces the prompt, mid-session.
void UpdateVoice(string voice)
Changes the voice, mid-session.
void UpdateLanguage(string language)
Changes the language, mid-session.
void UpdateTools(IEnumerable<ToolDefinition> tools)
Replaces the tools, mid-session.
void UpdatePitch(float pitch)
Shifts the voice’s pitch for the rest of the session.
void UpdateVisemes(bool enabled)
Asks for visemes, or stops asking, from the next reply on.
void Reset()
Clears the conversation: the agent starts fresh.
void SubmitToolResult(string callId, object result)
Answers a ToolCall with a string, or anything JSON can carry.
List<TranscriptLine> GetTranscript()
The conversation so far.
string GetTranscriptText()
The same as text, a line each.
static Task<List<VoiceInfo>> GetVoicesAsync(string baseUrl = LokutorApi.VoiceAgentUrl)
As LokutorApi.GetVoicesAsync.
static Task<List<LanguageInfo>> GetLanguagesAsync(string baseUrl = LokutorApi.VoiceAgentUrl)
As LokutorApi.GetLanguagesAsync.
static Task<List<ModelInfo>> GetModelsAsync(string baseUrl = LokutorApi.VoiceAgentUrl)
As LokutorApi.GetModelsAsync.
static Task<ServerConfig> GetConfigAsync(string baseUrl = LokutorApi.VoiceAgentUrl)
As LokutorApi.GetConfigAsync.
static Task<Dictionary<string, object>> GetStatusAsync(string baseUrl = LokutorApi.VoiceAgentUrl)
As LokutorApi.GetStatusAsync.
static Task<HealthStatus> GetHealthAsync(string baseUrl = LokutorApi.VoiceAgentUrl)
As LokutorApi.GetHealthAsync.
ToolDefinition
class ToolDefinition
A function the agent may call (OpenAI format).
ToolCall
class ToolCall
The agent wants a function called. Answer with SubmitToolResult(CallId, result).
TranscriptLine
class TranscriptLine
A line of the conversation.
CustomLLMConfig
class CustomLLMConfig
Your own OpenAI-compatible endpoint.
LlmRequest
class LlmRequest
One turn for a model that runs in the game: the conversation so far (OpenAI chat messages) and the agent’s tools.
LlmReply
class LlmReply
The reply of your own model to one LlmRequest. Stop when Cancelled turns true: the player spoke over it.
void Chunk(string text)
More text. Lokutor starts speaking at the first sentence.
void ToolCall(string name, object arguments, string callId = "")
One of the agent’s tools to call. Arguments: a JSON string, or anything JSON can carry.
void Done()
The reply is complete. Returning from the handler does it for you.
void Fail(string message)
The model failed: the agent is told so.
IAudioManager
interface IAudioManager
A microphone and a speaker for a managed conversation (AudioManager in the JavaScript SDK). LokutorAudioManager is Unity’s.
bool StartMicrophone(Action<float[], int, int> onAudio)
Captures: mono samples, how many, and their rate. False when there is no microphone.
void StopMicrophone()
Releases it.
void PlayAudio(byte[] pcm16, int sampleRate)
Queues voice (16-bit PCM, mono).
void StopPlayback()
Stops at once and forgets what was queued.
float GetAmplitude()
The microphone’s loudness, 0 to 1.
LokutorSession
class LokutorSession : IDisposable
One voice conversation with one character, without the engine, on top of VoiceAgentClient. It knows what the character is doing, keeps its voice until the engine plays it, runs the game’s actions, and decides when the microphone is open. LokutorAgent is a thin layer on top; use the session in an engine that is not Unity.
Events
LokutorSession AddAction(AgentAction action)
Lets the character call a game function. Works before or during a conversation.
LokutorSession AddAction(string name, string description, Func<ActionArgs, string> handler, params ActionParam[] parameters)
The same, in one call.
LokutorSession AddActionAsync(string name, string description, Func<ActionArgs, Task<string>> handler, params ActionParam[] parameters)
An action that takes a while: the character waits for the result.
void RemoveAction(string name)
The character can no longer call it.
void RefreshActions()
Sends the list of actions again. AddAction and RemoveAction do it for you.
Task ConnectAsync(CancellationToken cancel = default)
Opens the conversation. Throws an IOException when it cannot; its inner exception is a LokutorException with the error.
static string ConfigLanguage(string language, bool dashboardAgent)
The language to send at connect, or null to send none.
void SetPersona(string persona)
Changes who the character is, mid-conversation.
void SetContext(string key, string value)
Tells the character something about the game right now ("Time left", "20 seconds"), without rewriting its persona. Null takes it out. Changes in the same quarter second are sent together, by Update(). A dashboard agent needs a Persona for this: its own prompt cannot be extended from the game.
void SetVoice(string voice)
Changes the voice.
void SetLanguage(string language)
“auto”: the character follows the language the player speaks.
void SetPitch(float pitch)
Shifts the voice up or down.
void ResetConversation()
Forgets the conversation so far (the character starts fresh).
List<TranscriptLine> GetTranscript()
The conversation so far.
void SendMicrophone(float[] samples, int offset, int count, int sampleRate)
Sends microphone audio (mono floats, any sample rate) to the character. Call it with whatever the engine captured since last frame; resampling and framing are handled here. Keep calling it with silence (zeros) when the player is quiet: the server hears pauses as end of turn.
void SendPcm16(byte[] pcm16At16k)
Sends 16 kHz mono PCM16 as is (e.g. a recorded line).
void SetVoiceAudibleUntil(DateTime utc)
Tells the session when the voice the engine has already taken from Playback will have finished coming out of the speakers (its own buffers and output latency included), so the microphone stays muted until then. Engines that do not call it get EchoTailMs after their last read, which is enough when they read close to real time.
void Update()
Call once per frame from the game’s main thread. Delivers queued events, runs action handlers, and moves the state from Speaking back to Ready once the voice has played out.
Task DisconnectAsync()
Ends the conversation.
void Dispose()
Ends the conversation and releases everything.
SessionOptions
class SessionOptions
The options of a LokutorSession.
AgentState
What the conversation is doing. Values: Disconnected, Connecting, Ready, PlayerTalking, Thinking, Speaking.
MicMode
When the character hears the player. Values: Always, PushToTalk, Off.
Speech
TTSClient
class TTSClient : IDisposable
Text to speech over /ws/tts, as TTSClient in the JavaScript and Python SDKs. For a character that says written lines use LokutorVoice, which plays them and moves the mouth.
Task<TTSResult> SynthesizeAsync(string text, SynthesizeOptions options = null, CancellationToken cancel = default)
Speaks a text; done when all of it has arrived. The callbacks in the options run as it is generated, on the thread that called this (in Unity, the main one). Requests run one after another.
void Cancel()
Stops the request being spoken and forgets the ones waiting.
void Close()
Cancels, and closes the connection.
void Dispose()
The same as Close().
SynthesizeOptions
class SynthesizeOptions
The options of one request.
TTSResult
class TTSResult
What came of it.
STTClient
class STTClient
Transcribes one complete recording (POST /stt/transcribe), as STTClient in the JavaScript and Python SDKs. For speech as it happens use SpeechToTextClient.
Task<TranscribeResult> TranscribeAsync(byte[] audio, TranscribeOptions options = null, CancellationToken cancel = default)
Audio is 16-bit PCM mono (set SampleRate if it is not 16 kHz) or a whole WAV file’s bytes.
TranscribeOptions
class TranscribeOptions
The options of one transcription.
TranscribeResult
class TranscribeResult
What came of it.
TranscribeSegment
class TranscribeSegment
A piece of the transcript.
SpeechToTextClient
class SpeechToTextClient : EventPump, IDisposable
Speech to text as the player talks, over /ws/stt: voice commands, dictation, captions. No language model and no voice. As SpeechToTextClient in the JavaScript SDK. Call its Update() every frame, or start it with LokutorAudioManager.
Events
Task<bool> ConnectAsync(IAudioManager audio = null)
Connects, and with an audio manager (LokutorAudioManager in Unity) starts listening. Without one, send the audio yourself.
void Disconnect()
Ends the session and releases the microphone.
void Dispose()
The same.
void SendAudio(byte[] pcm16)
16-bit PCM, 16 kHz, mono. Keep sending silence: the end of an utterance is measured in it.
void SendAudioFloat(float[] samples, int offset, int count, int rate)
The same from float samples at any rate.
void EndUtterance()
Finishes whatever is being said now.
VoiceLines
class VoiceLines
Says lines one after another through a PlaybackBuffer, and keeps them.
Events
Task<bool> SayAsync(string text, SayOptions options = null)
Says a line. The task ends when it has been heard (true) or could not be said (false). Lines wait for each other.
void Stop()
Stops at once and forgets the lines waiting.
void Update()
Call once per frame, on the thread SayAsync is called from.
Task PreloadAsync(IEnumerable<string> lines, SayOptions options = null)
Fetches lines before they are needed, so they start at once and, once kept, work without a network.
Task SaveAsync(Action<string, VoiceLine> store, IEnumerable<string> lines, SayOptions options = null)
The same, into a place of your choice (the game’s own files): store(key, line).
bool HasLine(string text, SayOptions options = null)
Whether a line is already kept.
VoiceLine
class VoiceLine
A line as it is kept: the voice and its mouth shapes.
static string KeyFor(string voice, string language, string text)
The name a line is kept under: the same voice, language and words give the same one.
byte[] ToBytes()
The line as a file.
static VoiceLine FromBytes(byte[] bytes)
Null when the bytes are not a line.
SayOptions
class SayOptions
The options of one line.
Lip sync
Viseme
struct Viseme
One mouth shape of a reply: V its id (0-14) and C its name in LokutorApi.Visemes, T when it starts and D how long it lasts, in seconds from the reply’s first sample.
LipSync
class LipSync
The shape of a mouth over time. Give it the visemes of a reply and, every frame, how much of the reply has been heard: it answers with the weight of each of the 15 shapes. Without visemes it follows the loudness.
Events
void PushVisemes(IEnumerable<Viseme> list)
The visemes of the reply being heard, as they arrive.
void Clear()
A new reply, or silence: the mouth closes.
bool Advance(float heard, float level, bool speaking, float delta)
One frame of the mouth. heard is how much of the reply has been heard, in seconds; level its loudness (RMS); speaking whether it is playing at all. false: nothing changed (a stepped mouth holds its pose).
int SpriteFrame(int count)
The frame of a set of mouth drawings: 0 closed, 1 slightly open, 2 open, 3 round (if there are that many).
MouthRig
class MouthRig
Which blend shapes of a face make each viseme. They are found by name: the 15 visemes of Oculus, Ready Player Me and VRChat (viseme_PP, viseme_aa…), VRM (aa ih ou ee oh) and the A I U E O of VRoid and MMD-style rigs, ARKit (jawOpen, mouthFunnel…), or a single mouth-open shape. Or write your own mapping.
static MouthRig Find(IReadOnlyList<string> names, IReadOnlyDictionary<string, Dictionary<string, float>> mapping = null)
Finds the mouth in a list of blend shape names (their order gives the indices). mapping, if not empty, is used instead of the usual names: viseme name to blend shape name to weight, 0 to 1.
MouthRig.Shape
struct Shape
One blend shape that moves: its index, and how much of it each viseme takes.
float Weight(float[] visemes, float intensity)
Its weight for these viseme weights, 0 to 1 (a little more with a high intensity).
MouthRigKind
The kinds of mouth LipSync finds in a face. Values: None, Visemes, Vrm, ArKit, MouthOpen, Custom.
LokutorVisemeShape
class LokutorVisemeShape
One blend shape of one viseme, for rigs whose names are not recognised.
LokutorVisemeSprite
class LokutorVisemeSprite
The drawing of one viseme.
MouthShape
A mouth shape, coarse enough to map onto any sprite set. LipSync uses the 15 visemes themselves. Values: Rest, A, E, I, O, U, MBP, FV, L, S, Other.
VisemeMark
struct VisemeMark
A viseme with the names it had before 0.2. Viseme is what LipSync takes.
static MouthShape ShapeFor(char c)
The mouth of a letter.
Audio
LokutorMicrophone
class LokutorMicrophone : IDisposable
The microphone, in mono blocks as they arrive. LokutorAgent and LokutorAudioManager have one each.
bool Start(string deviceName = null)
False (and a warning in the console) without a microphone, or when it cannot be opened.
void Stop()
Releases it.
void Dispose()
The same as Stop().
void Update(Action<float[], int, int> onAudio)
Call once per frame: hands over what has arrived (samples, how many, rate). The array is reused.
LokutorVoicePlayer
class LokutorVoicePlayer : IDisposable
Plays a voice through an AudioSource as it arrives, and tells its buffer how much of it has been heard. LokutorAgent, LokutorVoice and LokutorAudioManager have one each.
Events
void Update()
Call once per frame.
void Stop()
Silence, and lets go of the clip. Update() starts again.
void Dispose()
Stops for good.
PlaybackBuffer
class PlaybackBuffer
A voice, waiting to be played. Network threads write; the engine reads at SampleRate, a little ahead of what it is playing. Silence is returned when it runs dry, so the engine can keep a looping source going for the whole conversation.
It also keeps the clock lip sync runs on: the engine says how much of what it read has come out (MarkPlayed), and HeardSeconds is how much of the current reply has been heard.
void MarkPlayed(long samples)
How many of the samples read so far (TotalRead) have come out of the speakers. An engine that never says is taken to play what it reads at once.
void Write(float[] samples)
More voice.
int Read(float[] dst, int offset, int n)
Fills dst (mono) with queued audio, then silence.
void Clear()
Drops everything queued (the caller interrupted, or a newer reply began) and counts from 0 again.
LokutorAudio
class LokutorAudio
Audio helpers, named as in the JavaScript and Python SDKs.
static float[] Pcm16ToFloat32(byte[] pcm)
16-bit PCM to floats, -1 to 1.
static byte[] Float32ToPcm16(float[] samples)
Floats to 16-bit PCM, clipped.
static float CalculateRMS(float[] samples)
Loudness (root mean square).
static float CalculateRMS(float[] samples, int offset, int count)
The same of part of an array.
static float[] NormalizeAudio(float[] samples, float targetPeak = 0.95f)
The same audio, scaled so its loudest sample is targetPeak.
static float[] Resample(float[] samples, int fromRate, int toRate)
A whole recording at another rate.
static byte[] WavBytes(byte[] pcm, int rate)
A whole PCM16 mono recording as a WAV file’s bytes.
StreamResampler
class StreamResampler
Streaming mono resampler. Keeps its phase across calls, so audio can be pushed in chunks of any size (a game engine hands the microphone over in whatever blocks it has). Downsampling averages the input over each output step, which is enough anti-aliasing for speech going to a recogniser; upsampling interpolates linearly.
float[] Process(float[] input)
The next block, resampled.
float[] Process(float[] input, int offset, int count)
The same from part of an array.
void Reset()
Forgets the phase: the next block starts a new stream.
StreamingResampler
class StreamingResampler : StreamResampler
The name StreamResampler had before 0.2.
Pcm16
class Pcm16
PCM16 little-endian helpers.
static byte[] FromFloat(float[] samples, int offset, int count)
Floats to 16-bit PCM.
static float[] ToFloat(byte[] bytes)
16-bit PCM to floats.
API and errors
LokutorApi
class LokutorApi
Constants and helpers shared by the whole package, and the API’s public discovery endpoints, which need no key. (A class cannot be called Lokutor inside its namespace.)
static string LanguageToWire(string language)
The value the protocol carries for a language: "auto" and "" are both "" (follow the player).
static string StripTags(string text)
A line without the expression tags the voice performs ([laugh], [sad]…), for subtitles.
static int VisemeId(string name)
The id (0-14) of a viseme name, whatever its case; 0 (closed) for an unknown one.
static string HttpOrigin(string url)
ws://host/path becomes http://host.
static Task<List<VoiceInfo>> GetVoicesAsync(string baseUrl = VoiceAgentUrl)
Voices the API offers.
static Task<List<LanguageInfo>> GetLanguagesAsync(string baseUrl = VoiceAgentUrl)
Languages the API offers.
static Task<List<ModelInfo>> GetModelsAsync(string baseUrl = VoiceAgentUrl)
Speech models.
static Task<ServerConfig> GetConfigAsync(string baseUrl = VoiceAgentUrl)
Request limits and defaults.
static Task<Dictionary<string, object>> GetStatusAsync(string baseUrl = VoiceAgentUrl)
Runtime status of the service, as the API reports it.
static Task<HealthStatus> GetHealthAsync(string baseUrl = VoiceAgentUrl)
Whether the service is ready to take requests.
VoiceInfo
class VoiceInfo
A voice the API offers.
LanguageInfo
class LanguageInfo
A language the API offers.
ModelInfo
class ModelInfo
A speech model.
ServerConfig
class ServerConfig
Request limits and defaults.
HealthStatus
class HealthStatus
Whether the service is ready.
LokutorError
class LokutorError
An error from the API or the SDK. Code is one of the error codes, the same as in the JavaScript and Python SDKs.
static LokutorError FromServer(object data)
From a server’s error payload: {code, message, detail, retryable}, or a plain string.
LokutorException
class LokutorException : Exception
A LokutorError thrown, by the calls that have no other way to report one.
EventPump
class EventPump
Delivers events on your game’s thread: they are queued as the network brings them and raised when you call Update, once per frame. VoiceAgentClient and SpeechToTextClient are one.
void Update()
Call once per frame from the game’s main thread.
MiniJson
class MiniJson
The JSON reader and writer the package uses, so it needs no other.
static object Parse(string json)
A JSON text as dictionaries, lists, strings, numbers, booleans and null.
static string Serialize(object value)
The opposite.
LokutorTextEvent
class LokutorTextEvent : UnityEvent<string>
A UnityEvent with a text.
LokutorStateEvent
class LokutorStateEvent : UnityEvent<AgentState>
A UnityEvent with the conversation’s state.