expressive

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: BSD-2-Clause Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package expressive holds what a TTS service can perform in an expressive conversation, which lets an agent hear how something was said and answer in kind.

An LLM writes expression into its reply as inline tags: [[name]] for a sound or silence at one point, <<name>> for the delivery of the words after it, <<name: words>> for the delivery of just those words, and ^^word^^ to stress a word. A delivery lasts until the next delivery tag or the end of the response, and <<neutral>> returns to the voice's baseline.

For example:

<<warm>> It's [[laugh]] ^^back^^ up. [[pause 300]] Your code is <<slow: A B 7>>.

A TTS service declares which of these it can perform with ExpressionCapabilities, and broadcasts them at start in a frames.TTSMetadataFrame, so the LLM can be told which tags to write.

Every delivery and sound the services perform is named the same way on each, the universal names: ExpressionDelivery and ExpressionSound. A universal name in a tag, such as <<warm>> or [[laugh]], is sent to each service by its own name for it, such as ElevenLabs' "warmly" or Cartesia's "laughter", while everything reported keeps the name as written.

The tags are read by the formatter package and reported by the spoken package, below this one.

Alpha: the tag syntax and these types are likely to change between releases.

Index

Constants

View Source
const (
	SlowDelivery = "slow"
	FastDelivery = "fast"
)

SlowDelivery and FastDelivery slow the words down and speed them up. They are part of the protocol, so every service that performs speed names them the same.

View Source
const EmphasisDelivery = "emphasis"

EmphasisDelivery is the delivery of stressed words, written ^^words^^.

View Source
const NeutralDelivery = "neutral"

NeutralDelivery is the delivery that returns to the voice's baseline. It is part of the protocol, so it is a delivery whatever a service declares.

Variables

This section is empty.

Functions

func ExpressionInstructions

func ExpressionInstructions(
	capabilities *ExpressionCapabilities, policy *ExpressionPolicy, perception *PerceptionCapabilities,
) string

ExpressionInstructions builds the instruction for an LLM in an expressive conversation.

capabilities is what the TTS service that speaks the LLM's replies can perform, or nil for nothing; policy is which tags to offer, and guidance on how to answer, or nil for the default policy; perception is the signals perceived of how the user spoke, or nil when nothing is perceived. It returns the empty string when nothing is perceived and the TTS service can perform none of the tags offered.

func ExpressionPolicyWarning

func ExpressionPolicyWarning(capabilities *ExpressionCapabilities, policy *ExpressionPolicy) string

ExpressionPolicyWarning tells what an expression policy asks for that a TTS service cannot perform.

capabilities is what the TTS service can perform, or nil for nothing. It returns the empty string when there is no policy or the service can perform every tag it offers.

func FormatPerception

func FormatPerception(signals []PerceptionSignal) string

FormatPerception formats a reading as written at the head of the user's message to the LLM.

Each signal is a category in brackets: its labels with their confidences, so the LLM can tell a clear reading from a guess, or its measure as a value, as in ([tone frustrated=0.86, neutral=0.10],[speech_rate value=4.1]). A signal with neither labels nor a value is written with its name alone.

func IsDelivery

func IsDelivery(name string) bool

IsDelivery reports whether name is a universal delivery.

func IsSound

func IsSound(name string) bool

IsSound reports whether name is a universal sound.

func PerceptionTurnCompletionInstructions added in v0.5.0

func PerceptionTurnCompletionInstructions(complete, short, long string) string

PerceptionTurnCompletionInstructions tells an LLM that decides when the user's turn is complete that a reading of how the user spoke does not decide it. It goes after the turn completion instructions, given the markers for a complete turn, a turn cut off mid-sentence, and a user who needs time to think. Without it, a reading can change the marker: a hesitant user's cut-off words get the long wait, and words that have not answered the LLM get an answer.

Types

type DeliveryScope

type DeliveryScope string

DeliveryScope is where in a response a TTS service can change delivery.

In "<<calm>> Sure, <<excited>> it worked!", a service with DeliveryScopeAnywhere speaks "it worked!" excited. One with DeliveryScopeSentence speaks the whole sentence calm, the delivery its words start in, and the next sentence excited. A span's delivery is the exception: DeliveryScopeSentence speaks the whole of "Your code is <<slow: A B 7>>." slowly, so the span's words still are.

