phonic 0.32.14 → 0.32.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +1 -1
  3. package/dist/cjs/api/resources/conversationItems/client/Client.d.ts +5 -6
  4. package/dist/cjs/api/resources/conversationItems/client/Client.js +7 -8
  5. package/dist/cjs/api/resources/conversationItems/client/requests/ReplayConversationItemRequest.d.ts +3 -5
  6. package/dist/cjs/api/resources/tools/client/requests/CreateToolRequest.d.ts +2 -0
  7. package/dist/cjs/api/resources/tools/client/requests/UpdateToolRequest.d.ts +2 -0
  8. package/dist/cjs/api/resources/tts/client/requests/StreamTtsRequest.d.ts +6 -0
  9. package/dist/cjs/api/types/Agent.d.ts +1 -1
  10. package/dist/cjs/api/types/BuiltInToolConfig.d.ts +1 -1
  11. package/dist/cjs/api/types/BuiltInToolConfigs.d.ts +5 -2
  12. package/dist/cjs/api/types/BuiltInToolDefinition.d.ts +8 -2
  13. package/dist/cjs/api/types/BuiltInToolDefinition.js +1 -0
  14. package/dist/cjs/api/types/ChooseNotToRespondToolConfig.d.ts +7 -0
  15. package/dist/cjs/api/types/ChooseNotToRespondToolConfig.js +3 -0
  16. package/dist/cjs/api/types/CreateAgentRequest.d.ts +1 -1
  17. package/dist/cjs/api/types/OutboundCallConfig.d.ts +1 -1
  18. package/dist/cjs/api/types/Tool.d.ts +2 -0
  19. package/dist/cjs/api/types/index.d.ts +1 -0
  20. package/dist/cjs/api/types/index.js +1 -0
  21. package/dist/cjs/version.d.ts +1 -1
  22. package/dist/cjs/version.js +1 -1
  23. package/dist/esm/BaseClient.mjs +2 -2
  24. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +1 -1
  25. package/dist/esm/api/resources/conversationItems/client/Client.d.mts +5 -6
  26. package/dist/esm/api/resources/conversationItems/client/Client.mjs +7 -8
  27. package/dist/esm/api/resources/conversationItems/client/requests/ReplayConversationItemRequest.d.mts +3 -5
  28. package/dist/esm/api/resources/tools/client/requests/CreateToolRequest.d.mts +2 -0
  29. package/dist/esm/api/resources/tools/client/requests/UpdateToolRequest.d.mts +2 -0
  30. package/dist/esm/api/resources/tts/client/requests/StreamTtsRequest.d.mts +6 -0
  31. package/dist/esm/api/types/Agent.d.mts +1 -1
  32. package/dist/esm/api/types/BuiltInToolConfig.d.mts +1 -1
  33. package/dist/esm/api/types/BuiltInToolConfigs.d.mts +5 -2
  34. package/dist/esm/api/types/BuiltInToolDefinition.d.mts +8 -2
  35. package/dist/esm/api/types/BuiltInToolDefinition.mjs +1 -0
  36. package/dist/esm/api/types/ChooseNotToRespondToolConfig.d.mts +7 -0
  37. package/dist/esm/api/types/ChooseNotToRespondToolConfig.mjs +2 -0
  38. package/dist/esm/api/types/CreateAgentRequest.d.mts +1 -1
  39. package/dist/esm/api/types/OutboundCallConfig.d.mts +1 -1
  40. package/dist/esm/api/types/Tool.d.mts +2 -0
  41. package/dist/esm/api/types/index.d.mts +1 -0
  42. package/dist/esm/api/types/index.mjs +1 -0
  43. package/dist/esm/version.d.mts +1 -1
  44. package/dist/esm/version.mjs +1 -1
  45. package/package.json +1 -1
  46. package/reference.md +4 -5
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "phonic",
46
- "X-Fern-SDK-Version": "0.32.13",
47
- "User-Agent": "phonic/0.32.13",
46
+ "X-Fern-SDK-Version": "0.32.16",
47
+ "User-Agent": "phonic/0.32.16",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -178,7 +178,7 @@ export declare namespace UpdateAgentRequest {
178
178
  }
179
179
  type Tools = Tools.Item[];
