You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-services/speech-service/how-to-bring-your-own-model.md
+71-9Lines changed: 71 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,16 +67,77 @@ Get the `<your-model-deployment>` value from the AI Foundry portal. It correspon
67
67
68
68
#### [Python SDK](#tab/sdk)
69
69
70
-
When using the Voice live Python SDK, configure the query parameter:
70
+
Use the [Python SDK quickstart code](/azure/ai-services/speech-service/voice-live-quickstart?tabs=windows%2Ckeyless&pivots=programming-language-python) to start a voice conversation, and make the following changes to enable BYOM:
71
71
72
-
```json
73
-
{
74
-
"profile": "<your-byom-mode>"
75
-
}
76
-
```
72
+
1. In the `parse_arguments()` function, add a new argument for the BYOM profile type:
For a complete implementation example, refer to the sample code below. Get the model value from the AI Foundry portal. It corresponds to the name you gave the model at deployment time.
112
+
asyncdefstart(self):
113
+
"""Start the voice assistant session."""
114
+
try:
115
+
logger.info(f"Connecting to VoiceLive API with model {self.model}")
79
116
117
+
# Connect to VoiceLive WebSocket API
118
+
asyncwith connect(
119
+
endpoint=self.endpoint,
120
+
credential=self.credential,
121
+
model=self.model,
122
+
connection_options={
123
+
"max_msg_size": 10*1024*1024,
124
+
"heartbeat": 20,
125
+
"timeout": 20,
126
+
},
127
+
query={
128
+
"profile": self.byom
129
+
} ifself.byom elseNone
130
+
) as connection:
131
+
...
132
+
```
133
+
1. When you run the code, specify the `--byom` argument along with the `--model` argument to indicate the BYOM profile and model deployment you want to use. For example:
0 commit comments