const (
	// DeliveryScopeAnywhere is a delivery that takes effect where its tag
	// appears. It is the default: the empty scope reads as it.
	DeliveryScopeAnywhere DeliveryScope = "anywhere"
	// DeliveryScopeSentence is a delivery that can change only between
	// requests, for a service that takes delivery as a setting of each request,
	// such as MiniMax, or that changes it reliably only between generations,
	// such as Cartesia. A sentence is one request; when the service streams
	// tokens, a request is a token, so a change can take effect within a
	// sentence.
	DeliveryScopeSentence DeliveryScope = "sentence"
)

type ExpressionCapabilities

type ExpressionCapabilities struct {
	// Sounds are the sounds the service can make at one point, by its own
	// names.
	Sounds []ExpressionTerm
	// Delivery is the deliveries the service can apply to the words that
	// follow, by its own names.
	Delivery []ExpressionTerm
	// AllowsFreeTextSounds is whether the service also accepts sounds outside
	// Sounds, described in a few words.
	AllowsFreeTextSounds bool
	// AllowsFreeTextDelivery is whether the service also accepts deliveries
	// outside Delivery, described in a few words.
	AllowsFreeTextDelivery bool
	// PauseRangeMS is the shortest and longest pause the service can make, in
	// milliseconds, or nil when it can't pause.
	PauseRangeMS *[2]int
	// Emphasis is whether the service can stress words marked ^^word^^.
	Emphasis bool
	// DeliveryScope is where in a response the service can change delivery.
	// Empty is [DeliveryScopeAnywhere].
	DeliveryScope DeliveryScope
	// ServiceVocabulary is the names the service performs universal deliveries
	// and sounds by, best first, where they differ from the universal names,
	// such as {DeliveryWarm: {"content", "happy"}}. A universal name written in
	// a tag is sent by the first of these the service performs. A universal
	// name left out is performed by its own, when the service declares it or
	// accepts free text.
	ServiceVocabulary map[UniversalName][]string
}

ExpressionCapabilities is the expression tags a TTS service can perform.

The LLM is taught these by their universal names, and tags outside them are left out of the service's speech. A service that can laugh, speak in two moods, pause and stress words declares:

expressive.ExpressionCapabilities{
	Sounds: []expressive.ExpressionTerm{{Name: "laughs"}},
	Delivery: []expressive.ExpressionTerm{
		{Name: "warmly"},
		{Name: "calm", Description: "to reassure a worried caller"},
	},
	PauseRangeMS: &[2]int{100, 3000},
	Emphasis:     true,
	ServiceVocabulary: map[expressive.UniversalName][]string{
		expressive.SoundLaugh:   {"laughs"},
		expressive.DeliveryWarm: {"warmly"},
	},
}

func (*ExpressionCapabilities) DeliveryName

func (c *ExpressionCapabilities) DeliveryName(name string) (string, bool)

DeliveryName is the name the service performs a delivery by, and false when it can't.

A universal delivery is performed by its first name in ServiceVocabulary the service performs, else by its own; any other name by itself. The service performs a name it declares, or any name when it accepts free text. name is the delivery as written in its tag.

func (*ExpressionCapabilities) SoundName

func (c *ExpressionCapabilities) SoundName(name string) (string, bool)

SoundName is the name the service performs a sound by, and false when it can't. It is read as ExpressionCapabilities.DeliveryName reads a delivery.

type ExpressionDelivery

type ExpressionDelivery string

ExpressionDelivery is a delivery by its universal name, the same on every TTS service.

With ExpressionSound, these name everything the services with an expression adapter perform, each in one spelling, an adjective for a delivery. A tag that names one is sent by each service's own name for it (ExpressionCapabilities.ServiceVocabulary), and reported as written.

