Skip to content

Commit 6380b56

Browse files
authored
Merge pull request #534 from deepgram/fix/agent-language-fix
fix: correct the language property location and type
2 parents 9baa12d + 19248f4 commit 6380b56

File tree

4 files changed

+5
-19
lines changed

4 files changed

+5
-19
lines changed

deepgram/clients/agent/v1/websocket/options.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,6 @@ def __getitem__(self, key):
211211
if "voice" in _dict and isinstance(_dict["voice"], dict):
212212
_dict["voice"] = CartesiaVoice.from_dict(_dict["voice"])
213213
return _dict[key]
214-
215-
216214
@dataclass
217215
class Think(BaseResponse):
218216
"""
@@ -284,6 +282,7 @@ class Agent(BaseResponse):
284282
This class defines any configuration settings for the Agent model.
285283
"""
286284

285+
language: str = field(default="en")
287286
listen: Listen = field(default_factory=Listen)
288287
think: Think = field(default_factory=Think)
289288
speak: Speak = field(default_factory=Speak)
@@ -300,8 +299,6 @@ def __getitem__(self, key):
300299
if "speak" in _dict and isinstance(_dict["speak"], dict):
301300
_dict["speak"] = Speak.from_dict(_dict["speak"])
302301
return _dict[key]
303-
304-
305302
@dataclass
306303
class Input(BaseResponse):
307304
"""
@@ -343,16 +340,6 @@ def __getitem__(self, key):
343340
_dict["output"] = Output.from_dict(_dict["output"])
344341
return _dict[key]
345342

346-
347-
@dataclass
348-
class Language(BaseResponse):
349-
"""
350-
Define the language for the agent.
351-
"""
352-
353-
type: str = field(default="en")
354-
355-
356343
@dataclass
357344
class SettingsOptions(BaseResponse):
358345
"""
@@ -370,7 +357,6 @@ def __getitem__(self, key):
370357
_dict["audio"] = Audio.from_dict(_dict["audio"])
371358
if "agent" in _dict and isinstance(_dict["agent"], dict):
372359
_dict["agent"] = Agent.from_dict(_dict["agent"])
373-
return _dict[key]
374360

375361
def check(self):
376362
"""

examples/agent/async_simple/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ async def on_unhandled(self, unhandled, **kwargs):
114114
options.agent.listen.provider.keyterms = ["hello", "goodbye"]
115115
options.agent.listen.provider.model = "nova-3"
116116
options.agent.listen.provider.type = "deepgram"
117-
options.language = "en"
117+
options.agent.language = "en"
118118

119119

120120
print("\n\nPress Enter to stop...\n\n")

examples/agent/no_mic/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def main():
5151
# Agent configuration
5252
options.agent.language = "en"
5353
options.agent.listen.provider.type = "deepgram"
54-
options.agent.listen.model = "nova-3"
54+
options.agent.listen.provider.model = "nova-3"
5555
options.agent.think.provider.type = "open_ai"
56-
options.agent.think.model = "gpt-4o-mini"
56+
options.agent.think.provider.model = "gpt-4o-mini"
5757
options.agent.think.prompt = "You are a friendly AI assistant."
5858
options.agent.speak.provider.type = "deepgram"
5959
options.agent.speak.model = "aura-2-thalia-en"

examples/agent/simple/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def on_unhandled(self, unhandled, **kwargs):
138138
options.agent.listen.provider.keyterms = ["hello", "goodbye"]
139139
options.agent.listen.provider.model = "nova-3"
140140
options.agent.listen.provider.type = "deepgram"
141-
options.language = "en"
141+
options.agent.language = "en"
142142
if dg_connection.start(options) is False:
143143
print("Failed to start connection")
144144
return

0 commit comments

Comments
 (0)