zach commited on
Commit
a3fdb3c
Β·
1 Parent(s): e9bcee8

Clean up documentation, remove orphaned utility, create constants file to store constants

Browse files
src/config.py CHANGED
@@ -7,10 +7,6 @@ constants and settings, such as the logging configuration and API constraints.
7
  Key Features:
8
  - Configures the logger for consistent logging across all modules.
9
  - Dynamically sets the logging level based on the DEBUG environment variable.
10
- - Provides constants for shared constraints like maximum prompt length.
11
-
12
- Constants:
13
- - DEBUG: Indicates whether debug mode is enabled.
14
  """
15
 
16
  # Standard Library Imports
@@ -39,17 +35,5 @@ logging.basicConfig(
39
  logger: logging.Logger = logging.getLogger('tts_arena')
40
  logger.info(f'Debug mode is {"enabled" if DEBUG else "disabled"}.')
41
 
42
-
43
- # Log environment variables
44
- def log_env_variable(var_name: str, value: str) -> None:
45
- """
46
- Logs the value of an environment variable for debugging purposes.
47
-
48
- Args:
49
- var_name (str): The name of the environment variable.
50
- value (str): The value of the environment variable.
51
- """
52
- logger.debug(f'Environment variable "{var_name}" validated with value: {value}')
53
-
54
  if DEBUG:
55
  logger.debug(f'DEBUG mode enabled.')
 
7
  Key Features:
8
  - Configures the logger for consistent logging across all modules.
9
  - Dynamically sets the logging level based on the DEBUG environment variable.
 
 
 
 
10
  """
11
 
12
  # Standard Library Imports
 
35
  logger: logging.Logger = logging.getLogger('tts_arena')
36
  logger.info(f'Debug mode is {"enabled" if DEBUG else "disabled"}.')
37
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  if DEBUG:
39
  logger.debug(f'DEBUG mode enabled.')
src/{sample_prompts.py β†’ constants.py} RENAMED
@@ -1,10 +1,14 @@
1
  """
2
- sample_prompts.py
3
 
4
- This file contains predefined sample prompts to showcase the expressiveness of TTS models.
5
- These prompts are structured to highlight different aspects of emotional tone, pacing, and rhythm.
6
  """
7
 
 
 
 
 
 
8
  SAMPLE_PROMPTS = {
9
  'πŸš€ Dramatic Monologue (Stranded Astronaut)':
10
  'Write a short dramatic monologue from a lone astronaut stranded on Mars, '
 
1
  """
2
+ constants.py
3
 
4
+ This module defines global constants used throughout the project.
 
5
  """
6
 
7
+ # Minimum and maximum prompt length constraints
8
+ PROMPT_MIN_LENGTH: int = 10
9
+ PROMPT_MAX_LENGTH: int = 300
10
+
11
+ # A collection of pre-defined prompts categorized by theme, used to provide users with inspiration for generating creative text.
12
  SAMPLE_PROMPTS = {
13
  'πŸš€ Dramatic Monologue (Stranded Astronaut)':
14
  'Write a short dramatic monologue from a lone astronaut stranded on Mars, '
src/integrations/anthropic_api.py CHANGED
@@ -12,8 +12,8 @@ Key Features:
12
  - Provides detailed logging for debugging and error tracking.
13
 
14
  Classes:
 
15
  - AnthropicError: Custom exception for Anthropic API-related errors.
16
- - SystemPrompt: Frozen dataclass for storing the system prompt, ensuring immutability.
17
 
18
  Functions:
19
  - generate_text_with_claude: Generates text using the Anthropic SDK with input validation and retry logic.
@@ -40,7 +40,7 @@ class AnthropicConfig:
40
  """
41
  api_key: str = validate_env_var('ANTHROPIC_API_KEY')
42
  model: ModelParam = 'claude-3-5-sonnet-latest' # Valid predefined model
43
- max_tokens: int = 300 # Max tokens for API response
44
  system_prompt: str = """You are a highly creative and articulate assistant specialized in generating vivid, engaging, and well-written content.
45
 
46
  Your task is to respond to user prompts by creating:
 
12
  - Provides detailed logging for debugging and error tracking.
13
 
14
  Classes:
15
+ - AnthropicConfig: Immutable configuration for interacting with the TTS API.
16
  - AnthropicError: Custom exception for Anthropic API-related errors.
 
17
 
18
  Functions:
19
  - generate_text_with_claude: Generates text using the Anthropic SDK with input validation and retry logic.
 
40
  """
41
  api_key: str = validate_env_var('ANTHROPIC_API_KEY')
42
  model: ModelParam = 'claude-3-5-sonnet-latest' # Valid predefined model
43
+ max_tokens: int = 256 # Max tokens for API response
44
  system_prompt: str = """You are a highly creative and articulate assistant specialized in generating vivid, engaging, and well-written content.
45
 
46
  Your task is to respond to user prompts by creating:
src/integrations/elevenlabs_api.py CHANGED
@@ -11,8 +11,8 @@ Key Features:
11
  - Provides detailed logging for debugging and error tracking.
12
 
13
  Classes:
14
- - ElevenLabsException: Custom exception for TTS API-related errors.
15
  - ElevenLabsConfig: Immutable configuration for interacting with the TTS API.
 
16
 
17
  Functions:
18
  - text_to_speech_with_elevenlabs: Converts text to speech using the ElevenLabs TTS API.
 
11
  - Provides detailed logging for debugging and error tracking.
12
 
13
  Classes:
 
14
  - ElevenLabsConfig: Immutable configuration for interacting with the TTS API.
15
+ - ElevenLabsException: Custom exception for TTS API-related errors.
16
 
17
  Functions:
18
  - text_to_speech_with_elevenlabs: Converts text to speech using the ElevenLabs TTS API.
src/integrations/hume_api.py CHANGED
@@ -11,8 +11,8 @@ Key Features:
11
  - Provides detailed logging for debugging and error tracking.
12
 
13
  Classes:
14
- - HumeException: Custom exception for TTS API-related errors.
15
  - HumeConfig: Immutable configuration for interacting with the TTS API.
 
16
 
17
  Functions:
18
  - text_to_speech_with_hume: Converts text to speech using the Hume TTS API with input validation and retry logic.
 
11
  - Provides detailed logging for debugging and error tracking.
12
 
13
  Classes:
 
14
  - HumeConfig: Immutable configuration for interacting with the TTS API.
15
+ - HumeException: Custom exception for TTS API-related errors.
16
 
17
  Functions:
18
  - text_to_speech_with_hume: Converts text to speech using the Hume TTS API with input validation and retry logic.