const (
	DeliveryAffectionate  ExpressionDelivery = "affectionate"
	DeliveryAgitated      ExpressionDelivery = "agitated"
	DeliveryAlarmed       ExpressionDelivery = "alarmed"
	DeliveryAmazed        ExpressionDelivery = "amazed"
	DeliveryAmused        ExpressionDelivery = "amused"
	DeliveryAngry         ExpressionDelivery = "angry"
	DeliveryAnnoyed       ExpressionDelivery = "annoyed"
	DeliveryAnticipating  ExpressionDelivery = "anticipating"
	DeliveryAnxious       ExpressionDelivery = "anxious"
	DeliveryApologetic    ExpressionDelivery = "apologetic"
	DeliveryAppalled      ExpressionDelivery = "appalled"
	DeliveryAshamed       ExpressionDelivery = "ashamed"
	DeliveryBored         ExpressionDelivery = "bored"
	DeliveryCalm          ExpressionDelivery = "calm"
	DeliveryCautious      ExpressionDelivery = "cautious"
	DeliveryCompassionate ExpressionDelivery = "compassionate"
	DeliveryConfident     ExpressionDelivery = "confident"
	DeliveryConfused      ExpressionDelivery = "confused"
	DeliveryContemplative ExpressionDelivery = "contemplative"
	DeliveryContemptuous  ExpressionDelivery = "contemptuous"
	DeliveryContent       ExpressionDelivery = "content"
	DeliveryCrying        ExpressionDelivery = "crying"
	DeliveryCurious       ExpressionDelivery = "curious"
	DeliveryCute          ExpressionDelivery = "cute"
	DeliveryDeadpan       ExpressionDelivery = "deadpan"
	DeliveryDejected      ExpressionDelivery = "dejected"
	DeliveryDelighted     ExpressionDelivery = "delighted"
	DeliveryDepressed     ExpressionDelivery = "depressed"
	DeliveryDesperate     ExpressionDelivery = "desperate"
	DeliveryDetermined    ExpressionDelivery = "determined"
	DeliveryDisappointed  ExpressionDelivery = "disappointed"
	DeliveryDisdainful    ExpressionDelivery = "disdainful"
	DeliveryDisgusted     ExpressionDelivery = "disgusted"
	DeliveryDismissive    ExpressionDelivery = "dismissive"
	DeliveryDistant       ExpressionDelivery = "distant"
	DeliveryDoubtful      ExpressionDelivery = "doubtful"
	DeliveryDramatic      ExpressionDelivery = "dramatic"
	DeliveryElated        ExpressionDelivery = "elated"
	DeliveryEmbarrassed   ExpressionDelivery = "embarrassed"
	DeliveryEmpathetic    ExpressionDelivery = "empathetic"
	DeliveryEncouraging   ExpressionDelivery = "encouraging"
	DeliveryEnthusiastic  ExpressionDelivery = "enthusiastic"
	DeliveryEnvious       ExpressionDelivery = "envious"
	DeliveryEuphoric      ExpressionDelivery = "euphoric"
	DeliveryExcited       ExpressionDelivery = "excited"
	DeliveryFast          ExpressionDelivery = "fast"
	DeliveryFearful       ExpressionDelivery = "fearful"
	DeliveryFlirtatious   ExpressionDelivery = "flirtatious"
	DeliveryFrustrated    ExpressionDelivery = "frustrated"
	DeliveryGrateful      ExpressionDelivery = "grateful"
	DeliveryGuilty        ExpressionDelivery = "guilty"
	DeliveryHappy         ExpressionDelivery = "happy"
	DeliveryHesitant      ExpressionDelivery = "hesitant"
	DeliveryHopeful       ExpressionDelivery = "hopeful"
	DeliveryHurt          ExpressionDelivery = "hurt"
	DeliveryHysterical    ExpressionDelivery = "hysterical"
	DeliveryImpressed     ExpressionDelivery = "impressed"
	DeliveryIndifferent   ExpressionDelivery = "indifferent"
	DeliveryInsecure      ExpressionDelivery = "insecure"
	DeliveryIronic        ExpressionDelivery = "ironic"
	DeliveryJealous       ExpressionDelivery = "jealous"
	DeliveryLonely        ExpressionDelivery = "lonely"
	DeliveryLoud          ExpressionDelivery = "loud"
	DeliveryMad           ExpressionDelivery = "mad"
	DeliveryMelancholic   ExpressionDelivery = "melancholic"
	DeliveryMischievous   ExpressionDelivery = "mischievous"
	DeliveryMocking       ExpressionDelivery = "mocking"
	DeliveryMoved         ExpressionDelivery = "moved"
	DeliveryMuttering     ExpressionDelivery = "muttering"
	DeliveryMysterious    ExpressionDelivery = "mysterious"
	DeliveryNervous       ExpressionDelivery = "nervous"
	DeliveryNostalgic     ExpressionDelivery = "nostalgic"
	DeliveryOptimistic    ExpressionDelivery = "optimistic"
	DeliveryOutraged      ExpressionDelivery = "outraged"
	DeliveryPanicked      ExpressionDelivery = "panicked"
	DeliveryPeaceful      ExpressionDelivery = "peaceful"
	DeliveryPessimistic   ExpressionDelivery = "pessimistic"
	DeliveryPlayful       ExpressionDelivery = "playful"
	DeliveryProfessional  ExpressionDelivery = "professional"
	DeliveryProud         ExpressionDelivery = "proud"
	DeliveryQuestioning   ExpressionDelivery = "questioning"
	DeliveryReassuring    ExpressionDelivery = "reassuring"
	DeliveryRegretful     ExpressionDelivery = "regretful"
	DeliveryRejected      ExpressionDelivery = "rejected"
	DeliveryRelaxed       ExpressionDelivery = "relaxed"
	DeliveryRelieved      ExpressionDelivery = "relieved"
	DeliveryResigned      ExpressionDelivery = "resigned"
	DeliverySad           ExpressionDelivery = "sad"
	DeliverySarcastic     ExpressionDelivery = "sarcastic"
	DeliverySatisfied     ExpressionDelivery = "satisfied"
	DeliveryScared        ExpressionDelivery = "scared"
	DeliveryScreaming     ExpressionDelivery = "screaming"
	DeliverySerene        ExpressionDelivery = "serene"
	DeliverySerious       ExpressionDelivery = "serious"
	DeliverySheepish      ExpressionDelivery = "sheepish"
	DeliveryShouting      ExpressionDelivery = "shouting"
	DeliverySincere       ExpressionDelivery = "sincere"
	DeliverySinging       ExpressionDelivery = "singing"
	DeliverySkeptical     ExpressionDelivery = "skeptical"
	DeliverySlow          ExpressionDelivery = "slow"
	DeliverySoft          ExpressionDelivery = "soft"
	DeliverySomber        ExpressionDelivery = "somber"
	DeliveryStern         ExpressionDelivery = "stern"
	DeliverySurprised     ExpressionDelivery = "surprised"
	DeliverySympathetic   ExpressionDelivery = "sympathetic"
	DeliveryThoughtful    ExpressionDelivery = "thoughtful"
	DeliveryThreatened    ExpressionDelivery = "threatened"
	DeliveryTired         ExpressionDelivery = "tired"
	DeliveryTriumphant    ExpressionDelivery = "triumphant"
	DeliveryTrusting      ExpressionDelivery = "trusting"
	DeliveryUncertain     ExpressionDelivery = "uncertain"
	DeliveryUnhappy       ExpressionDelivery = "unhappy"
	DeliveryUpset         ExpressionDelivery = "upset"
	DeliveryUrgent        ExpressionDelivery = "urgent"
	DeliveryWarm          ExpressionDelivery = "warm"
	DeliveryWhispering    ExpressionDelivery = "whispering"
	DeliveryWistful       ExpressionDelivery = "wistful"
	DeliveryWorried       ExpressionDelivery = "worried"
)

