InworldPacket
Module: Inworld.AI. Namespace: Inworld.Packet.
This is the base class for packets sending and receiving from Inworld runtime server.
Variables
Variables | Description |
---|---|
timestamp | The timestamp of the packet. |
type | The type of the packet. |
packetId | The PacketId of the packet. |
routing | The Routing of the packet. |
Properties
Properties | Description |
---|---|
OutgoingTargets | Key/Value Pair for targets to send. Key is character's full name. Value is its agent ID (Nullable. We'll fetch it in the UpdateSessionInfo) |
ToJson | Generates the string of json to send to the Inworld server. |
Source | Gets the SourceType of the source. |
IsBroadCast | Returns if this packet is broadcasting (targets multiple characters). |
SourceName | Returns the agent ID of the source. |
TargetName | Returns the agent ID of the target. |
API
Function | Description | Parameters |
---|---|---|
Preprocess | Used when creating packets. Depending on the current situation is group chat or single character. | |
PrepareToSend | Originally OnDequeue in OutgoingPacket. Always call it before send to fetch the agent ID. | |
UpdateSessionInfo | Update the characters in this conversation with updated ID. Returns the brain name of the characters not found in the current session. | |
UpdateRouting | Update the routing and compose the packet based on the session info. | |
IsSource | Check if the agentID is in the source. | agentID: target agent ID. |
IsTarget | Check if the agentID is in the target or targets. | agentID: target agent ID. |
IsRelated | Check if the agentID is either in the target list, is the target, or is the source. | agentID: target agent ID. |
Related Classes
Source
Module: Inworld.AI. Namespace: Inworld.Packet.
This class defines the format of the sender or the receiver.
Variables | Description |
---|---|
type | An enumeration that determines whether this source is a player or a character. |
name | The name of the source. If it's a player, this value should be PLAYER ; if it's a character, its value should be the agentID of the character. |
Routing
Module: Inworld.AI. Namespace: Inworld.Packet.
This class determines the flow of the packet.
Variables | Description |
---|---|
source | The Source that sent this packet. |
target | The Source that received this packet. |
targets | The list of the Sources that received this packet. |
PacketId
Module: Inworld.AI. Namespace: Inworld.Packet.
The PacketId
class encapsulates identifiers used to manage different aspects of interactions within the system. These identifiers help track and organize communication between components.
Variables | Description |
---|---|
packetId | A unique ID assigned to each packet, distinguishing it from others. |
utteranceId | Represents an individual sentence or unit of communication within a conversation. Each utterance may encompass various types of behavior, such as text messages, emotion changes, audio data, and more. |
interactionId | Refers to a group of related sentences that are part of a larger interaction. An interaction may consist of multiple utterances. |
correlationId | Used in callback for server packets. |
conversationId | Used in sending group chat packets. |
Properties | Description |
---|---|
ToString | Gets a formatted string that combines the packet's status, interaction ID, utterance ID, and packet ID. The format is $"{Status} I: {interactionId} U: {utteranceId} P: {packetId}" |