180
180
  namespace Tools {
181
- type Item = "keypad_input" | "natural_conversation_ending"
181
+ type Item = "keypad_input" | "natural_conversation_ending" | "choose_not_to_respond"
182
182
  /**
183
183
  * Custom tool */
184
184
  | string;
@@ -14,8 +14,9 @@ export declare class ConversationItemsClient {
14
14
  * Returns the alternative response(s) the assistant would have
15
15
  * produced for this conversation turn given changes to the agent system prompt.
16
16
  *
17
- * Only assistant items from ended conversations can be replayed. The
18
- * conversation must have an associated agent.
17
+ * Only assistant items from ended conversations can be replayed. Omit the
18
+ * request body (or omit `system_prompt`) to replay the turn exactly as it
19
+ * originally ran.
19
20
  *
20
21
  * @param {string} id - The ID of the conversation item to replay.
21
22
  * @param {Phonic.ReplayConversationItemRequest} request
@@ -30,10 +31,8 @@ export declare class ConversationItemsClient {
30
31
  * @throws {@link Phonic.InternalServerError}
31
32
  *
32
33
  * @example
33
- * await client.conversationItems.replay("id", {
34
- * system_prompt: "system_prompt"
35
- * })
34
+ * await client.conversationItems.replay("id")
36
35
  */
37
- replay(id: string, request: Phonic.ReplayConversationItemRequest, requestOptions?: ConversationItemsClient.RequestOptions): core.HttpResponsePromise<Phonic.ReplayConversationItemResponse>;
36
+ replay(id: string, request?: Phonic.ReplayConversationItemRequest, requestOptions?: ConversationItemsClient.RequestOptions): core.HttpResponsePromise<Phonic.ReplayConversationItemResponse>;
38
37
  private __replay;
39
38
  }
@@ -59,8 +59,9 @@ class ConversationItemsClient {
59
59
  * Returns the alternative response(s) the assistant would have
60
60
  * produced for this conversation turn given changes to the agent system prompt.
61
61
  *
62
- * Only assistant items from ended conversations can be replayed. The
63
- * conversation must have an associated agent.
62
+ * Only assistant items from ended conversations can be replayed. Omit the
63
+ * request body (or omit `system_prompt`) to replay the turn exactly as it
64
+ * originally ran.
64
65
  *
65
66
  * @param {string} id - The ID of the conversation item to replay.
66
67
  * @param {Phonic.ReplayConversationItemRequest} request
@@ -75,15 +76,13 @@ class ConversationItemsClient {
75
76
  * @throws {@link Phonic.InternalServerError}
76
77
  *
77
78
  * @example
78
- * await client.conversationItems.replay("id", {
79
- * system_prompt: "system_prompt"
80
- * })
79
+ * await client.conversationItems.replay("id")
81
80
  */
82
- replay(id, request, requestOptions) {
81
+ replay(id, request = {}, requestOptions) {
83
82
  return core.HttpResponsePromise.fromPromise(this.__replay(id, request, requestOptions));
84
83
  }
85
- __replay(id, request, requestOptions) {
86
- return __awaiter(this, void 0, void 0, function* () {
84
+ __replay(id_1) {
85
+ return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
87
86
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
88
87
  const _authRequest = yield this._options.authProvider.getAuthRequest();
89
88
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
@@ -1,12 +1,10 @@
1
1
  /**
2
2
  * @example
3
- * {
4
- * system_prompt: "system_prompt"
5
- * }
3
+ * {}
6
4
  */
7
5
  export interface ReplayConversationItemRequest {
8
- /** The system prompt to use when generating replay responses. Use this to test prompt changes against this conversation turn. */
9
- system_prompt: string;
6
+ /** The system prompt to use when generating replay responses. Use this to test prompt changes against this conversation turn. Omit it to replay the turn with the system prompt it originally ran with. */
7
+ system_prompt?: string;
10
8
  /** Number of alternative responses to generate. */
11
9
  num_responses?: number;
12
10
  }
@@ -217,6 +217,8 @@ export interface CreateToolRequest {
217
217
  require_speech_before_tool_call?: boolean;
218
218
  /** For built_in_natural_conversation_ending and built_in_keypad_input tools. Whether the agent must speak before calling the tool ("required"), the model decides ("optional"), or the agent must stay silent ("suppressed"). Not used by other tool types. */
219
219
  speech_before_tool_call?: CreateToolRequest.SpeechBeforeToolCall;
220
+ /** For built_in_choose_not_to_respond tools. Number of seconds to wait after the tool fires before the agent speaks a follow-up if the user stays silent. When null, the agent stays silent (default). Not used by other tool types. */
221
+ respond_after_sec?: number | null;
220
222
  /** If true, the agent will wait to finish speaking before executing the tool. This is only available for custom_webhook and custom_websocket tools. */
221
223
  wait_for_speech_before_tool_call?: boolean;
222
224
  /** When true, forbids the agent from speaking after executing the tool. Available for custom_context, custom_webhook and custom_websocket tools. */
@@ -57,6 +57,8 @@ export interface UpdateToolRequest {
57
57
  require_speech_before_tool_call?: boolean;
58
58
  /** For built_in_natural_conversation_ending and built_in_keypad_input tools. Whether the agent must speak before calling the tool ("required"), the model decides ("optional"), or the agent must stay silent ("suppressed"). Not used by other tool types. */
59
59
  speech_before_tool_call?: UpdateToolRequest.SpeechBeforeToolCall;
60
+ /** For built_in_choose_not_to_respond tools. Number of seconds to wait after the tool fires before the agent speaks a follow-up if the user stays silent. When null, the agent stays silent (default). Not used by other tool types. */
61
+ respond_after_sec?: number | null;
60
62
  /** If true, the agent will wait to finish speaking before executing the tool. This is only available for custom_webhook and custom_websocket tools. */
61
63
  wait_for_speech_before_tool_call?: boolean;
62
64
  /** When true, forbids the agent from speaking after executing the tool. Available for custom_context, custom_webhook and custom_websocket tools. */
@@ -1,3 +1,4 @@
1
+ import type * as Phonic from "../../../../index.js";
1
2
  /**
2
3
  * @example
3
4
  * {
@@ -15,6 +16,11 @@ export interface StreamTtsRequest {
15
16
  voice_id?: string;
16
17
  /** The audio format to stream. */
17
18
  output_format?: StreamTtsRequest.OutputFormat;
19
+ /**
20
+ * Candidate languages for synthesis. An empty array defaults to English, one language
21
+ * selects it directly, and multiple languages let Phonic detect among those candidates.
22
+ */
23
+ languages?: Phonic.LanguageCode[];
18
24
  }
19
25
  export declare namespace StreamTtsRequest {
20
26
  /** The audio format to stream. */
@@ -127,7 +127,7 @@ export declare namespace Agent {
127
127
  }
128
128
  type Tools = Tools.Item[];
129
129
  namespace Tools {
130
- type Item = "keypad_input" | "natural_conversation_ending"
130
+ type Item = "keypad_input" | "natural_conversation_ending" | "choose_not_to_respond"
131
131
  /**
132
132
  * Custom tool */
133
133
  | string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Configuration for a simple built-in tool (`keypad_input`, `natural_conversation_ending`, or `choose_not_to_respond`).
2
+ * Configuration for a simple built-in tool (`keypad_input` or `natural_conversation_ending`).
3
3
  */
4
4
  export interface BuiltInToolConfig {
5
5
  /** Controls whether the assistant speaks before the tool is called. `required`: the assistant must speak first. `optional`: the model decides. `suppressed`: the assistant is strongly instructed to stay silent before the call (best effort). */
@@ -1,5 +1,8 @@
1
1
  import type * as Phonic from "../index.js";
2
2
  /**
3
- * Per-tool configuration overrides for built-in tools, keyed by built-in tool ID (e.g. `tool_natural_conversation_ending`). A built-in tool referenced in `tools` but absent from this map uses its default configuration.
3
+ * Per-tool configuration overrides for built-in tools, keyed by built-in tool ID. The value's shape depends on the tool: `tool_keypad_input` and `tool_natural_conversation_ending` take a `speech_before_tool_call` config; `tool_choose_not_to_respond` takes a `respond_after_sec` config. A built-in tool referenced in `tools` but absent from this map uses its default configuration.
4
4
  */
5
- export type BuiltInToolConfigs = Record<string, Phonic.BuiltInToolConfig>;
5
+ export type BuiltInToolConfigs = Record<string, BuiltInToolConfigs.Value>;
6
+ export declare namespace BuiltInToolConfigs {
7
+ type Value = Phonic.BuiltInToolConfig | Phonic.ChooseNotToRespondToolConfig;
8
+ }
@@ -1,18 +1,24 @@
1
1
  import type * as Phonic from "../index.js";
2
2
  /**
3
- * A built-in tool with an explicit configuration, as an alternative to referencing it by bare name (which uses the tool's default configuration). Only `keypad_input` and `natural_conversation_ending` accept configuration this way.
3
+ * A built-in tool with an explicit configuration, as an alternative to referencing it by bare name (which uses the tool's default configuration). `keypad_input` and `natural_conversation_ending` take a `speech_before_tool_call` config; `choose_not_to_respond` takes a `respond_after_sec` config.
4
4
  */
5
5
  export interface BuiltInToolDefinition {
6
6
  type: "built_in";
7
7
  /** The name of the built-in tool. */
8
8
  name: BuiltInToolDefinition.Name;
9
- tool_config: Phonic.BuiltInToolConfig;
9
+ /** The tool's configuration. Use `BuiltInToolConfig` for `keypad_input` and `natural_conversation_ending`, or `ChooseNotToRespondToolConfig` for `choose_not_to_respond`. */
10
+ tool_config: BuiltInToolDefinition.ToolConfig;
10
11
  }
11
12
  export declare namespace BuiltInToolDefinition {
12
13
  /** The name of the built-in tool. */
13
14
  const Name: {
14
15
  readonly KeypadInput: "keypad_input";
15
16
  readonly NaturalConversationEnding: "natural_conversation_ending";
17
+ readonly ChooseNotToRespond: "choose_not_to_respond";
16
18
  };
17
19
  type Name = (typeof Name)[keyof typeof Name];
20
+ /**
21
+ * The tool's configuration. Use `BuiltInToolConfig` for `keypad_input` and `natural_conversation_ending`, or `ChooseNotToRespondToolConfig` for `choose_not_to_respond`.
22
+ */
23
+ type ToolConfig = Phonic.BuiltInToolConfig | Phonic.ChooseNotToRespondToolConfig;
18
24
  }
@@ -8,5 +8,6 @@ var BuiltInToolDefinition;
8
8
  BuiltInToolDefinition.Name = {
9
9
  KeypadInput: "keypad_input",
10
10
  NaturalConversationEnding: "natural_conversation_ending",
11
+ ChooseNotToRespond: "choose_not_to_respond",
11
12
  };
12
13
  })(BuiltInToolDefinition || (exports.BuiltInToolDefinition = BuiltInToolDefinition = {}));
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Configuration for the `choose_not_to_respond` built-in tool.
3
+ */
4
+ export interface ChooseNotToRespondToolConfig {
5
+ /** Number of seconds to wait after the tool fires before the assistant speaks a follow-up if the user stays silent. When null, the assistant stays silent (default). */
6
+ respond_after_sec?: (number | null) | undefined;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -125,7 +125,7 @@ export declare namespace CreateAgentRequest {
125
125
  }
126
126
  type Tools = Tools.Item[];
127
127
  namespace Tools {
128
- type Item = "keypad_input" | "natural_conversation_ending"
128
+ type Item = "keypad_input" | "natural_conversation_ending" | "choose_not_to_respond"
129
129
  /**
130
130
  * Custom tool */
131
131
  | string;
@@ -97,7 +97,7 @@ export declare namespace OutboundCallConfig {
97
97
  }
98
98
  type Tools = Tools.Item[];
99
99
  namespace Tools {
100
- type Item = "keypad_input" | "natural_conversation_ending"
100
+ type Item = "keypad_input" | "natural_conversation_ending" | "choose_not_to_respond"
101
101
  /**
102
102
  * Custom tool */
103
103
  | string;
@@ -48,6 +48,8 @@ export interface Tool {
48
48
  require_speech_before_tool_call?: boolean | undefined;
49
49
  /** For built_in_natural_conversation_ending and built_in_keypad_input tools. Whether the agent must speak before calling the tool ("required"), the model decides ("optional"), or the agent must stay silent ("suppressed"). Not used by other tool types. */
50
50
  speech_before_tool_call?: Tool.SpeechBeforeToolCall | undefined;
51
+ /** For built_in_choose_not_to_respond tools. Number of seconds to wait after the tool fires before the agent speaks a follow-up if the user stays silent. When null, the agent stays silent (default). Not used by other tool types. */
52
+ respond_after_sec?: (number | null) | undefined;
51
53
  /** If true, the agent will wait to finish speaking before executing the tool. This is only available for custom_webhook and custom_websocket tools. */
52
54
  wait_for_speech_before_tool_call?: boolean | undefined;
53
55
  /** When true, forbids the agent from speaking after executing the tool. Available for custom_context, custom_webhook and custom_websocket tools. */
@@ -13,6 +13,7 @@ export * from "./BasicError.js";
13
13
  export * from "./BuiltInToolConfig.js";
14
14
  export * from "./BuiltInToolConfigs.js";
15
15
  export * from "./BuiltInToolDefinition.js";
16
+ export * from "./ChooseNotToRespondToolConfig.js";
16
17
  export * from "./ConfigOptions.js";
17
18
  export * from "./ConfigPayload.js";
18
19
  export * from "./Conversation.js";
@@ -29,6 +29,7 @@ __exportStar(require("./BasicError.js"), exports);
29
29
  __exportStar(require("./BuiltInToolConfig.js"), exports);
30
30
  __exportStar(require("./BuiltInToolConfigs.js"), exports);
31
31
  __exportStar(require("./BuiltInToolDefinition.js"), exports);
32
+ __exportStar(require("./ChooseNotToRespondToolConfig.js"), exports);
32
33
  __exportStar(require("./ConfigOptions.js"), exports);
33
34
  __exportStar(require("./ConfigPayload.js"), exports);
34
35
  __exportStar(require("./Conversation.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.32.14";
1
+ export declare const SDK_VERSION = "0.32.16";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.32.14";
4
+ exports.SDK_VERSION = "0.32.16";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "phonic",
9
- "X-Fern-SDK-Version": "0.32.13",
10
- "User-Agent": "phonic/0.32.13",
9
+ "X-Fern-SDK-Version": "0.32.16",
10
+ "User-Agent": "phonic/0.32.16",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -178,7 +178,7 @@ export declare namespace UpdateAgentRequest {
178
178
  }
179
179
  type Tools = Tools.Item[];
180
180
  namespace Tools {
181
- type Item = "keypad_input" | "natural_conversation_ending"
181
+ type Item = "keypad_input" | "natural_conversation_ending" | "choose_not_to_respond"
182
182
  /**
183
183
  * Custom tool */
184
184
  | string;
@@ -14,8 +14,9 @@ export declare class ConversationItemsClient {
14
14
  * Returns the alternative response(s) the assistant would have
15
15
  * produced for this conversation turn given changes to the agent system prompt.
16
16
  *
17
- * Only assistant items from ended conversations can be replayed. The
18
- * conversation must have an associated agent.
17
+ * Only assistant items from ended conversations can be replayed. Omit the
18
+ * request body (or omit `system_prompt`) to replay the turn exactly as it
19
+ * originally ran.
19
20
  *
20
21
  * @param {string} id - The ID of the conversation item to replay.
21
22
  * @param {Phonic.ReplayConversationItemRequest} request
@@ -30,10 +31,8 @@ export declare class ConversationItemsClient {
30
31
  * @throws {@link Phonic.InternalServerError}
31
32
  *
32
33
  * @example
33
- * await client.conversationItems.replay("id", {
34
- * system_prompt: "system_prompt"
35
- * })
34
+ * await client.conversationItems.replay("id")
36
35
  */
37
- replay(id: string, request: Phonic.ReplayConversationItemRequest, requestOptions?: ConversationItemsClient.RequestOptions): core.HttpResponsePromise<Phonic.ReplayConversationItemResponse>;
36
+ replay(id: string, request?: Phonic.ReplayConversationItemRequest, requestOptions?: ConversationItemsClient.RequestOptions): core.HttpResponsePromise<Phonic.ReplayConversationItemResponse>;
38
37
  private __replay;
39
38
  }
@@ -23,8 +23,9 @@ export class ConversationItemsClient {
23
23
  * Returns the alternative response(s) the assistant would have
24
24
  * produced for this conversation turn given changes to the agent system prompt.
25
25
  *
26
- * Only assistant items from ended conversations can be replayed. The
27
- * conversation must have an associated agent.
26
+ * Only assistant items from ended conversations can be replayed. Omit the
27
+ * request body (or omit `system_prompt`) to replay the turn exactly as it
28
+ * originally ran.
28
29
  *
29
30
  * @param {string} id - The ID of the conversation item to replay.
30
31
  * @param {Phonic.ReplayConversationItemRequest} request
@@ -39,15 +40,13 @@ export class ConversationItemsClient {
39
40
  * @throws {@link Phonic.InternalServerError}
40
41
  *
41
42
  * @example
42
- * await client.conversationItems.replay("id", {
43
- * system_prompt: "system_prompt"
44
- * })
43
+ * await client.conversationItems.replay("id")
45
44
  */
46
- replay(id, request, requestOptions) {
45
+ replay(id, request = {}, requestOptions) {
47
46
  return core.HttpResponsePromise.fromPromise(this.__replay(id, request, requestOptions));
48
47
  }
49
- __replay(id, request, requestOptions) {
50
- return __awaiter(this, void 0, void 0, function* () {
48
+ __replay(id_1) {
49
+ return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
51
50
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
52
51
  const _authRequest = yield this._options.authProvider.getAuthRequest();
53
52
  const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
@@ -1,12 +1,10 @@
1
1
  /**
2
2
  * @example
3
- * {
4
- * system_prompt: "system_prompt"
5
- * }
3
+ * {}
6
4
  */
7
5
  export interface ReplayConversationItemRequest {
8
- /** The system prompt to use when generating replay responses. Use this to test prompt changes against this conversation turn. */
9
- system_prompt: string;
6
+ /** The system prompt to use when generating replay responses. Use this to test prompt changes against this conversation turn. Omit it to replay the turn with the system prompt it originally ran with. */
7
+ system_prompt?: string;
10
8
  /** Number of alternative responses to generate. */
11
9
  num_responses?: number;
12
10
  }
@@ -217,6 +217,8 @@ export interface CreateToolRequest {
217
217
  require_speech_before_tool_call?: boolean;
218
218
  /** For built_in_natural_conversation_ending and built_in_keypad_input tools. Whether the agent must speak before calling the tool ("required"), the model decides ("optional"), or the agent must stay silent ("suppressed"). Not used by other tool types. */
219
219
  speech_before_tool_call?: CreateToolRequest.SpeechBeforeToolCall;
220
+ /** For built_in_choose_not_to_respond tools. Number of seconds to wait after the tool fires before the agent speaks a follow-up if the user stays silent. When null, the agent stays silent (default). Not used by other tool types. */
221
+ respond_after_sec?: number | null;
220
222
  /** If true, the agent will wait to finish speaking before executing the tool. This is only available for custom_webhook and custom_websocket tools. */
221
223
  wait_for_speech_before_tool_call?: boolean;
222
224
  /** When true, forbids the agent from speaking after executing the tool. Available for custom_context, custom_webhook and custom_websocket tools. */
@@ -57,6 +57,8 @@ export interface UpdateToolRequest {
57
57
  require_speech_before_tool_call?: boolean;
58
58
  /** For built_in_natural_conversation_ending and built_in_keypad_input tools. Whether the agent must speak before calling the tool ("required"), the model decides ("optional"), or the agent must stay silent ("suppressed"). Not used by other tool types. */
59
59
  speech_before_tool_call?: UpdateToolRequest.SpeechBeforeToolCall;
60
+ /** For built_in_choose_not_to_respond tools. Number of seconds to wait after the tool fires before the agent speaks a follow-up if the user stays silent. When null, the agent stays silent (default). Not used by other tool types. */
61
+ respond_after_sec?: number | null;
60
62
  /** If true, the agent will wait to finish speaking before executing the tool. This is only available for custom_webhook and custom_websocket tools. */
61
63
  wait_for_speech_before_tool_call?: boolean;
62
64
  /** When true, forbids the agent from speaking after executing the tool. Available for custom_context, custom_webhook and custom_websocket tools. */
@@ -1,3 +1,4 @@
1
+ import type * as Phonic from "../../../../index.mjs";
1
2
  /**
2
3
  * @example
3
4
  * {
@@ -15,6 +16,11 @@ export interface StreamTtsRequest {
15
16
  voice_id?: string;
16
17
  /** The audio format to stream. */
17
18
  output_format?: StreamTtsRequest.OutputFormat;
19
+ /**
20
+ * Candidate languages for synthesis. An empty array defaults to English, one language
21
+ * selects it directly, and multiple languages let Phonic detect among those candidates.
22
+ */
23
+ languages?: Phonic.LanguageCode[];
18
24
  }
19
25
  export declare namespace StreamTtsRequest {
20
26
  /** The audio format to stream. */
@@ -127,7 +127,7 @@ export declare namespace Agent {
127
127
  }
128
128
  type Tools = Tools.Item[];
129
129
  namespace Tools {
130
- type Item = "keypad_input" | "natural_conversation_ending"
130
+ type Item = "keypad_input" | "natural_conversation_ending" | "choose_not_to_respond"
131
131
  /**
132
132
  * Custom tool */
133
133
  | string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Configuration for a simple built-in tool (`keypad_input`, `natural_conversation_ending`, or `choose_not_to_respond`).
2
+ * Configuration for a simple built-in tool (`keypad_input` or `natural_conversation_ending`).
3
3
  */
4
4
  export interface BuiltInToolConfig {
5
5
  /** Controls whether the assistant speaks before the tool is called. `required`: the assistant must speak first. `optional`: the model decides. `suppressed`: the assistant is strongly instructed to stay silent before the call (best effort). */
@@ -1,5 +1,8 @@
1
1
  import type * as Phonic from "../index.mjs";
2
2
  /**
3
- * Per-tool configuration overrides for built-in tools, keyed by built-in tool ID (e.g. `tool_natural_conversation_ending`). A built-in tool referenced in `tools` but absent from this map uses its default configuration.
3
+ * Per-tool configuration overrides for built-in tools, keyed by built-in tool ID. The value's shape depends on the tool: `tool_keypad_input` and `tool_natural_conversation_ending` take a `speech_before_tool_call` config; `tool_choose_not_to_respond` takes a `respond_after_sec` config. A built-in tool referenced in `tools` but absent from this map uses its default configuration.
4
4
  */
5
- export type BuiltInToolConfigs = Record<string, Phonic.BuiltInToolConfig>;
5
+ export type BuiltInToolConfigs = Record<string, BuiltInToolConfigs.Value>;
6
+ export declare namespace BuiltInToolConfigs {
7
+ type Value = Phonic.BuiltInToolConfig | Phonic.ChooseNotToRespondToolConfig;
8
+ }
@@ -1,18 +1,24 @@
1
1
  import type * as Phonic from "../index.mjs";
2
2
  /**
3
- * A built-in tool with an explicit configuration, as an alternative to referencing it by bare name (which uses the tool's default configuration). Only `keypad_input` and `natural_conversation_ending` accept configuration this way.
3
+ * A built-in tool with an explicit configuration, as an alternative to referencing it by bare name (which uses the tool's default configuration). `keypad_input` and `natural_conversation_ending` take a `speech_before_tool_call` config; `choose_not_to_respond` takes a `respond_after_sec` config.
4
4
  */
5
5
  export interface BuiltInToolDefinition {
6
6
  type: "built_in";
7
7
  /** The name of the built-in tool. */
8
8
  name: BuiltInToolDefinition.Name;
9
- tool_config: Phonic.BuiltInToolConfig;
9
+ /** The tool's configuration. Use `BuiltInToolConfig` for `keypad_input` and `natural_conversation_ending`, or `ChooseNotToRespondToolConfig` for `choose_not_to_respond`. */
10
+ tool_config: BuiltInToolDefinition.ToolConfig;
10
11
  }
11
12
  export declare namespace BuiltInToolDefinition {
12
13
  /** The name of the built-in tool. */
13
14
  const Name: {
14
15
  readonly KeypadInput: "keypad_input";
15
16
  readonly NaturalConversationEnding: "natural_conversation_ending";
17
+ readonly ChooseNotToRespond: "choose_not_to_respond";
16
18
  };
17
19
  type Name = (typeof Name)[keyof typeof Name];
20
+ /**
21
+ * The tool's configuration. Use `BuiltInToolConfig` for `keypad_input` and `natural_conversation_ending`, or `ChooseNotToRespondToolConfig` for `choose_not_to_respond`.
22
+ */
23
+ type ToolConfig = Phonic.BuiltInToolConfig | Phonic.ChooseNotToRespondToolConfig;
18
24
  }
@@ -5,5 +5,6 @@ export var BuiltInToolDefinition;
5
5
  BuiltInToolDefinition.Name = {
6
6
  KeypadInput: "keypad_input",
7
7
  NaturalConversationEnding: "natural_conversation_ending",
8
+ ChooseNotToRespond: "choose_not_to_respond",
8
9
  };
9
10
  })(BuiltInToolDefinition || (BuiltInToolDefinition = {}));
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Configuration for the `choose_not_to_respond` built-in tool.
3
+ */
4
+ export interface ChooseNotToRespondToolConfig {
5
+ /** Number of seconds to wait after the tool fires before the assistant speaks a follow-up if the user stays silent. When null, the assistant stays silent (default). */
6
+ respond_after_sec?: (number | null) | undefined;
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -125,7 +125,7 @@ export declare namespace CreateAgentRequest {
125
125
  }
126
126
  type Tools = Tools.Item[];
127
127
  namespace Tools {
128
- type Item = "keypad_input" | "natural_conversation_ending"
128
+ type Item = "keypad_input" | "natural_conversation_ending" | "choose_not_to_respond"
129
129
  /**
130
130
  * Custom tool */
131
131
  | string;
@@ -97,7 +97,7 @@ export declare namespace OutboundCallConfig {
97
97
  }
98
98
  type Tools = Tools.Item[];
99
99
  namespace Tools {
100
- type Item = "keypad_input" | "natural_conversation_ending"
100
+ type Item = "keypad_input" | "natural_conversation_ending" | "choose_not_to_respond"
101
101
  /**
102
102
  * Custom tool */
103
103
  | string;
@@ -48,6 +48,8 @@ export interface Tool {
48
48
  require_speech_before_tool_call?: boolean | undefined;
49
49
  /** For built_in_natural_conversation_ending and built_in_keypad_input tools. Whether the agent must speak before calling the tool ("required"), the model decides ("optional"), or the agent must stay silent ("suppressed"). Not used by other tool types. */
50
50
  speech_before_tool_call?: Tool.SpeechBeforeToolCall | undefined;
51
+ /** For built_in_choose_not_to_respond tools. Number of seconds to wait after the tool fires before the agent speaks a follow-up if the user stays silent. When null, the agent stays silent (default). Not used by other tool types. */
52
+ respond_after_sec?: (number | null) | undefined;
51
53
  /** If true, the agent will wait to finish speaking before executing the tool. This is only available for custom_webhook and custom_websocket tools. */
52
54
  wait_for_speech_before_tool_call?: boolean | undefined;
53
55
  /** When true, forbids the agent from speaking after executing the tool. Available for custom_context, custom_webhook and custom_websocket tools. */
@@ -13,6 +13,7 @@ export * from "./BasicError.mjs";
13
13
  export * from "./BuiltInToolConfig.mjs";
14
14
  export * from "./BuiltInToolConfigs.mjs";
15
15
  export * from "./BuiltInToolDefinition.mjs";
16
+ export * from "./ChooseNotToRespondToolConfig.mjs";
16
17
  export * from "./ConfigOptions.mjs";
17
18
  export * from "./ConfigPayload.mjs";
18
19
  export * from "./Conversation.mjs";
@@ -13,6 +13,7 @@ export * from "./BasicError.mjs";
13
13
  export * from "./BuiltInToolConfig.mjs";
14
14
  export * from "./BuiltInToolConfigs.mjs";
15
15
  export * from "./BuiltInToolDefinition.mjs";
16
+ export * from "./ChooseNotToRespondToolConfig.mjs";
16
17
  export * from "./ConfigOptions.mjs";
17
18
  export * from "./ConfigPayload.mjs";
18
19
  export * from "./Conversation.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.32.14";
1
+ export declare const SDK_VERSION = "0.32.16";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.32.14";
1
+ export const SDK_VERSION = "0.32.16";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.32.14",
3
+ "version": "0.32.16",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -2406,8 +2406,9 @@ await client.apiKeys.rotate("id");
2406
2406
  Returns the alternative response(s) the assistant would have
2407
2407
  produced for this conversation turn given changes to the agent system prompt.
2408
2408
 
2409
- Only assistant items from ended conversations can be replayed. The
2410
- conversation must have an associated agent.
2409
+ Only assistant items from ended conversations can be replayed. Omit the
2410
+ request body (or omit `system_prompt`) to replay the turn exactly as it
2411
+ originally ran.
2411
2412
  </dd>
2412
2413
  </dl>
2413
2414
  </dd>
@@ -2422,9 +2423,7 @@ conversation must have an associated agent.
2422
2423
  <dd>
2423
2424
 
2424
2425
  ```typescript
2425
- await client.conversationItems.replay("id", {
2426
- system_prompt: "system_prompt"
2427
- });
2426
+ await client.conversationItems.replay("id");
2428
2427
 
2429
2428
  ```
2430
2429
  </dd>