The universal deliveries.

func CoreDelivery

func CoreDelivery() []ExpressionDelivery

CoreDelivery is the universal deliveries an LLM is taught when its policy names none, and that a tone tagger writes.

func Deliveries

func Deliveries() []ExpressionDelivery

Deliveries is every universal delivery, in order.

func (ExpressionDelivery) String

func (d ExpressionDelivery) String() string

String implements UniversalName.

type ExpressionGuidance

type ExpressionGuidance string

ExpressionGuidance is a guidance preset for an ExpressionPolicy.

Each preset is a short paragraph on one aspect of delivery, written to combine with other presets and with the developer's own lines. Presets are about writing tags, so an LLM taught none, such as one whose replies a tagger marks up, is not given them.

const (
	// GuidanceMatchStyle answers in the user's mood and energy, but stays calm
	// with hostility.
	GuidanceMatchStyle ExpressionGuidance = "Let your voice match the user's mood and energy: " +
		"be excited for their good news, sympathetic with their bad news, and laugh when they " +
		"say something funny. If they are hostile, stay calm instead of matching it. Most " +
		"sentences need no tag."
	// GuidanceSlowForDetails says just what the user may need to write down
	// slowly, in a span. It is for a service that performs the slow delivery.
	GuidanceSlowForDetails ExpressionGuidance = "When you give the user something to write " +
		"down, such as a code, a phone number or an email address, say just that slowly: " +
		"Your code is <<slow: A B 7 4 9>>. Anything else?"
	// GuidanceBreathe takes an audible breath before a long or difficult
	// sentence now and then, at most once a reply. It is for a service that
	// performs a breath. A tagger reads it as a switch for breaths of its own
	// choosing.
	GuidanceBreathe ExpressionGuidance = "Now and then, take an audible breath before a " +
		"sentence that is long, carries hard news or starts a careful explanation, as a person " +
		"on the phone does. At most one breath a reply, and most replies need none: rarely " +
		"before a short or routine sentence, never by habit at the start of every reply, and " +
		"never right after another sound."
)

