Skip to content

Commit 690a74a

Browse files
committed
chore: update examples for AgentV1SettingsAgent restructure
The 2026-05-05 regen turned AgentV1SettingsAgent into a discriminated union (.of(AgentV1SettingsAgentContext)) and moved think/speak/listen/greeting into the new AgentV1SettingsAgentContext submodel, with renamed inner types (AgentV1SettingsAgentContextThink etc.). Update the four affected examples — InjectMessage, VoiceAgent, CustomProviders, ProviderCombinations — to use the new shape. Also update AGENTS.md to make the post-regen verify step run `./gradlew test compileExamples`. `test` alone misses the examples/ directory; only the README snippet test catches the equivalent break in the README, so without compileExamples the regen review can pass while hand-maintained example files still won't compile against the new API.
1 parent 8fc2a3e commit 690a74a

5 files changed

Lines changed: 37 additions & 31 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,5 @@ The `.bak` files are our manually patched versions protected by `.fernignore`. T
7070
3. In `.fernignore`, replace each `.bak` path back to the original path for files that still need patches.
7171
4. Remove `.fernignore` entries entirely for any files where the generator now produces correct output.
7272
5. Delete all `.bak` files once review is complete.
73-
6. Run checks (`./gradlew test`) to verify.
73+
6. Run checks (`./gradlew test compileExamples`) to verify. `test` covers unit/wire tests including the README snippet compilation; `compileExamples` separately compiles the hand-maintained `examples/` directory and catches stale API call sites that `test` alone would miss.
7474
7. Commit as `chore: re-apply manual patches after regen` and push.

examples/agent/CustomProviders.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import com.deepgram.DeepgramClient;
22
import com.deepgram.resources.agent.v1.types.AgentV1Settings;
33
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgent;
4-
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentSpeak;
5-
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentThink;
4+
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContext;
5+
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContextSpeak;
6+
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContextThink;
67
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAudio;
78
import com.deepgram.resources.agent.v1.websocket.V1WebSocketClient;
89
import com.deepgram.types.Anthropic;
@@ -65,18 +66,19 @@ public static void main(String[] args) {
6566
.model(DeepgramSpeakProviderModel.AURA2ASTERIA_EN)
6667
.build();
6768

68-
AgentV1SettingsAgentSpeak speakSettings = AgentV1SettingsAgentSpeak.of(SpeakSettingsV1.builder()
69-
.provider(SpeakSettingsV1Provider.deepgram(deepgramSpeakProvider))
70-
.build());
69+
AgentV1SettingsAgentContextSpeak speakSettings =
70+
AgentV1SettingsAgentContextSpeak.of(SpeakSettingsV1.builder()
71+
.provider(SpeakSettingsV1Provider.deepgram(deepgramSpeakProvider))
72+
.build());
7173

72-
AgentV1SettingsAgent agentConfig = AgentV1SettingsAgent.builder()
73-
.think(AgentV1SettingsAgentThink.of(ThinkSettingsV1.builder()
74+
AgentV1SettingsAgent agentConfig = AgentV1SettingsAgent.of(AgentV1SettingsAgentContext.builder()
75+
.think(AgentV1SettingsAgentContextThink.of(ThinkSettingsV1.builder()
7476
.provider(ThinkSettingsV1Provider.anthropic(anthropicProvider))
7577
.prompt("You are a helpful assistant. Keep responses concise.")
7678
.build()))
7779
.speak(speakSettings)
7880
.greeting("Hello! I'm powered by Anthropic Claude with Deepgram voices.")
79-
.build();
81+
.build());
8082

8183
AgentV1Settings settings = AgentV1Settings.builder()
8284
.audio(AgentV1SettingsAudio.builder().build())

examples/agent/InjectMessage.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import com.deepgram.resources.agent.v1.types.AgentV1InjectUserMessage;
44
import com.deepgram.resources.agent.v1.types.AgentV1Settings;
55
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgent;
6-
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentThink;
6+
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContext;
7+
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContextThink;
78
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAudio;
89
import com.deepgram.resources.agent.v1.websocket.V1WebSocketClient;
910
import com.deepgram.types.OpenAiThinkProvider;
@@ -57,14 +58,14 @@ public static void main(String[] args) {
5758

5859
AgentV1Settings settings = AgentV1Settings.builder()
5960
.audio(AgentV1SettingsAudio.builder().build())
60-
.agent(AgentV1SettingsAgent.builder()
61-
.think(AgentV1SettingsAgentThink.of(ThinkSettingsV1.builder()
61+
.agent(AgentV1SettingsAgent.of(AgentV1SettingsAgentContext.builder()
62+
.think(AgentV1SettingsAgentContextThink.of(ThinkSettingsV1.builder()
6263
.provider(ThinkSettingsV1Provider.openAi(openAiProvider))
6364
.prompt(
6465
"You are a helpful voice assistant. Keep responses brief and conversational.")
6566
.build()))
6667
.greeting("Hello! I'm ready to chat.")
67-
.build())
68+
.build()))
6869
.build();
6970

7071
wsClient.sendSettings(settings);

examples/agent/ProviderCombinations.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgent;
2-
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentSpeak;
3-
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentThink;
2+
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContext;
3+
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContextSpeak;
4+
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContextThink;
45
import com.deepgram.types.Anthropic;
56
import com.deepgram.types.AnthropicThinkProviderModel;
67
import com.deepgram.types.Deepgram;
@@ -30,24 +31,25 @@ public static void main(String[] args) {
3031
Deepgram deepgramSpeak = Deepgram.builder()
3132
.model(DeepgramSpeakProviderModel.AURA2ASTERIA_EN)
3233
.build();
33-
AgentV1SettingsAgentSpeak speakSettings = AgentV1SettingsAgentSpeak.of(SpeakSettingsV1.builder()
34-
.provider(SpeakSettingsV1Provider.deepgram(deepgramSpeak))
35-
.build());
34+
AgentV1SettingsAgentContextSpeak speakSettings =
35+
AgentV1SettingsAgentContextSpeak.of(SpeakSettingsV1.builder()
36+
.provider(SpeakSettingsV1Provider.deepgram(deepgramSpeak))
37+
.build());
3638

3739
// Combination 1: OpenAI GPT-4o Mini + Deepgram
3840
System.out.println("=== Combination 1: OpenAI + Deepgram ===");
3941
OpenAiThinkProvider openAiProvider = OpenAiThinkProvider.builder()
4042
.model(OpenAiThinkProviderModel.GPT4O_MINI)
4143
.build();
4244

43-
AgentV1SettingsAgent openAiConfig = AgentV1SettingsAgent.builder()
44-
.think(AgentV1SettingsAgentThink.of(ThinkSettingsV1.builder()
45+
AgentV1SettingsAgent openAiConfig = AgentV1SettingsAgent.of(AgentV1SettingsAgentContext.builder()
46+
.think(AgentV1SettingsAgentContextThink.of(ThinkSettingsV1.builder()
4547
.provider(ThinkSettingsV1Provider.openAi(openAiProvider))
4648
.prompt("You are a helpful assistant powered by OpenAI.")
4749
.build()))
4850
.speak(speakSettings)
4951
.greeting("Hello! I'm powered by OpenAI GPT-4o Mini.")
50-
.build();
52+
.build());
5153
System.out.println(" Think: OpenAI GPT-4o Mini");
5254
System.out.println(" Speak: Deepgram Aura 2 Asteria");
5355
System.out.println(" Config built successfully.");
@@ -59,14 +61,14 @@ public static void main(String[] args) {
5961
.model(AnthropicThinkProviderModel.CLAUDE_SONNET420250514)
6062
.build();
6163

62-
AgentV1SettingsAgent anthropicConfig = AgentV1SettingsAgent.builder()
63-
.think(AgentV1SettingsAgentThink.of(ThinkSettingsV1.builder()
64+
AgentV1SettingsAgent anthropicConfig = AgentV1SettingsAgent.of(AgentV1SettingsAgentContext.builder()
65+
.think(AgentV1SettingsAgentContextThink.of(ThinkSettingsV1.builder()
6466
.provider(ThinkSettingsV1Provider.anthropic(anthropicProvider))
6567
.prompt("You are a helpful assistant powered by Anthropic Claude.")
6668
.build()))
6769
.speak(speakSettings)
6870
.greeting("Hello! I'm powered by Anthropic Claude.")
69-
.build();
71+
.build());
7072
System.out.println(" Think: Anthropic Claude Sonnet 4");
7173
System.out.println(" Speak: Deepgram Aura 2 Asteria");
7274
System.out.println(" Config built successfully.");
@@ -77,14 +79,14 @@ public static void main(String[] args) {
7779
Google googleProvider =
7880
Google.builder().model(GoogleThinkProviderModel.GEMINI25FLASH).build();
7981

80-
AgentV1SettingsAgent googleConfig = AgentV1SettingsAgent.builder()
81-
.think(AgentV1SettingsAgentThink.of(ThinkSettingsV1.builder()
82+
AgentV1SettingsAgent googleConfig = AgentV1SettingsAgent.of(AgentV1SettingsAgentContext.builder()
83+
.think(AgentV1SettingsAgentContextThink.of(ThinkSettingsV1.builder()
8284
.provider(ThinkSettingsV1Provider.google(googleProvider))
8385
.prompt("You are a helpful assistant powered by Google Gemini.")
8486
.build()))
8587
.speak(speakSettings)
8688
.greeting("Hello! I'm powered by Google Gemini.")
87-
.build();
89+
.build());
8890
System.out.println(" Think: Google Gemini 2.5 Flash");
8991
System.out.println(" Speak: Deepgram Aura 2 Asteria");
9092
System.out.println(" Config built successfully.");

examples/agent/VoiceAgent.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import com.deepgram.DeepgramClient;
22
import com.deepgram.resources.agent.v1.types.AgentV1Settings;
33
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgent;
4-
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentThink;
4+
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContext;
5+
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContextThink;
56
import com.deepgram.resources.agent.v1.types.AgentV1SettingsAudio;
67
import com.deepgram.resources.agent.v1.websocket.V1WebSocketClient;
78
import com.deepgram.types.OpenAiThinkProvider;
@@ -62,13 +63,13 @@ public static void main(String[] args) {
6263
.model(OpenAiThinkProviderModel.GPT4O_MINI)
6364
.build();
6465

65-
AgentV1SettingsAgent agentConfig = AgentV1SettingsAgent.builder()
66-
.think(AgentV1SettingsAgentThink.of(ThinkSettingsV1.builder()
66+
AgentV1SettingsAgent agentConfig = AgentV1SettingsAgent.of(AgentV1SettingsAgentContext.builder()
67+
.think(AgentV1SettingsAgentContextThink.of(ThinkSettingsV1.builder()
6768
.provider(ThinkSettingsV1Provider.openAi(openAiProvider))
6869
.prompt("You are a helpful voice assistant. Keep your responses brief.")
6970
.build()))
7071
.greeting("Hello! How can I help you today?")
71-
.build();
72+
.build());
7273

7374
AgentV1Settings settings = AgentV1Settings.builder()
7475
.audio(AgentV1SettingsAudio.builder().build())

0 commit comments

Comments
 (0)