events#

None

class voice_stream.events.AnsweringMachineDetection(*, event_name: str = 'amd', call_id: str, answered_by: str, time_since_start: float)#

Bases: BaseEvent

Indicates that an answering machine has been detected on a telephone call.

answered_by: str#

Who took the call - ‘machine’ or ‘human’.

call_id: str#

The unique identifier for the call.

event_name: str#

Always ‘amd’.

is_human()#

Check if the response was answered by a human.

Returns:

True if the response was answered by a human, False otherwise.

Return type:

bool

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'answered_by': FieldInfo(annotation=str, required=True), 'call_id': FieldInfo(annotation=str, required=True), 'event_name': FieldInfo(annotation=str, required=False, default='amd'), 'time_since_start': FieldInfo(annotation=float, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

time_since_start: float#

Time since the start of the call.

class voice_stream.events.BaseEvent(*, event_name: str)#

Bases: BaseModel

Base class for structured objects used in streams.

event_name: str#

The name of the event.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'event_name': FieldInfo(annotation=str, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class voice_stream.events.CallEnded(*, event_name: str = 'call_ended')#

Bases: BaseEvent

Indicates that a telephone call has ended.

event_name: str#

Always ‘call_ended’.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'event_name': FieldInfo(annotation=str, required=False, default='call_ended')}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class voice_stream.events.CallStarted(*, event_name: str = 'call_started', call_id: str, stream_id: str | None = None)#

Bases: BaseEvent

Indicates that a new telephone call has been started.

call_id: str#

The unique identifier for the call.

event_name: str#

Always ‘call_started’.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'call_id': FieldInfo(annotation=str, required=True), 'event_name': FieldInfo(annotation=str, required=False, default='call_started'), 'stream_id': FieldInfo(annotation=Union[str, NoneType], required=False)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

stream_id: str | None#

The unique identifier for the audio stream associated with this call.

class voice_stream.events.SpeechEnd(*, event_name: str = 'speech_end', time_since_start: float)#

Bases: BaseEvent

Indicates that the end of speech has been detected in the incoming audio.

event_name: str#

Always ‘speech_end’

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'event_name': FieldInfo(annotation=str, required=False, default='speech_end'), 'time_since_start': FieldInfo(annotation=float, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

time_since_start: float#

The time when the speech ends (in seconds) relative to the start of the audio.

class voice_stream.events.SpeechPartialResult(*, event_name: str = 'speech_end', text: str, time_since_start: float)#

Bases: BaseEvent

Provides partial results from a speech recognizer.

event_name: str#

Always ‘speech_partial_result’

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'event_name': FieldInfo(annotation=str, required=False, default='speech_end'), 'text': FieldInfo(annotation=str, required=True), 'time_since_start': FieldInfo(annotation=float, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

text: str#

Partial text returned.

time_since_start: float#

The time when the speech ends (in seconds) relative to the start of the audio.

class voice_stream.events.SpeechStart(*, event_name: str = 'speech_start', time_since_start: float)#

Bases: BaseEvent

Indicates that speech has been detected in the incoming audio.

event_name: str#

Always ‘speech_start’.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'event_name': FieldInfo(annotation=str, required=False, default='speech_start'), 'time_since_start': FieldInfo(annotation=float, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

time_since_start: float#

The time when the speech starts (in seconds) relative to the start of the audio.

class voice_stream.events.TimedText(*, event_name: str = 'timed_text', text: str, duration_in_seconds: float)#

Bases: BaseEvent

Represents text synchronized to an audio stream. Used for rate-limited output of TextToSpeech.

duration_in_seconds: float#

The duration of the audio associated with this text.

event_name: str#

Always ‘timed_text’.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'duration_in_seconds': FieldInfo(annotation=float, required=True), 'event_name': FieldInfo(annotation=str, required=False, default='timed_text'), 'text': FieldInfo(annotation=str, required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

text: str#

The text