The guidance presets.

func (ExpressionGuidance) String

func (g ExpressionGuidance) String() string

String implements Guidance.

type ExpressionPolicy

type ExpressionPolicy struct {
	// Guidance is the lines on when and how much to express, such as
	// GuidanceMatchStyle or the developer's own. They are joined in order, so a
	// later line can refine an earlier one. The developer's lines reach the LLM
	// whenever it has a part to play in expressive conversation: tags to write,
	// or a reading of the user to act on. The presets are about writing tags, so
	// they go to whoever writes them: the LLM, or a tagger in its place.
	Guidance []Guidance
	// Delivery is the deliveries to offer, by their universal names, or nil for
	// the core ones ([CoreDelivery]). A name that is not universal, such as an
	// accent, is offered as written. Those the TTS service cannot perform are
	// left out, with a warning. An empty, non-nil list offers none.
	Delivery []ExpressionDelivery
	// Sounds is the sounds to offer, as Delivery offers deliveries. Nil offers
	// the core ones ([CoreSounds]), and a breath only with GuidanceBreathe.
	Sounds []ExpressionSound
}

ExpressionPolicy is which expression tags an LLM is offered, and when to use them.

expressive.ExpressionPolicy{
	Guidance: []expressive.Guidance{
		expressive.GuidanceMatchStyle,
		expressive.GuidanceLine("Never laugh while discussing billing."),
	},
	Delivery: []expressive.ExpressionDelivery{
		expressive.DeliveryCalm, expressive.DeliveryHappy, expressive.DeliverySympathetic,
	},
}

func (*ExpressionPolicy) Breathes

func (p *ExpressionPolicy) Breathes() bool

Breathes reports whether the policy's guidance asks for breaths, with GuidanceBreathe. A line of the developer's with that preset's text asks for them too.

type ExpressionSound

type ExpressionSound string

ExpressionSound is a sound by its universal name, the same on every TTS service. It is named as ExpressionDelivery names a delivery, in a base word, such as "laugh".

const (
	SoundBreath        ExpressionSound = "breath"
	SoundBurp          ExpressionSound = "burp"
	SoundCackle        ExpressionSound = "cackle"
	SoundChuckle       ExpressionSound = "chuckle"
	SoundClearThroat   ExpressionSound = "clear throat"
	SoundCough         ExpressionSound = "cough"
	SoundCry           ExpressionSound = "cry"
	SoundDeepBreath    ExpressionSound = "deep breath"
	SoundExhale        ExpressionSound = "exhale"
	SoundGasp          ExpressionSound = "gasp"
	SoundGiggle        ExpressionSound = "giggle"
	SoundGroan         ExpressionSound = "groan"
	SoundGrowl         ExpressionSound = "growl"
	SoundGrunt         ExpressionSound = "grunt"
	SoundGulp          ExpressionSound = "gulp"
	SoundHiccup        ExpressionSound = "hiccup"
	SoundHiss          ExpressionSound = "hiss"
	SoundHuff          ExpressionSound = "huff"
	SoundHum           ExpressionSound = "hum"
	SoundInhale        ExpressionSound = "inhale"
	SoundLaugh         ExpressionSound = "laugh"
	SoundLaughHarder   ExpressionSound = "laugh harder"
	SoundLightBreath   ExpressionSound = "light breath"
	SoundLipSmack      ExpressionSound = "lip smack"
	SoundMoan          ExpressionSound = "moan"
	SoundPant          ExpressionSound = "pant"
	SoundScoff         ExpressionSound = "scoff"
	SoundSharpExhale   ExpressionSound = "sharp exhale"
	SoundShriek        ExpressionSound = "shriek"
	SoundShush         ExpressionSound = "shush"
	SoundSigh          ExpressionSound = "sigh"
	SoundSneeze        ExpressionSound = "sneeze"
	SoundSniff         ExpressionSound = "sniff"
	SoundSniffle       ExpressionSound = "sniffle"
	SoundSnore         ExpressionSound = "snore"
	SoundSnort         ExpressionSound = "snort"
	SoundSob           ExpressionSound = "sob"
	SoundStartLaughing ExpressionSound = "start laughing"
	SoundSwallow       ExpressionSound = "swallow"
	SoundTongueClick   ExpressionSound = "tongue click"
	SoundUm            ExpressionSound = "um"
	SoundWheeze        ExpressionSound = "wheeze"
	SoundWhimper       ExpressionSound = "whimper"
	SoundWhistle       ExpressionSound = "whistle"
	SoundWoo           ExpressionSound = "woo"
	SoundYawn          ExpressionSound = "yawn"
)

