File tree Expand file tree Collapse file tree 7 files changed +22
-8
lines changed Expand file tree Collapse file tree 7 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
4
4
5
5
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) .
6
6
7
+ ## [ 0.1.2] - 2025-03-28
8
+
9
+ ### Changed
10
+
11
+ - Removed ` choices ` from ` --assistant ` cli argument to support arbitrary strings
12
+ - Implemented case-insensitive lookup for predefined template names
13
+
7
14
## [ 0.1.1] - 2025-03-26
8
15
9
16
### Changed
Original file line number Diff line number Diff line change 1
- 0.1.1
1
+ 0.1.2
Original file line number Diff line number Diff line change 26
26
PlaybackSettings ,
27
27
DebugMode ,
28
28
)
29
- from speechmatics_flow .templates import TemplateOptions
29
+ from speechmatics_flow .templates import TEMPLATE_NAME_TO_ID
30
30
31
31
LOGGER = logging .getLogger (__name__ )
32
32
@@ -116,7 +116,7 @@ def get_conversation_config(
116
116
117
117
# Command line arguments override values from config file
118
118
if assistant := args .get ("assistant" ):
119
- config ["template_id" ] = TemplateOptions .get (assistant )
119
+ config ["template_id" ] = TEMPLATE_NAME_TO_ID .get (assistant . lower (), assistant )
120
120
121
121
return ConversationConfig (** config )
122
122
Original file line number Diff line number Diff line change 5
5
import argparse
6
6
import logging
7
7
8
- from speechmatics_flow .templates import TemplateOptions
9
-
10
8
LOGGER = logging .getLogger (__name__ )
11
9
12
10
@@ -150,7 +148,6 @@ def get_arg_parser():
150
148
"--assistant" ,
151
149
default = None ,
152
150
type = str ,
153
- choices = [k for k in TemplateOptions .keys ()],
154
151
help = "Choose your assistant." ,
155
152
)
156
153
parser .add_argument (
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ class ConnectionSettings:
79
79
class ConversationConfig :
80
80
"""Defines configuration parameters for conversation requests."""
81
81
82
- template_id : TemplateID = "default"
82
+ template_id : Union [ TemplateID , str ] = "default"
83
83
"""Name of a predefined template."""
84
84
85
85
template_variables : Optional [Dict [str , str ]] = None
Original file line number Diff line number Diff line change @@ -17,4 +17,4 @@ class Template(Enum):
17
17
]
18
18
19
19
# Map user-friendly name to full TemplateID
20
- TemplateOptions = {t .name : t .value for t in Template }
20
+ TEMPLATE_NAME_TO_ID = {member .name . lower (): member .value for member in Template }
Original file line number Diff line number Diff line change 23
23
{"template_id" : Template .amelia .value },
24
24
id = "assistant amelia" ,
25
25
),
26
+ param (
27
+ ["--assistant=AMELIA" ],
28
+ {"template_id" : Template .amelia .value },
29
+ id = "assistant AMELIA" ,
30
+ ),
26
31
param (
27
32
["--assistant=humphrey" ],
28
33
{"template_id" : Template .humphrey .value },
29
34
id = "assistant humphrey" ,
30
35
),
36
+ param (
37
+ ["--assistant=demo-assistant" ],
38
+ {"template_id" : "demo-assistant" },
39
+ id = "assistant demo" ,
40
+ ),
31
41
param (
32
42
["--config-file=tests/data/conversation_config.json" ],
33
43
{
You can’t perform that action at this time.
0 commit comments