Skip to content

Commit 5945c56

Browse files
authored
Merge pull request #520 from deepgram/feat/agent-v1
feat: support for agent v1
2 parents e48e415 + 8e066ce commit 5945c56

File tree

18 files changed

+553
-216
lines changed

18 files changed

+553
-216
lines changed

.github/CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,18 @@ Here are a few types of contributions that we would be interested in hearing abo
4848
## Making Code Contributions
4949

5050
for those interested in contributing code to the project, please review the [Code Contribution Guide](https://github.com/deepgram/deepgram-python-sdk/blob/main/.github/CODE_CONTRIBUTIONS_GUIDE.md) for more details.
51+
52+
## Building Locally
53+
54+
Assuming you are using `pipenv`:
55+
56+
```bash
57+
# Install deps
58+
pipenv install
59+
# Build package
60+
pipenv run python3 -m build
61+
# Install package from local build
62+
pipenv install ./dist/deepgram_sdk-0.0.0.tar.gz
63+
# Try an example!
64+
DEEPGRAM_API_KEY=<key> pipenv run python3 examples/agent/async_simple/main.py
65+
```

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ dist/
2121
build/
2222
poetry.lock
2323

24+
# examples
25+
chatlog.txt
26+
output_*.wav

deepgram/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@
324324
ConversationTextResponse,
325325
UserStartedSpeakingResponse,
326326
AgentThinkingResponse,
327-
FunctionCalling,
328327
FunctionCallRequest,
329328
AgentStartedSpeakingResponse,
330329
AgentAudioDoneResponse,
@@ -333,27 +332,29 @@
333332

334333
from .client import (
335334
# top level
336-
SettingsConfigurationOptions,
337-
UpdateInstructionsOptions,
335+
SettingsOptions,
336+
UpdatePromptOptions,
338337
UpdateSpeakOptions,
339338
InjectAgentMessageOptions,
340339
FunctionCallResponse,
341340
AgentKeepAlive,
342341
# sub level
343342
Listen,
343+
ListenProvider,
344344
Speak,
345+
SpeakProvider,
345346
Header,
346347
Item,
347348
Properties,
348349
Parameters,
349350
Function,
350-
Provider,
351351
Think,
352+
ThinkProvider,
352353
Agent,
353354
Input,
354355
Output,
355356
Audio,
356-
Context,
357+
Endpoint,
357358
)
358359

359360
# utilities

deepgram/client.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@
338338
ConversationTextResponse,
339339
UserStartedSpeakingResponse,
340340
AgentThinkingResponse,
341-
FunctionCalling,
342341
FunctionCallRequest,
343342
AgentStartedSpeakingResponse,
344343
AgentAudioDoneResponse,
@@ -347,27 +346,29 @@
347346

348347
from .clients import (
349348
# top level
350-
SettingsConfigurationOptions,
351-
UpdateInstructionsOptions,
349+
SettingsOptions,
350+
UpdatePromptOptions,
352351
UpdateSpeakOptions,
353352
InjectAgentMessageOptions,
354353
FunctionCallResponse,
355354
AgentKeepAlive,
356355
# sub level
357356
Listen,
357+
ListenProvider,
358358
Speak,
359+
SpeakProvider,
359360
Header,
360361
Item,
361362
Properties,
362363
Parameters,
363364
Function,
364-
Provider,
365365
Think,
366+
ThinkProvider,
366367
Agent,
367368
Input,
368369
Output,
369370
Audio,
370-
Context,
371+
Endpoint,
371372
)
372373

373374

deepgram/clients/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,6 @@
347347
ConversationTextResponse,
348348
UserStartedSpeakingResponse,
349349
AgentThinkingResponse,
350-
FunctionCalling,
351350
FunctionCallRequest,
352351
AgentStartedSpeakingResponse,
353352
AgentAudioDoneResponse,
@@ -356,25 +355,27 @@
356355

357356
from .agent import (
358357
# top level
359-
SettingsConfigurationOptions,
360-
UpdateInstructionsOptions,
358+
SettingsOptions,
359+
UpdatePromptOptions,
361360
UpdateSpeakOptions,
362361
InjectAgentMessageOptions,
363362
FunctionCallResponse,
364363
AgentKeepAlive,
365364
# sub level
366365
Listen,
366+
ListenProvider,
367367
Speak,
368+
SpeakProvider,
368369
Header,
369370
Item,
370371
Properties,
371372
Parameters,
372373
Function,
373-
Provider,
374374
Think,
375+
ThinkProvider,
375376
Agent,
376377
Input,
377378
Output,
378379
Audio,
379-
Context,
380+
Endpoint,
380381
)

deepgram/clients/agent/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
ConversationTextResponse,
2323
UserStartedSpeakingResponse,
2424
AgentThinkingResponse,
25-
FunctionCalling,
2625
FunctionCallRequest,
2726
AgentStartedSpeakingResponse,
2827
AgentAudioDoneResponse,
@@ -31,25 +30,27 @@
3130

3231
from .client import (
3332
# top level
34-
SettingsConfigurationOptions,
35-
UpdateInstructionsOptions,
33+
SettingsOptions,
34+
UpdatePromptOptions,
3635
UpdateSpeakOptions,
3736
InjectAgentMessageOptions,
3837
FunctionCallResponse,
3938
AgentKeepAlive,
4039
# sub level
4140
Listen,
41+
ListenProvider,
4242
Speak,
43+
SpeakProvider,
4344
Header,
4445
Item,
4546
Properties,
4647
Parameters,
4748
Function,
48-
Provider,
4949
Think,
50+
ThinkProvider,
5051
Agent,
5152
Input,
5253
Output,
5354
Audio,
54-
Context,
55+
Endpoint,
5556
)

deepgram/clients/agent/client.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
ConversationTextResponse as LatestConversationTextResponse,
2222
UserStartedSpeakingResponse as LatestUserStartedSpeakingResponse,
2323
AgentThinkingResponse as LatestAgentThinkingResponse,
24-
FunctionCalling as LatestFunctionCalling,
2524
FunctionCallRequest as LatestFunctionCallRequest,
2625
AgentStartedSpeakingResponse as LatestAgentStartedSpeakingResponse,
2726
AgentAudioDoneResponse as LatestAgentAudioDoneResponse,
@@ -30,27 +29,29 @@
3029

3130
from .v1 import (
3231
# top level
33-
SettingsConfigurationOptions as LatestSettingsConfigurationOptions,
34-
UpdateInstructionsOptions as LatestUpdateInstructionsOptions,
32+
SettingsOptions as LatestSettingsOptions,
33+
UpdatePromptOptions as LatestUpdatePromptOptions,
3534
UpdateSpeakOptions as LatestUpdateSpeakOptions,
3635
InjectAgentMessageOptions as LatestInjectAgentMessageOptions,
3736
FunctionCallResponse as LatestFunctionCallResponse,
3837
AgentKeepAlive as LatestAgentKeepAlive,
3938
# sub level
4039
Listen as LatestListen,
40+
ListenProvider as LatestListenProvider,
4141
Speak as LatestSpeak,
42+
SpeakProvider as LatestSpeakProvider,
4243
Header as LatestHeader,
4344
Item as LatestItem,
4445
Properties as LatestProperties,
4546
Parameters as LatestParameters,
4647
Function as LatestFunction,
47-
Provider as LatestProvider,
4848
Think as LatestThink,
49+
ThinkProvider as LatestThinkProvider,
4950
Agent as LatestAgent,
5051
Input as LatestInput,
5152
Output as LatestOutput,
5253
Audio as LatestAudio,
53-
Context as LatestContext,
54+
Endpoint as LatestEndpoint,
5455
)
5556

5657

@@ -70,31 +71,32 @@
7071
ConversationTextResponse = LatestConversationTextResponse
7172
UserStartedSpeakingResponse = LatestUserStartedSpeakingResponse
7273
AgentThinkingResponse = LatestAgentThinkingResponse
73-
FunctionCalling = LatestFunctionCalling
7474
FunctionCallRequest = LatestFunctionCallRequest
7575
AgentStartedSpeakingResponse = LatestAgentStartedSpeakingResponse
7676
AgentAudioDoneResponse = LatestAgentAudioDoneResponse
7777
InjectionRefusedResponse = LatestInjectionRefusedResponse
7878

7979

80-
SettingsConfigurationOptions = LatestSettingsConfigurationOptions
81-
UpdateInstructionsOptions = LatestUpdateInstructionsOptions
80+
SettingsOptions = LatestSettingsOptions
81+
UpdatePromptOptions = LatestUpdatePromptOptions
8282
UpdateSpeakOptions = LatestUpdateSpeakOptions
8383
InjectAgentMessageOptions = LatestInjectAgentMessageOptions
8484
FunctionCallResponse = LatestFunctionCallResponse
8585
AgentKeepAlive = LatestAgentKeepAlive
8686

8787
Listen = LatestListen
88+
ListenProvider = LatestListenProvider
8889
Speak = LatestSpeak
90+
SpeakProvider = LatestSpeakProvider
8991
Header = LatestHeader
9092
Item = LatestItem
9193
Properties = LatestProperties
9294
Parameters = LatestParameters
9395
Function = LatestFunction
94-
Provider = LatestProvider
9596
Think = LatestThink
97+
ThinkProvider = LatestThinkProvider
9698
Agent = LatestAgent
9799
Input = LatestInput
98100
Output = LatestOutput
99101
Audio = LatestAudio
100-
Context = LatestContext
102+
Endpoint = LatestEndpoint

deepgram/clients/agent/enums.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,15 @@ class AgentWebSocketEvents(StrEnum):
2121
ConversationText: str = "ConversationText"
2222
UserStartedSpeaking: str = "UserStartedSpeaking"
2323
AgentThinking: str = "AgentThinking"
24-
FunctionCalling: str = "FunctionCalling"
2524
FunctionCallRequest: str = "FunctionCallRequest"
2625
AgentStartedSpeaking: str = "AgentStartedSpeaking"
2726
AgentAudioDone: str = "AgentAudioDone"
2827
Error: str = "Error"
2928
Unhandled: str = "Unhandled"
3029

3130
# client
32-
SettingsConfiguration: str = "SettingsConfiguration"
33-
UpdateInstructions: str = "UpdateInstructions"
31+
Settings: str = "Settings"
32+
UpdatePrompt: str = "UpdatePrompt"
3433
UpdateSpeak: str = "UpdateSpeak"
3534
InjectAgentMessage: str = "InjectAgentMessage"
3635
InjectionRefused: str = "InjectionRefused"

deepgram/clients/agent/v1/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
ConversationTextResponse,
2727
UserStartedSpeakingResponse,
2828
AgentThinkingResponse,
29-
FunctionCalling,
3029
FunctionCallRequest,
3130
AgentStartedSpeakingResponse,
3231
AgentAudioDoneResponse,
@@ -35,25 +34,27 @@
3534

3635
from .websocket import (
3736
# top level
38-
SettingsConfigurationOptions,
39-
UpdateInstructionsOptions,
37+
SettingsOptions,
38+
UpdatePromptOptions,
4039
UpdateSpeakOptions,
4140
InjectAgentMessageOptions,
4241
FunctionCallResponse,
4342
AgentKeepAlive,
4443
# sub level
4544
Listen,
45+
ListenProvider,
4646
Speak,
47+
SpeakProvider,
4748
Header,
4849
Item,
4950
Properties,
5051
Parameters,
5152
Function,
52-
Provider,
5353
Think,
54+
ThinkProvider,
5455
Agent,
5556
Input,
5657
Output,
5758
Audio,
58-
Context,
59+
Endpoint,
5960
)

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,34 @@
1818
ConversationTextResponse,
1919
UserStartedSpeakingResponse,
2020
AgentThinkingResponse,
21-
FunctionCalling,
2221
FunctionCallRequest,
2322
AgentStartedSpeakingResponse,
2423
AgentAudioDoneResponse,
2524
InjectionRefusedResponse,
2625
)
2726
from .options import (
2827
# top level
29-
SettingsConfigurationOptions,
30-
UpdateInstructionsOptions,
28+
SettingsOptions,
29+
UpdatePromptOptions,
3130
UpdateSpeakOptions,
3231
InjectAgentMessageOptions,
3332
FunctionCallResponse,
3433
AgentKeepAlive,
3534
# sub level
3635
Listen,
36+
ListenProvider,
3737
Speak,
38+
SpeakProvider,
3839
Header,
3940
Item,
4041
Properties,
4142
Parameters,
4243
Function,
43-
Provider,
4444
Think,
45+
ThinkProvider,
4546
Agent,
4647
Input,
4748
Output,
4849
Audio,
49-
Context,
50+
Endpoint,
5051
)

0 commit comments

Comments
 (0)