The universal sounds.

func CoreSounds

func CoreSounds() []ExpressionSound

CoreSounds is the universal sounds an LLM is taught when its policy names none, and that a tone tagger writes.

func Sounds

func Sounds() []ExpressionSound

Sounds is every universal sound, in order.

func (ExpressionSound) String

func (s ExpressionSound) String() string

String implements UniversalName.

type ExpressionTerm

type ExpressionTerm struct {
	// Name is the name the service performs it by, such as "laughter" or
	// "cheerful".
	Name string
	// Description is a short line on when to use it, or empty.
	Description string
}

ExpressionTerm is one sound or delivery a TTS service can perform.

func SpeedDelivery

func SpeedDelivery() []ExpressionTerm

SpeedDelivery is slow and fast, as a service that performs them declares them.

type Guidance

type Guidance interface {
	// String is the line as written into the LLM's instruction.
	String() string
	// contains filtered or unexported methods
}

Guidance is one line of an ExpressionPolicy's guidance: a preset, an ExpressionGuidance, or a line of the developer's own, a GuidanceLine.

The two are told apart by their type, so a line of the developer's that has a preset's text stays the developer's line.

type GuidanceLine

type GuidanceLine string

GuidanceLine is a line of guidance of the developer's own, such as "Never laugh while discussing billing.".

func (GuidanceLine) String

func (g GuidanceLine) String() string

String implements Guidance.

type PerceptionCapabilities

type PerceptionCapabilities struct {
	// Signals is each signal the producer can report.
	Signals []PerceptionTerm
}

PerceptionCapabilities is the signals a perception producer reports.

func (PerceptionCapabilities) Merge added in v0.5.0

Merge merges another producer's signals into these, and returns the signals of both, these first. A signal both report keeps every label either can report and the first description that is not empty.

type PerceptionLabel

type PerceptionLabel struct {
	// Label is the label, such as "frustrated".
	Label string
	// Confidence is how sure the reading is, from 0 to 1.
	Confidence float64
}

PerceptionLabel is one label of a signal read as labels, with how sure the reading is, from 0 to 1.

type PerceptionSignal

type PerceptionSignal struct {
	// Name is what is read, such as "tone" or "speech_rate".
	Name string
	// Labels is the likeliest labels, likeliest first, each with how sure the
	// reading is, such as frustrated at 0.86 and neutral at 0.10. Empty for a
	// signal read as a value.
	Labels []PerceptionLabel
	// Value is the measure, for a signal read as a value, such as words per
	// second. Nil for a signal read as labels.
	Value *float64
}

PerceptionSignal is one reading of how the user spoke. A signal is read either as labels or as a value.

func MergePerception added in v0.5.0

func MergePerception(merged, reading []PerceptionSignal) []PerceptionSignal

MergePerception merges a reading into the readings of the same turn so far, keeping the higher of each, and returns the merged reading. merged is nil before the first.

A signal read as a value keeps its highest value. A signal read as labels keeps every label either reading has, each with its highest confidence, likeliest first. A signal only one of them has is kept as it is, and the signals stay in the order they were first read.

type PerceptionTerm

type PerceptionTerm struct {
	// Name is the signal's name, as in PerceptionSignal.Name.
	Name string
	// Description is a short line on how to read it, such as its unit or
	// range, or empty.
	Description string
	// Labels is the labels it can report, for a signal read as labels, or
	// empty for a signal read as a value.
	Labels []string
}

PerceptionTerm is one signal a perception producer reports.

type UniversalName

type UniversalName interface {
	// String is the name as written in a tag.
	String() string
	// contains filtered or unexported methods
}

UniversalName is a delivery or a sound by its universal name: an ExpressionDelivery or an ExpressionSound. It keys ExpressionCapabilities.ServiceVocabulary.

Directories

Path Synopsis
Package formatter reads the expression tags an LLM writes, and formats them for a TTS service.
Package formatter reads the expression tags an LLM writes, and formats them for a TTS service.
Package spoken tells the expression of the words a TTS service reports speaking.
Package spoken tells the expression of the words a TTS service reports speaking.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL