EchoTrio
 
Loading...
Searching...
No Matches
EchoTrio.Actor Class Reference

The actors are the OpenAI Response model which chats with the user. More...

Collaboration diagram for EchoTrio.Actor:
Collaboration graph

Classes

class  ElevenLabsSettings
 
class  OpenAISettings
 
class  Response
 

Public Member Functions

 Actor (ActorConfig config)
 
void AddSystemMesssage (string message)
 
void AddUserMessage (string message)
 
async Task< Actor.ResponseInsertResponse (string message, Emotion emotion, CancellationToken cancellationToken)
 
async Task< Actor.ResponseGetResponse (CancellationToken cancellationToken)
 

Properties

string Persona [get, private set]
 
bool EnableDebug = false [get, set]
 

Private Member Functions

async Task< AudioClip > GetAudioClipAsync (string text, CancellationToken cancellationToken)
 
bool ContainsAudioTags (string text)
 
OpenAI.Function BuildSetEmotionTool ()
 
string ParseEmotion (string args)
 

Private Attributes

OpenAIClient openAIApi = null
 
OpenAISettings openAISettings = null
 
ElevenLabsClient elevenLabsApi = null
 
ElevenLabsSettings elevenLabsSettings = null
 
List< IResponseItem > conversation = new List<IResponseItem>()
 The conversation history from this actor's point of view.
 

Detailed Description

The actors are the OpenAI Response model which chats with the user.

Definition at line 15 of file Actor.cs.

Constructor & Destructor Documentation

◆ Actor()

EchoTrio.Actor.Actor ( ActorConfig  config)
inline

Definition at line 79 of file Actor.cs.

Member Function Documentation

◆ AddSystemMesssage()

void EchoTrio.Actor.AddSystemMesssage ( string  message)
inline

Append a system message to the actor's conversation history.

Parameters
messageThe message to append.

Definition at line 98 of file Actor.cs.

◆ AddUserMessage()

void EchoTrio.Actor.AddUserMessage ( string  message)
inline

Append a user message to the actor's conversation history.

Parameters
messageThe message to append.

Definition at line 104 of file Actor.cs.

◆ BuildSetEmotionTool()

OpenAI.Function EchoTrio.Actor.BuildSetEmotionTool ( )
inlineprivate

Create a function following OpenAI's JSON Schema for the actor to select its emotion for the current response. OpenAI API on function calling: https://platform.openai.com/docs/guides/function-calling

Returns
The function's JSON Object.

Definition at line 213 of file Actor.cs.

◆ ContainsAudioTags()

bool EchoTrio.Actor.ContainsAudioTags ( string  text)
inlineprivate

Definition at line 205 of file Actor.cs.

◆ GetAudioClipAsync()

async Task< AudioClip > EchoTrio.Actor.GetAudioClipAsync ( string  text,
CancellationToken  cancellationToken 
)
inlineprivate

Definition at line 189 of file Actor.cs.

◆ GetResponse()

async Task< Actor.Response > EchoTrio.Actor.GetResponse ( CancellationToken  cancellationToken)
inline

Request the actor to generate a response based on the conversation history.

Parameters
cancellationTokenCancellation token used to cancel any async actions when the program shuts down.
Returns
The actor's response.

Definition at line 127 of file Actor.cs.

◆ InsertResponse()

async Task< Actor.Response > EchoTrio.Actor.InsertResponse ( string  message,
Emotion  emotion,
CancellationToken  cancellationToken 
)
inline

Append an assistant message to the actor's conversation history. This means that we can make the actor think it said something, even if it did not. Used for scripted speech, where we force the actor to say something the designer wrote.

Parameters
messageThe message to append.
emotionThe emotion of the message.
cancellationTokenCancellation token used to cancel any async actions when the program shuts down.
Returns
The actor's response.

Definition at line 114 of file Actor.cs.

◆ ParseEmotion()

string EchoTrio.Actor.ParseEmotion ( string  args)
inlineprivate

Definition at line 235 of file Actor.cs.

Member Data Documentation

◆ conversation

List<IResponseItem> EchoTrio.Actor.conversation = new List<IResponseItem>()
private

The conversation history from this actor's point of view.

Definition at line 73 of file Actor.cs.

◆ elevenLabsApi

ElevenLabsClient EchoTrio.Actor.elevenLabsApi = null
private

Definition at line 68 of file Actor.cs.

◆ elevenLabsSettings

ElevenLabsSettings EchoTrio.Actor.elevenLabsSettings = null
private

Definition at line 69 of file Actor.cs.

◆ openAIApi

OpenAIClient EchoTrio.Actor.openAIApi = null
private

Definition at line 64 of file Actor.cs.

◆ openAISettings

OpenAISettings EchoTrio.Actor.openAISettings = null
private

Definition at line 65 of file Actor.cs.

Property Documentation

◆ EnableDebug

bool EchoTrio.Actor.EnableDebug = false
getset

Definition at line 77 of file Actor.cs.

◆ Persona

string EchoTrio.Actor.Persona
getprivate set

Definition at line 76 of file Actor.cs.


The documentation for this class was generated from the following file: