phonic 0.32.20 → 0.32.22

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 (116) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +13 -8
  4. package/dist/cjs/api/errors/BadGatewayError.d.ts +6 -0
  5. package/dist/cjs/api/errors/BadGatewayError.js +54 -0
  6. package/dist/cjs/api/errors/index.d.ts +1 -0
  7. package/dist/cjs/api/errors/index.js +1 -0
  8. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +2 -0
  9. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +2 -0
  10. package/dist/cjs/api/resources/conversations/client/Client.d.ts +3 -0
  11. package/dist/cjs/api/resources/conversations/client/Client.js +9 -0
  12. package/dist/cjs/api/resources/index.d.ts +2 -0
  13. package/dist/cjs/api/resources/index.js +3 -1
  14. package/dist/cjs/api/resources/responses/client/Client.d.ts +72 -0
  15. package/dist/cjs/api/resources/responses/client/Client.js +169 -0
  16. package/dist/cjs/api/resources/responses/client/index.d.ts +1 -0
  17. package/dist/cjs/api/resources/responses/client/index.js +17 -0
  18. package/dist/cjs/api/resources/responses/client/requests/GenerateResponsesRequest.d.ts +46 -0
  19. package/dist/cjs/api/resources/responses/client/requests/GenerateResponsesRequest.js +3 -0
  20. package/dist/cjs/api/resources/responses/client/requests/index.d.ts +1 -0
  21. package/dist/cjs/api/resources/responses/client/requests/index.js +2 -0
  22. package/dist/cjs/api/resources/responses/exports.d.ts +2 -0
  23. package/dist/cjs/api/resources/responses/exports.js +21 -0
  24. package/dist/cjs/api/resources/responses/index.d.ts +1 -0
  25. package/dist/cjs/api/resources/responses/index.js +17 -0
  26. package/dist/cjs/api/resources/tools/client/requests/CreateToolRequest.d.ts +3 -1
  27. package/dist/cjs/api/resources/tools/client/requests/UpdateToolRequest.d.ts +3 -1
  28. package/dist/cjs/api/types/Agent.d.ts +2 -0
  29. package/dist/cjs/api/types/ConfigOptions.d.ts +2 -0
  30. package/dist/cjs/api/types/ConflictErrorBody.d.ts +2 -0
  31. package/dist/cjs/api/types/ConflictErrorBody.js +3 -0
  32. package/dist/cjs/api/types/Conversation.d.ts +2 -0
  33. package/dist/cjs/api/types/CreateAgentRequest.d.ts +2 -0
  34. package/dist/cjs/api/types/GenerateResponsesResponse.d.ts +5 -0
  35. package/dist/cjs/api/types/GenerateResponsesResponse.js +3 -0
  36. package/dist/cjs/api/types/GeneratedResponse.d.ts +7 -0
  37. package/dist/cjs/api/types/GeneratedResponse.js +3 -0
  38. package/dist/cjs/api/types/GeneratedToolCall.d.ts +10 -0
  39. package/dist/cjs/api/types/GeneratedToolCall.js +3 -0
  40. package/dist/cjs/api/types/OutboundCallConfig.d.ts +2 -0
  41. package/dist/cjs/api/types/ResponsesAssistantMessage.d.ts +11 -0
  42. package/dist/cjs/api/types/ResponsesAssistantMessage.js +3 -0
  43. package/dist/cjs/api/types/ResponsesInputItem.d.ts +5 -0
  44. package/dist/cjs/api/types/ResponsesInputItem.js +3 -0
  45. package/dist/cjs/api/types/ResponsesToolCall.d.ts +13 -0
  46. package/dist/cjs/api/types/ResponsesToolCall.js +3 -0
  47. package/dist/cjs/api/types/ResponsesToolCallOutput.d.ts +24 -0
  48. package/dist/cjs/api/types/ResponsesToolCallOutput.js +3 -0
  49. package/dist/cjs/api/types/ResponsesToolDefinition.d.ts +11 -0
  50. package/dist/cjs/api/types/ResponsesToolDefinition.js +3 -0
  51. package/dist/cjs/api/types/ResponsesUserMessage.d.ts +8 -0
  52. package/dist/cjs/api/types/ResponsesUserMessage.js +3 -0
  53. package/dist/cjs/api/types/Tool.d.ts +3 -1
  54. package/dist/cjs/api/types/index.d.ts +10 -0
  55. package/dist/cjs/api/types/index.js +10 -0
  56. package/dist/cjs/version.d.ts +1 -1
  57. package/dist/cjs/version.js +1 -1
  58. package/dist/esm/BaseClient.mjs +2 -2
  59. package/dist/esm/Client.d.mts +3 -0
  60. package/dist/esm/Client.mjs +5 -0
  61. package/dist/esm/api/errors/BadGatewayError.d.mts +6 -0
  62. package/dist/esm/api/errors/BadGatewayError.mjs +17 -0
  63. package/dist/esm/api/errors/index.d.mts +1 -0
  64. package/dist/esm/api/errors/index.mjs +1 -0
  65. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +2 -0
  66. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +2 -0
  67. package/dist/esm/api/resources/conversations/client/Client.d.mts +3 -0
  68. package/dist/esm/api/resources/conversations/client/Client.mjs +9 -0
  69. package/dist/esm/api/resources/index.d.mts +2 -0
  70. package/dist/esm/api/resources/index.mjs +2 -0
  71. package/dist/esm/api/resources/responses/client/Client.d.mts +72 -0
  72. package/dist/esm/api/resources/responses/client/Client.mjs +132 -0
  73. package/dist/esm/api/resources/responses/client/index.d.mts +1 -0
  74. package/dist/esm/api/resources/responses/client/index.mjs +1 -0
  75. package/dist/esm/api/resources/responses/client/requests/GenerateResponsesRequest.d.mts +46 -0
  76. package/dist/esm/api/resources/responses/client/requests/GenerateResponsesRequest.mjs +2 -0
  77. package/dist/esm/api/resources/responses/client/requests/index.d.mts +1 -0
  78. package/dist/esm/api/resources/responses/client/requests/index.mjs +1 -0
  79. package/dist/esm/api/resources/responses/exports.d.mts +2 -0
  80. package/dist/esm/api/resources/responses/exports.mjs +3 -0
  81. package/dist/esm/api/resources/responses/index.d.mts +1 -0
  82. package/dist/esm/api/resources/responses/index.mjs +1 -0
  83. package/dist/esm/api/resources/tools/client/requests/CreateToolRequest.d.mts +3 -1
  84. package/dist/esm/api/resources/tools/client/requests/UpdateToolRequest.d.mts +3 -1
  85. package/dist/esm/api/types/Agent.d.mts +2 -0
  86. package/dist/esm/api/types/ConfigOptions.d.mts +2 -0
  87. package/dist/esm/api/types/ConflictErrorBody.d.mts +2 -0
  88. package/dist/esm/api/types/ConflictErrorBody.mjs +2 -0
  89. package/dist/esm/api/types/Conversation.d.mts +2 -0
  90. package/dist/esm/api/types/CreateAgentRequest.d.mts +2 -0
  91. package/dist/esm/api/types/GenerateResponsesResponse.d.mts +5 -0
  92. package/dist/esm/api/types/GenerateResponsesResponse.mjs +2 -0
  93. package/dist/esm/api/types/GeneratedResponse.d.mts +7 -0
  94. package/dist/esm/api/types/GeneratedResponse.mjs +2 -0
  95. package/dist/esm/api/types/GeneratedToolCall.d.mts +10 -0
  96. package/dist/esm/api/types/GeneratedToolCall.mjs +2 -0
  97. package/dist/esm/api/types/OutboundCallConfig.d.mts +2 -0
  98. package/dist/esm/api/types/ResponsesAssistantMessage.d.mts +11 -0
  99. package/dist/esm/api/types/ResponsesAssistantMessage.mjs +2 -0
  100. package/dist/esm/api/types/ResponsesInputItem.d.mts +5 -0
  101. package/dist/esm/api/types/ResponsesInputItem.mjs +2 -0
  102. package/dist/esm/api/types/ResponsesToolCall.d.mts +13 -0
  103. package/dist/esm/api/types/ResponsesToolCall.mjs +2 -0
  104. package/dist/esm/api/types/ResponsesToolCallOutput.d.mts +24 -0
  105. package/dist/esm/api/types/ResponsesToolCallOutput.mjs +2 -0
  106. package/dist/esm/api/types/ResponsesToolDefinition.d.mts +11 -0
  107. package/dist/esm/api/types/ResponsesToolDefinition.mjs +2 -0
  108. package/dist/esm/api/types/ResponsesUserMessage.d.mts +8 -0
  109. package/dist/esm/api/types/ResponsesUserMessage.mjs +2 -0
  110. package/dist/esm/api/types/Tool.d.mts +3 -1
  111. package/dist/esm/api/types/index.d.mts +10 -0
  112. package/dist/esm/api/types/index.mjs +10 -0
  113. package/dist/esm/version.d.mts +1 -1
  114. package/dist/esm/version.mjs +1 -1
  115. package/package.json +12 -1
  116. package/reference.md +104 -0
