File size: 1,849 Bytes
db2bd16
 
 
701fd0f
db2bd16
 
e98b5e2
ba3994f
db2bd16
 
7f25817
db2bd16
 
 
701fd0f
 
 
 
d1ed6b1
db2bd16
 
 
7f25817
701fd0f
 
 
ba3994f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
701fd0f
 
 
5bf19b3
701fd0f
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
types.py

This module defines custom types for the application.
"""

# Standard Library Imports
from typing import Dict, Literal, NamedTuple, TypedDict


TTSProviderName = Literal["Hume AI", "ElevenLabs"]
"""TTSProviderName represents the allowed provider names for TTS services."""


ComparisonType = Literal["Hume AI - Hume AI", "Hume AI - ElevenLabs"]
"""Comparison type denoting which providers are compared."""


OptionKey = Literal["Option A", "Option B"]
"""OptionKey is restricted to the literal values 'Option A' or 'Option B'."""


OptionMap = Dict[OptionKey, TTSProviderName]
"""OptionMap defines the structure of the options mapping, where each key is an OptionKey and the value is a TTS provider."""


class Option(NamedTuple):
    """
    Represents a text-to-speech generation option.

    This type encapsulates the details for a generated text-to-speech (TTS) option,
    including the provider that produced the audio, the relative file path to the generated
    audio file, and the unique generation identifier associated with the TTS output.

    Attributes:
        provider (TTSProviderName): The TTS provider that generated the audio.
        audio (str): The relative file path to the audio file produced by the TTS provider.
        generation_id (str): The unique identifier for this TTS generation.
    """

    provider: TTSProviderName
    audio: str
    generation_id: str


class VotingResults(TypedDict):
    """Voting results data structure representing values we want to persist to the votes DB"""

    comparison_type: ComparisonType
    winning_provider: TTSProviderName
    winning_option: OptionKey
    option_a_provider: TTSProviderName
    option_b_provider: TTSProviderName
    option_a_generation_id: str
    option_b_generation_id: str
    voice_description: str
    text: str
    is_custom_text: bool