@@ -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.20",
47
- "User-Agent": "phonic/0.32.20",
46
+ "X-Fern-SDK-Version": "0.32.22",
47
+ "User-Agent": "phonic/0.32.22",
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);
@@ -6,6 +6,7 @@ import { ConversationsClient } from "./api/resources/conversations/client/Client
6
6
  import { ExternalStoragePoliciesClient } from "./api/resources/externalStoragePolicies/client/Client.js";
7
7
  import { ExtractionSchemasClient } from "./api/resources/extractionSchemas/client/Client.js";
8
8
  import { ProjectsClient } from "./api/resources/projects/client/Client.js";
9
+ import { ResponsesClient } from "./api/resources/responses/client/Client.js";
9
10
  import { ToolsClient } from "./api/resources/tools/client/Client.js";
10
11
  import { TtsClient } from "./api/resources/tts/client/Client.js";
11
12
  import { VoicesClient } from "./api/resources/voices/client/Client.js";
@@ -39,6 +40,7 @@ export declare class PhonicClient {
39
40
  protected _conversationItems: ConversationItemsClient | undefined;
40
41
  protected _auth: AuthClient | undefined;
41
42
  protected _projects: ProjectsClient | undefined;
43
+ protected _responses: ResponsesClient | undefined;
42
44
  protected _workspace: WorkspaceClient | undefined;
43
45
  protected _externalStoragePolicies: ExternalStoragePoliciesClient | undefined;
44
46
  constructor(options?: PhonicClient.Options);
@@ -52,6 +54,7 @@ export declare class PhonicClient {
52
54
  get conversationItems(): ConversationItemsClient;
53
55
  get auth(): AuthClient;
54
56
  get projects(): ProjectsClient;
57
+ get responses(): ResponsesClient;
55
58
  get workspace(): WorkspaceClient;
56
59
  get externalStoragePolicies(): ExternalStoragePoliciesClient;
57
60
  /**
@@ -52,10 +52,11 @@ const Client_js_5 = require("./api/resources/conversations/client/Client.js");
52
52
  const Client_js_6 = require("./api/resources/externalStoragePolicies/client/Client.js");
53
53
  const Client_js_7 = require("./api/resources/extractionSchemas/client/Client.js");
54
54
  const Client_js_8 = require("./api/resources/projects/client/Client.js");
55
- const Client_js_9 = require("./api/resources/tools/client/Client.js");
56
- const Client_js_10 = require("./api/resources/tts/client/Client.js");
57
- const Client_js_11 = require("./api/resources/voices/client/Client.js");
58
- const Client_js_12 = require("./api/resources/workspace/client/Client.js");
55
+ const Client_js_9 = require("./api/resources/responses/client/Client.js");
56
+ const Client_js_10 = require("./api/resources/tools/client/Client.js");
57
+ const Client_js_11 = require("./api/resources/tts/client/Client.js");
58
+ const Client_js_12 = require("./api/resources/voices/client/Client.js");
59
+ const Client_js_13 = require("./api/resources/workspace/client/Client.js");
59
60
  const BaseClient_js_1 = require("./BaseClient.js");
60
61
  const core = __importStar(require("./core/index.js"));
61
62
  const environments = __importStar(require("./environments.js"));
@@ -73,7 +74,7 @@ class PhonicClient {
73
74
  }
74
75
  get tools() {
75
76
  var _a;
76
- return ((_a = this._tools) !== null && _a !== void 0 ? _a : (this._tools = new Client_js_9.ToolsClient(this._options)));
77
+ return ((_a = this._tools) !== null && _a !== void 0 ? _a : (this._tools = new Client_js_10.ToolsClient(this._options)));
77
78
  }
78
79
  get extractionSchemas() {
79
80
  var _a;
@@ -81,11 +82,11 @@ class PhonicClient {
81
82
  }
82
83
  get tts() {
83
84
  var _a;
84
- return ((_a = this._tts) !== null && _a !== void 0 ? _a : (this._tts = new Client_js_10.TtsClient(this._options)));
85
+ return ((_a = this._tts) !== null && _a !== void 0 ? _a : (this._tts = new Client_js_11.TtsClient(this._options)));
85
86
  }
86
87
  get voices() {
87
88
  var _a;
88
- return ((_a = this._voices) !== null && _a !== void 0 ? _a : (this._voices = new Client_js_11.VoicesClient(this._options)));
89
+ return ((_a = this._voices) !== null && _a !== void 0 ? _a : (this._voices = new Client_js_12.VoicesClient(this._options)));
89
90
  }
90
91
  get conversations() {
91
92
  var _a;
@@ -103,9 +104,13 @@ class PhonicClient {
103
104
  var _a;
104
105
  return ((_a = this._projects) !== null && _a !== void 0 ? _a : (this._projects = new Client_js_8.ProjectsClient(this._options)));
105
106
  }
107
+ get responses() {
108
+ var _a;
109
+ return ((_a = this._responses) !== null && _a !== void 0 ? _a : (this._responses = new Client_js_9.ResponsesClient(this._options)));
110
+ }
106
111
  get workspace() {
107
112
  var _a;
108
- return ((_a = this._workspace) !== null && _a !== void 0 ? _a : (this._workspace = new Client_js_12.WorkspaceClient(this._options)));
113
+ return ((_a = this._workspace) !== null && _a !== void 0 ? _a : (this._workspace = new Client_js_13.WorkspaceClient(this._options)));
109
114
  }
110
115
  get externalStoragePolicies() {
111
116
  var _a;
@@ -0,0 +1,6 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as Phonic from "../index.js";
4
+ export declare class BadGatewayError extends errors.PhonicError {
5
+ constructor(body: Phonic.BasicError, rawResponse?: core.RawResponse);
6
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.BadGatewayError = void 0;
38
+ const errors = __importStar(require("../../errors/index.js"));
39
+ class BadGatewayError extends errors.PhonicError {
40
+ constructor(body, rawResponse) {
41
+ super({
42
+ message: "BadGatewayError",
43
+ statusCode: 502,
44
+ body: body,
45
+ rawResponse: rawResponse,
46
+ });
47
+ Object.setPrototypeOf(this, new.target.prototype);
48
+ if (Error.captureStackTrace) {
49
+ Error.captureStackTrace(this, this.constructor);
50
+ }
51
+ this.name = this.constructor.name;
52
+ }
53
+ }
54
+ exports.BadGatewayError = BadGatewayError;
@@ -1,3 +1,4 @@
1
+ export * from "./BadGatewayError.js";
1
2
  export * from "./BadRequestError.js";
2
3
  export * from "./ConflictError.js";
3
4
  export * from "./ForbiddenError.js";
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./BadGatewayError.js"), exports);
17
18
  __exportStar(require("./BadRequestError.js"), exports);
18
19
  __exportStar(require("./ConflictError.js"), exports);
19
20
  __exportStar(require("./ForbiddenError.js"), exports);
@@ -135,6 +135,8 @@ export interface AgentsCreateRequest {
135
135
  vad_threshold?: number;
136
136
  /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE]`) and bleeped from audio recordings after the conversation ends. */
137
137
  enable_redaction?: boolean;
138
+ /** When `true`, an inaudible watermark is embedded in the audio the agent generates. */
139
+ enable_watermarking?: boolean;
138
140
  /** Array of MCP server IDs to make available to the agent. */
139
141
  mcp_server_ids?: string[];
140
142
  /** Names of observability integrations to enable for the agent. Each must be one of the supported providers. */
@@ -141,6 +141,8 @@ export interface UpdateAgentRequest {
141
141
  vad_threshold?: number;
142
142
  /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE]`) and bleeped from audio recordings after the conversation ends. */
143
143
  enable_redaction?: boolean;
144
+ /** When `true`, an inaudible watermark is embedded in the audio the agent generates. */
145
+ enable_watermarking?: boolean;
144
146
  /** Array of MCP server IDs to make available to the agent. */
145
147
  mcp_server_ids?: string[];
146
148
  /** Names of observability integrations to enable for the agent. Each must be one of the supported providers. */
@@ -227,6 +227,8 @@ export declare class ConversationsClient {
227
227
  * @throws {@link Phonic.BadRequestError}
228
228
  * @throws {@link Phonic.UnauthorizedError}
229
229
  * @throws {@link Phonic.NotFoundError}
230
+ * @throws {@link Phonic.ConflictError}
231
+ * @throws {@link Phonic.TooManyRequestsError}
230
232
  * @throws {@link Phonic.InternalServerError}
231
233
  *
232
234
  * @example
@@ -264,6 +266,7 @@ export declare class ConversationsClient {
264
266
  * @throws {@link Phonic.BadRequestError}
265
267
  * @throws {@link Phonic.UnauthorizedError}
266
268
  * @throws {@link Phonic.ConflictError}
269
+ * @throws {@link Phonic.TooManyRequestsError}
267
270
  * @throws {@link Phonic.InternalServerError}
268
271
  *
269
272
  * @example
@@ -740,6 +740,8 @@ class ConversationsClient {
740
740
  * @throws {@link Phonic.BadRequestError}
741
741
  * @throws {@link Phonic.UnauthorizedError}
742
742
  * @throws {@link Phonic.NotFoundError}
743
+ * @throws {@link Phonic.ConflictError}
744
+ * @throws {@link Phonic.TooManyRequestsError}
743
745
  * @throws {@link Phonic.InternalServerError}
744
746
  *
745
747
  * @example
@@ -803,6 +805,10 @@ class ConversationsClient {
803
805
  throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
804
806
  case 404:
805
807
  throw new Phonic.NotFoundError(_response.error.body, _response.rawResponse);
808
+ case 409:
809
+ throw new Phonic.ConflictError(_response.error.body, _response.rawResponse);
810
+ case 429:
811
+ throw new Phonic.TooManyRequestsError(_response.error.body, _response.rawResponse);
806
812
  case 500:
807
813
  throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
808
814
  default:
@@ -825,6 +831,7 @@ class ConversationsClient {
825
831
  * @throws {@link Phonic.BadRequestError}
826
832
  * @throws {@link Phonic.UnauthorizedError}
827
833
  * @throws {@link Phonic.ConflictError}
834
+ * @throws {@link Phonic.TooManyRequestsError}
828
835
  * @throws {@link Phonic.InternalServerError}
829
836
  *
830
837
  * @example
@@ -876,6 +883,8 @@ class ConversationsClient {
876
883
  throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
877
884
  case 409:
878
885
  throw new Phonic.ConflictError(_response.error.body, _response.rawResponse);
886
+ case 429:
887
+ throw new Phonic.TooManyRequestsError(_response.error.body, _response.rawResponse);
879
888
  case 500:
880
889
  throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
881
890
  default:
@@ -21,6 +21,8 @@ export * from "./extractionSchemas/types/index.js";
21
21
  export * from "./projects/client/requests/index.js";
22
22
  export * as projects from "./projects/index.js";
23
23
  export * from "./projects/types/index.js";
24
+ export * from "./responses/client/requests/index.js";
25
+ export * as responses from "./responses/index.js";
24
26
  export * from "./tools/client/requests/index.js";
25
27
  export * as tools from "./tools/index.js";
26
28
  export * from "./tools/types/index.js";
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.workspace = exports.voices = exports.tts = exports.tools = exports.projects = exports.extractionSchemas = exports.externalStoragePolicies = exports.conversations = exports.conversationItems = exports.auth = exports.apiKeys = exports.agents = void 0;
39
+ exports.workspace = exports.voices = exports.tts = exports.tools = exports.responses = exports.projects = exports.extractionSchemas = exports.externalStoragePolicies = exports.conversations = exports.conversationItems = exports.auth = exports.apiKeys = exports.agents = void 0;
40
40
  __exportStar(require("./agents/client/requests/index.js"), exports);
41
41
  exports.agents = __importStar(require("./agents/index.js"));
42
42
  __exportStar(require("./agents/types/index.js"), exports);
@@ -60,6 +60,8 @@ __exportStar(require("./extractionSchemas/types/index.js"), exports);
60
60
  __exportStar(require("./projects/client/requests/index.js"), exports);
61
61
  exports.projects = __importStar(require("./projects/index.js"));
62
62
  __exportStar(require("./projects/types/index.js"), exports);
63
+ __exportStar(require("./responses/client/requests/index.js"), exports);
64
+ exports.responses = __importStar(require("./responses/index.js"));
63
65
  __exportStar(require("./tools/client/requests/index.js"), exports);
64
66
  exports.tools = __importStar(require("./tools/index.js"));
65
67
  __exportStar(require("./tools/types/index.js"), exports);
@@ -0,0 +1,72 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
+ import * as core from "../../../../core/index.js";
4
+ import * as Phonic from "../../../index.js";
5
+ export declare namespace ResponsesClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class ResponsesClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<ResponsesClient.Options>;
12
+ constructor(options?: ResponsesClient.Options);
13
+ /**
14
+ * Generates one or more alternative assistant responses for a conversation
15
+ * you supply inline to simulate Phonic agent behavior.
16
+ *
17
+ * This endpoint is stateless, so it does not create a new conversation or
18
+ * store anything. The request carries the system prompt, a conversation so
19
+ * far as `input`, and the tools the assistant may call as
20
+ * `tool_definitions`.
21
+ *
22
+ * Each item in `input` is a user message, an assistant message (with
23
+ * optional `tool_calls`), or a `tool_call_output`. Every assistant tool
24
+ * call must be followed immediately by the `tool_call_output` item that
25
+ * carries its result.
26
+ *
27
+ * This is an experimental feature and must be enabled for your workspace;
28
+ * otherwise, it returns `404`. Please contact our team if you would like
29
+ * access.
30
+ *
31
+ * @param {Phonic.GenerateResponsesRequest} request
32
+ * @param {ResponsesClient.RequestOptions} requestOptions - Request-specific configuration.
33
+ *
34
+ * @throws {@link Phonic.BadRequestError}
35
+ * @throws {@link Phonic.UnauthorizedError}
36
+ * @throws {@link Phonic.NotFoundError}
37
+ * @throws {@link Phonic.TooManyRequestsError}
38
+ * @throws {@link Phonic.InternalServerError}
39
+ * @throws {@link Phonic.BadGatewayError}
40
+ * @throws {@link Phonic.ServiceUnavailableError}
41
+ *
42
+ * @example
43
+ * await client.responses.create({
44
+ * system_prompt: "You help callers find a pizza shop. Be friendly and concise.",
45
+ * voice_id: "sabrina",
46
+ * default_language: "en",
47
+ * additional_languages: ["es"],
48
+ * input: [{
49
+ * role: "user",
50
+ * text: "Where should I get pizza near Union Square?"
51
+ * }],
52
+ * tool_definitions: [{
53
+ * name: "search_pizza_shop_recs",
54
+ * description: "Search for pizza shop recommendations.",
55
+ * parameters: {
56
+ * type: "object",
57
+ * properties: {
58
+ * "location": {
59
+ * "type": "string",
60
+ * "description": "The neighborhood to search in."
61
+ * }
62
+ * },
63
+ * required: ["location"],
64
+ * additionalProperties: false
65
+ * }
66
+ * }],
67
+ * num_responses: 2
68
+ * })
69
+ */
70
+ create(request: Phonic.GenerateResponsesRequest, requestOptions?: ResponsesClient.RequestOptions): core.HttpResponsePromise<Phonic.GenerateResponsesResponse>;
71
+ private __create;
72
+ }
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.ResponsesClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
48
+ const headers_js_1 = require("../../../../core/headers.js");
49
+ const core = __importStar(require("../../../../core/index.js"));
50
+ const environments = __importStar(require("../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
52
+ const errors = __importStar(require("../../../../errors/index.js"));
53
+ const Phonic = __importStar(require("../../../index.js"));
54
+ class ResponsesClient {
55
+ constructor(options = {}) {
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
+ }
58
+ /**
59
+ * Generates one or more alternative assistant responses for a conversation
60
+ * you supply inline to simulate Phonic agent behavior.
61
+ *
62
+ * This endpoint is stateless, so it does not create a new conversation or
63
+ * store anything. The request carries the system prompt, a conversation so
64
+ * far as `input`, and the tools the assistant may call as
65
+ * `tool_definitions`.
66
+ *
67
+ * Each item in `input` is a user message, an assistant message (with
68
+ * optional `tool_calls`), or a `tool_call_output`. Every assistant tool
69
+ * call must be followed immediately by the `tool_call_output` item that
70
+ * carries its result.
71
+ *
72
+ * This is an experimental feature and must be enabled for your workspace;
73
+ * otherwise, it returns `404`. Please contact our team if you would like
74
+ * access.
75
+ *
76
+ * @param {Phonic.GenerateResponsesRequest} request
77
+ * @param {ResponsesClient.RequestOptions} requestOptions - Request-specific configuration.
78
+ *
79
+ * @throws {@link Phonic.BadRequestError}
80
+ * @throws {@link Phonic.UnauthorizedError}
81
+ * @throws {@link Phonic.NotFoundError}
82
+ * @throws {@link Phonic.TooManyRequestsError}
83
+ * @throws {@link Phonic.InternalServerError}
84
+ * @throws {@link Phonic.BadGatewayError}
85
+ * @throws {@link Phonic.ServiceUnavailableError}
86
+ *
87
+ * @example
88
+ * await client.responses.create({
89
+ * system_prompt: "You help callers find a pizza shop. Be friendly and concise.",
90
+ * voice_id: "sabrina",
91
+ * default_language: "en",
92
+ * additional_languages: ["es"],
93
+ * input: [{
94
+ * role: "user",
95
+ * text: "Where should I get pizza near Union Square?"
96
+ * }],
97
+ * tool_definitions: [{
98
+ * name: "search_pizza_shop_recs",
99
+ * description: "Search for pizza shop recommendations.",
100
+ * parameters: {
101
+ * type: "object",
102
+ * properties: {
103
+ * "location": {
104
+ * "type": "string",
105
+ * "description": "The neighborhood to search in."
106
+ * }
107
+ * },
108
+ * required: ["location"],
109
+ * additionalProperties: false
110
+ * }
111
+ * }],
112
+ * num_responses: 2
113
+ * })
114
+ */
115
+ create(request, requestOptions) {
116
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
117
+ }
118
+ __create(request, requestOptions) {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
121
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
122
+ 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);
123
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
124
+ url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
125
+ .base, "responses"),
126
+ method: "POST",
127
+ headers: _headers,
128
+ contentType: "application/json",
129
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
130
+ requestType: "json",
131
+ body: request,
132
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
133
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
134
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
135
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
136
+ logging: this._options.logging,
137
+ });
138
+ if (_response.ok) {
139
+ return { data: _response.body, rawResponse: _response.rawResponse };
140
+ }
141
+ if (_response.error.reason === "status-code") {
142
+ switch (_response.error.statusCode) {
143
+ case 400:
144
+ throw new Phonic.BadRequestError(_response.error.body, _response.rawResponse);
145
+ case 401:
146
+ throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
147
+ case 404:
148
+ throw new Phonic.NotFoundError(_response.error.body, _response.rawResponse);
149
+ case 429:
150
+ throw new Phonic.TooManyRequestsError(_response.error.body, _response.rawResponse);
151
+ case 500:
152
+ throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
153
+ case 502:
154
+ throw new Phonic.BadGatewayError(_response.error.body, _response.rawResponse);
155
+ case 503:
156
+ throw new Phonic.ServiceUnavailableError(_response.error.body, _response.rawResponse);
157
+ default:
158
+ throw new errors.PhonicError({
159
+ statusCode: _response.error.statusCode,
160
+ body: _response.error.body,
161
+ rawResponse: _response.rawResponse,
162
+ });
163
+ }
164
+ }
165
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/responses");
166
+ });
167
+ }
168
+ }
169
+ exports.ResponsesClient = ResponsesClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,46 @@
1
+ import type * as Phonic from "../../../../index.js";
2
+ /**
3
+ * @example
4
+ * {
5
+ * system_prompt: "You help callers find a pizza shop. Be friendly and concise.",
6
+ * voice_id: "sabrina",
7
+ * default_language: "en",
8
+ * additional_languages: ["es"],
9
+ * input: [{
10
+ * role: "user",
11
+ * text: "Where should I get pizza near Union Square?"
12
+ * }],
13
+ * tool_definitions: [{
14
+ * name: "search_pizza_shop_recs",
15
+ * description: "Search for pizza shop recommendations.",
16
+ * parameters: {
17
+ * type: "object",
18
+ * properties: {
19
+ * "location": {
20
+ * "type": "string",
21
+ * "description": "The neighborhood to search in."
22
+ * }
23
+ * },
24
+ * required: ["location"],
25
+ * additionalProperties: false
26
+ * }
27
+ * }],
28
+ * num_responses: 2
29
+ * }
30
+ */
31
+ export interface GenerateResponsesRequest {
32
+ /** The system prompt the assistant should follow. */
33
+ system_prompt: string;
34
+ /** ID of the voice the assistant would speak with. It shapes how the responses are worded. */
35
+ voice_id?: string;
36
+ /** ISO 639-1 language code that sets the assistant's default language to recognize and speak. */
37
+ default_language?: Phonic.LanguageCode;
38
+ /** Array of additional ISO 639-1 language codes that the assistant should be able to recognize and speak. Should not include `default_language`. */
39
+ additional_languages?: Phonic.LanguageCode[];
40
+ /** The conversation so far, in order. Must contain at least one item. */
41
+ input: Phonic.ResponsesInputItem[];
42
+ /** The tools the assistant may call, defined inline. Names must be unique and cannot be one of the names Phonic reserves for its built-in tools. */
43
+ tool_definitions?: Phonic.ResponsesToolDefinition[];
44
+ /** Number of alternative responses to generate. */
45
+ num_responses?: number;
46
+ }
@@ -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 });
@@ -0,0 +1 @@
1
+ export type { GenerateResponsesRequest } from "./GenerateResponsesRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { ResponsesClient } from "./client/Client.js";
2
+ export * from "./client/index.js";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ResponsesClient = void 0;
19
+ var Client_js_1 = require("./client/Client.js");
20
+ Object.defineProperty(exports, "ResponsesClient", { enumerable: true, get: function () { return Client_js_1.ResponsesClient; } });
21
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);