phonic 0.31.12 → 0.31.15
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.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +6 -0
- package/dist/cjs/Client.js +20 -10
- package/dist/cjs/api/errors/UnprocessableEntityError.d.ts +6 -0
- package/dist/cjs/api/errors/UnprocessableEntityError.js +54 -0
- package/dist/cjs/api/errors/index.d.ts +1 -0
- package/dist/cjs/api/errors/index.js +1 -0
- package/dist/cjs/api/resources/conversationItems/client/Client.d.ts +39 -0
- package/dist/cjs/api/resources/conversationItems/client/Client.js +139 -0
- package/dist/cjs/api/resources/conversationItems/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/conversationItems/client/index.js +17 -0
- package/dist/cjs/api/resources/conversationItems/client/requests/ReplayConversationItemRequest.d.ts +12 -0
- package/dist/cjs/api/resources/conversationItems/client/requests/ReplayConversationItemRequest.js +3 -0
- package/dist/cjs/api/resources/conversationItems/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/conversationItems/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/conversationItems/exports.d.ts +2 -0
- package/dist/cjs/api/resources/conversationItems/exports.js +21 -0
- package/dist/cjs/api/resources/conversationItems/index.d.ts +1 -0
- package/dist/cjs/api/resources/conversationItems/index.js +17 -0
- package/dist/cjs/api/resources/conversations/client/Client.d.ts +1 -0
- package/dist/cjs/api/resources/conversations/client/Client.js +3 -0
- package/dist/cjs/api/resources/conversations/types/ConversationsListResponse.d.ts +1 -9
- package/dist/cjs/api/resources/index.d.ts +4 -0
- package/dist/cjs/api/resources/index.js +5 -1
- package/dist/cjs/api/resources/projects/client/requests/UpdateProjectRequest.d.ts +2 -0
- package/dist/cjs/api/resources/workspace/client/Client.d.ts +26 -0
- package/dist/cjs/api/resources/workspace/client/Client.js +110 -0
- package/dist/cjs/api/resources/workspace/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/workspace/client/index.js +2 -0
- package/dist/cjs/api/resources/workspace/exports.d.ts +2 -0
- package/dist/cjs/api/resources/workspace/exports.js +21 -0
- package/dist/cjs/api/resources/workspace/index.d.ts +2 -0
- package/dist/cjs/api/resources/workspace/index.js +18 -0
- package/dist/cjs/api/resources/workspace/types/WorkspaceGetResponse.d.ts +6 -0
- package/dist/cjs/api/resources/workspace/types/WorkspaceGetResponse.js +3 -0
- package/dist/cjs/api/resources/workspace/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/workspace/types/index.js +17 -0
- package/dist/cjs/api/types/BadRequestErrorBody.d.ts +1 -1
- package/dist/cjs/api/types/Conversation.d.ts +8 -0
- package/dist/cjs/api/types/ConversationItem.d.ts +2 -0
- package/dist/cjs/api/types/ConversationsListResponseConversation.d.ts +4 -0
- package/dist/cjs/api/types/ConversationsListResponseConversation.js +3 -0
- package/dist/cjs/api/types/ConversationsListResponseConversations.d.ts +5 -0
- package/dist/cjs/api/types/ConversationsListResponseConversations.js +3 -0
- package/dist/cjs/api/types/ConversationsListResponseConversationsPagination.d.ts +6 -0
- package/dist/cjs/api/types/ConversationsListResponseConversationsPagination.js +3 -0
- package/dist/cjs/api/types/Project.d.ts +4 -0
- package/dist/cjs/api/types/ReplayConversationItemResponse.d.ts +16 -0
- package/dist/cjs/api/types/ReplayConversationItemResponse.js +3 -0
- package/dist/cjs/api/types/ReplayToolCall.d.ts +29 -0
- package/dist/cjs/api/types/ReplayToolCall.js +12 -0
- package/dist/cjs/api/types/SipCallError.d.ts +24 -0
- package/dist/cjs/api/types/SipCallError.js +16 -0
- package/dist/cjs/api/types/index.d.ts +6 -0
- package/dist/cjs/api/types/index.js +6 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +6 -0
- package/dist/esm/Client.mjs +10 -0
- package/dist/esm/api/errors/UnprocessableEntityError.d.mts +6 -0
- package/dist/esm/api/errors/UnprocessableEntityError.mjs +17 -0
- package/dist/esm/api/errors/index.d.mts +1 -0
- package/dist/esm/api/errors/index.mjs +1 -0
- package/dist/esm/api/resources/conversationItems/client/Client.d.mts +39 -0
- package/dist/esm/api/resources/conversationItems/client/Client.mjs +102 -0
- package/dist/esm/api/resources/conversationItems/client/index.d.mts +1 -0
- package/dist/esm/api/resources/conversationItems/client/index.mjs +1 -0
- package/dist/esm/api/resources/conversationItems/client/requests/ReplayConversationItemRequest.d.mts +12 -0
- package/dist/esm/api/resources/conversationItems/client/requests/ReplayConversationItemRequest.mjs +2 -0
- package/dist/esm/api/resources/conversationItems/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/conversationItems/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/conversationItems/exports.d.mts +2 -0
- package/dist/esm/api/resources/conversationItems/exports.mjs +3 -0
- package/dist/esm/api/resources/conversationItems/index.d.mts +1 -0
- package/dist/esm/api/resources/conversationItems/index.mjs +1 -0
- package/dist/esm/api/resources/conversations/client/Client.d.mts +1 -0
- package/dist/esm/api/resources/conversations/client/Client.mjs +3 -0
- package/dist/esm/api/resources/conversations/types/ConversationsListResponse.d.mts +1 -9
- package/dist/esm/api/resources/index.d.mts +4 -0
- package/dist/esm/api/resources/index.mjs +4 -0
- package/dist/esm/api/resources/projects/client/requests/UpdateProjectRequest.d.mts +2 -0
- package/dist/esm/api/resources/workspace/client/Client.d.mts +26 -0
- package/dist/esm/api/resources/workspace/client/Client.mjs +73 -0
- package/dist/esm/api/resources/workspace/client/index.d.mts +1 -0
- package/dist/esm/api/resources/workspace/client/index.mjs +1 -0
- package/dist/esm/api/resources/workspace/exports.d.mts +2 -0
- package/dist/esm/api/resources/workspace/exports.mjs +3 -0
- package/dist/esm/api/resources/workspace/index.d.mts +2 -0
- package/dist/esm/api/resources/workspace/index.mjs +2 -0
- package/dist/esm/api/resources/workspace/types/WorkspaceGetResponse.d.mts +6 -0
- package/dist/esm/api/resources/workspace/types/WorkspaceGetResponse.mjs +2 -0
- package/dist/esm/api/resources/workspace/types/index.d.mts +1 -0
- package/dist/esm/api/resources/workspace/types/index.mjs +1 -0
- package/dist/esm/api/types/BadRequestErrorBody.d.mts +1 -1
- package/dist/esm/api/types/Conversation.d.mts +8 -0
- package/dist/esm/api/types/ConversationItem.d.mts +2 -0
- package/dist/esm/api/types/ConversationsListResponseConversation.d.mts +4 -0
- package/dist/esm/api/types/ConversationsListResponseConversation.mjs +2 -0
- package/dist/esm/api/types/ConversationsListResponseConversations.d.mts +5 -0
- package/dist/esm/api/types/ConversationsListResponseConversations.mjs +2 -0
- package/dist/esm/api/types/ConversationsListResponseConversationsPagination.d.mts +6 -0
- package/dist/esm/api/types/ConversationsListResponseConversationsPagination.mjs +2 -0
- package/dist/esm/api/types/Project.d.mts +4 -0
- package/dist/esm/api/types/ReplayConversationItemResponse.d.mts +16 -0
- package/dist/esm/api/types/ReplayConversationItemResponse.mjs +2 -0
- package/dist/esm/api/types/ReplayToolCall.d.mts +29 -0
- package/dist/esm/api/types/ReplayToolCall.mjs +9 -0
- package/dist/esm/api/types/SipCallError.d.mts +24 -0
- package/dist/esm/api/types/SipCallError.mjs +13 -0
- package/dist/esm/api/types/index.d.mts +6 -0
- package/dist/esm/api/types/index.mjs +6 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +30 -8
- package/reference.md +134 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -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.31.
|
|
47
|
-
"User-Agent": "phonic/0.31.
|
|
46
|
+
"X-Fern-SDK-Version": "0.31.13",
|
|
47
|
+
"User-Agent": "phonic/0.31.13",
|
|
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);
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { AgentsClient } from "./api/resources/agents/client/Client.js";
|
|
2
2
|
import { AuthClient } from "./api/resources/auth/client/Client.js";
|
|
3
|
+
import { ConversationItemsClient } from "./api/resources/conversationItems/client/Client.js";
|
|
3
4
|
import { ConversationsClient } from "./api/resources/conversations/client/Client.js";
|
|
4
5
|
import { ExtractionSchemasClient } from "./api/resources/extractionSchemas/client/Client.js";
|
|
5
6
|
import { ProjectsClient } from "./api/resources/projects/client/Client.js";
|
|
6
7
|
import { ToolsClient } from "./api/resources/tools/client/Client.js";
|
|
7
8
|
import { VoicesClient } from "./api/resources/voices/client/Client.js";
|
|
9
|
+
import { WorkspaceClient } from "./api/resources/workspace/client/Client.js";
|
|
8
10
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
9
11
|
import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
|
|
10
12
|
import * as core from "./core/index.js";
|
|
@@ -28,16 +30,20 @@ export declare class PhonicClient {
|
|
|
28
30
|
protected _extractionSchemas: ExtractionSchemasClient | undefined;
|
|
29
31
|
protected _voices: VoicesClient | undefined;
|
|
30
32
|
protected _conversations: ConversationsClient | undefined;
|
|
33
|
+
protected _conversationItems: ConversationItemsClient | undefined;
|
|
31
34
|
protected _auth: AuthClient | undefined;
|
|
32
35
|
protected _projects: ProjectsClient | undefined;
|
|
36
|
+
protected _workspace: WorkspaceClient | undefined;
|
|
33
37
|
constructor(options?: PhonicClient.Options);
|
|
34
38
|
get agents(): AgentsClient;
|
|
35
39
|
get tools(): ToolsClient;
|
|
36
40
|
get extractionSchemas(): ExtractionSchemasClient;
|
|
37
41
|
get voices(): VoicesClient;
|
|
38
42
|
get conversations(): ConversationsClient;
|
|
43
|
+
get conversationItems(): ConversationItemsClient;
|
|
39
44
|
get auth(): AuthClient;
|
|
40
45
|
get projects(): ProjectsClient;
|
|
46
|
+
get workspace(): WorkspaceClient;
|
|
41
47
|
/**
|
|
42
48
|
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
43
49
|
* This is useful for making requests to endpoints not yet supported in the SDK.
|
package/dist/cjs/Client.js
CHANGED
|
@@ -46,11 +46,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
46
46
|
exports.PhonicClient = void 0;
|
|
47
47
|
const Client_js_1 = require("./api/resources/agents/client/Client.js");
|
|
48
48
|
const Client_js_2 = require("./api/resources/auth/client/Client.js");
|
|
49
|
-
const Client_js_3 = require("./api/resources/
|
|
50
|
-
const Client_js_4 = require("./api/resources/
|
|
51
|
-
const Client_js_5 = require("./api/resources/
|
|
52
|
-
const Client_js_6 = require("./api/resources/
|
|
53
|
-
const Client_js_7 = require("./api/resources/
|
|
49
|
+
const Client_js_3 = require("./api/resources/conversationItems/client/Client.js");
|
|
50
|
+
const Client_js_4 = require("./api/resources/conversations/client/Client.js");
|
|
51
|
+
const Client_js_5 = require("./api/resources/extractionSchemas/client/Client.js");
|
|
52
|
+
const Client_js_6 = require("./api/resources/projects/client/Client.js");
|
|
53
|
+
const Client_js_7 = require("./api/resources/tools/client/Client.js");
|
|
54
|
+
const Client_js_8 = require("./api/resources/voices/client/Client.js");
|
|
55
|
+
const Client_js_9 = require("./api/resources/workspace/client/Client.js");
|
|
54
56
|
const BaseClient_js_1 = require("./BaseClient.js");
|
|
55
57
|
const core = __importStar(require("./core/index.js"));
|
|
56
58
|
const environments = __importStar(require("./environments.js"));
|
|
@@ -64,19 +66,23 @@ class PhonicClient {
|
|
|
64
66
|
}
|
|
65
67
|
get tools() {
|
|
66
68
|
var _a;
|
|
67
|
-
return ((_a = this._tools) !== null && _a !== void 0 ? _a : (this._tools = new
|
|
69
|
+
return ((_a = this._tools) !== null && _a !== void 0 ? _a : (this._tools = new Client_js_7.ToolsClient(this._options)));
|
|
68
70
|
}
|
|
69
71
|
get extractionSchemas() {
|
|
70
72
|
var _a;
|
|
71
|
-
return ((_a = this._extractionSchemas) !== null && _a !== void 0 ? _a : (this._extractionSchemas = new
|
|
73
|
+
return ((_a = this._extractionSchemas) !== null && _a !== void 0 ? _a : (this._extractionSchemas = new Client_js_5.ExtractionSchemasClient(this._options)));
|
|
72
74
|
}
|
|
73
75
|
get voices() {
|
|
74
76
|
var _a;
|
|
75
|
-
return ((_a = this._voices) !== null && _a !== void 0 ? _a : (this._voices = new
|
|
77
|
+
return ((_a = this._voices) !== null && _a !== void 0 ? _a : (this._voices = new Client_js_8.VoicesClient(this._options)));
|
|
76
78
|
}
|
|
77
79
|
get conversations() {
|
|
78
80
|
var _a;
|
|
79
|
-
return ((_a = this._conversations) !== null && _a !== void 0 ? _a : (this._conversations = new
|
|
81
|
+
return ((_a = this._conversations) !== null && _a !== void 0 ? _a : (this._conversations = new Client_js_4.ConversationsClient(this._options)));
|
|
82
|
+
}
|
|
83
|
+
get conversationItems() {
|
|
84
|
+
var _a;
|
|
85
|
+
return ((_a = this._conversationItems) !== null && _a !== void 0 ? _a : (this._conversationItems = new Client_js_3.ConversationItemsClient(this._options)));
|
|
80
86
|
}
|
|
81
87
|
get auth() {
|
|
82
88
|
var _a;
|
|
@@ -84,7 +90,11 @@ class PhonicClient {
|
|
|
84
90
|
}
|
|
85
91
|
get projects() {
|
|
86
92
|
var _a;
|
|
87
|
-
return ((_a = this._projects) !== null && _a !== void 0 ? _a : (this._projects = new
|
|
93
|
+
return ((_a = this._projects) !== null && _a !== void 0 ? _a : (this._projects = new Client_js_6.ProjectsClient(this._options)));
|
|
94
|
+
}
|
|
95
|
+
get workspace() {
|
|
96
|
+
var _a;
|
|
97
|
+
return ((_a = this._workspace) !== null && _a !== void 0 ? _a : (this._workspace = new Client_js_9.WorkspaceClient(this._options)));
|
|
88
98
|
}
|
|
89
99
|
/**
|
|
90
100
|
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
@@ -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 UnprocessableEntityError 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.UnprocessableEntityError = void 0;
|
|
38
|
+
const errors = __importStar(require("../../errors/index.js"));
|
|
39
|
+
class UnprocessableEntityError extends errors.PhonicError {
|
|
40
|
+
constructor(body, rawResponse) {
|
|
41
|
+
super({
|
|
42
|
+
message: "UnprocessableEntityError",
|
|
43
|
+
statusCode: 422,
|
|
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.UnprocessableEntityError = UnprocessableEntityError;
|
|
@@ -21,3 +21,4 @@ __exportStar(require("./GatewayTimeoutError.js"), exports);
|
|
|
21
21
|
__exportStar(require("./InternalServerError.js"), exports);
|
|
22
22
|
__exportStar(require("./NotFoundError.js"), exports);
|
|
23
23
|
__exportStar(require("./UnauthorizedError.js"), exports);
|
|
24
|
+
__exportStar(require("./UnprocessableEntityError.js"), exports);
|
|
@@ -0,0 +1,39 @@
|
|
|
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 ConversationItemsClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class ConversationItemsClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<ConversationItemsClient.Options>;
|
|
12
|
+
constructor(options?: ConversationItemsClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Returns the alternative response(s) the assistant would have
|
|
15
|
+
* produced for this conversation turn given changes to the agent system prompt.
|
|
16
|
+
*
|
|
17
|
+
* Only assistant items from ended conversations can be replayed. The
|
|
18
|
+
* conversation must have an associated agent.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} id - The ID of the conversation item to replay.
|
|
21
|
+
* @param {Phonic.ReplayConversationItemRequest} request
|
|
22
|
+
* @param {ConversationItemsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
23
|
+
*
|
|
24
|
+
* @throws {@link Phonic.BadRequestError}
|
|
25
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
26
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
27
|
+
* @throws {@link Phonic.NotFoundError}
|
|
28
|
+
* @throws {@link Phonic.ConflictError}
|
|
29
|
+
* @throws {@link Phonic.UnprocessableEntityError}
|
|
30
|
+
* @throws {@link Phonic.InternalServerError}
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* await client.conversationItems.replay("id", {
|
|
34
|
+
* system_prompt: "system_prompt"
|
|
35
|
+
* })
|
|
36
|
+
*/
|
|
37
|
+
replay(id: string, request: Phonic.ReplayConversationItemRequest, requestOptions?: ConversationItemsClient.RequestOptions): core.HttpResponsePromise<Phonic.ReplayConversationItemResponse>;
|
|
38
|
+
private __replay;
|
|
39
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
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.ConversationItemsClient = 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 ConversationItemsClient {
|
|
55
|
+
constructor(options = {}) {
|
|
56
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Returns the alternative response(s) the assistant would have
|
|
60
|
+
* produced for this conversation turn given changes to the agent system prompt.
|
|
61
|
+
*
|
|
62
|
+
* Only assistant items from ended conversations can be replayed. The
|
|
63
|
+
* conversation must have an associated agent.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} id - The ID of the conversation item to replay.
|
|
66
|
+
* @param {Phonic.ReplayConversationItemRequest} request
|
|
67
|
+
* @param {ConversationItemsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
68
|
+
*
|
|
69
|
+
* @throws {@link Phonic.BadRequestError}
|
|
70
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
71
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
72
|
+
* @throws {@link Phonic.NotFoundError}
|
|
73
|
+
* @throws {@link Phonic.ConflictError}
|
|
74
|
+
* @throws {@link Phonic.UnprocessableEntityError}
|
|
75
|
+
* @throws {@link Phonic.InternalServerError}
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* await client.conversationItems.replay("id", {
|
|
79
|
+
* system_prompt: "system_prompt"
|
|
80
|
+
* })
|
|
81
|
+
*/
|
|
82
|
+
replay(id, request, requestOptions) {
|
|
83
|
+
return core.HttpResponsePromise.fromPromise(this.__replay(id, request, requestOptions));
|
|
84
|
+
}
|
|
85
|
+
__replay(id, request, requestOptions) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
88
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
89
|
+
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);
|
|
90
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
91
|
+
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)
|
|
92
|
+
.base, `conversation_items/${core.url.encodePathParam(id)}/replay`),
|
|
93
|
+
method: "POST",
|
|
94
|
+
headers: _headers,
|
|
95
|
+
contentType: "application/json",
|
|
96
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
97
|
+
requestType: "json",
|
|
98
|
+
body: request,
|
|
99
|
+
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,
|
|
100
|
+
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,
|
|
101
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
102
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
103
|
+
logging: this._options.logging,
|
|
104
|
+
});
|
|
105
|
+
if (_response.ok) {
|
|
106
|
+
return {
|
|
107
|
+
data: _response.body,
|
|
108
|
+
rawResponse: _response.rawResponse,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (_response.error.reason === "status-code") {
|
|
112
|
+
switch (_response.error.statusCode) {
|
|
113
|
+
case 400:
|
|
114
|
+
throw new Phonic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
115
|
+
case 401:
|
|
116
|
+
throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
117
|
+
case 403:
|
|
118
|
+
throw new Phonic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
119
|
+
case 404:
|
|
120
|
+
throw new Phonic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
121
|
+
case 409:
|
|
122
|
+
throw new Phonic.ConflictError(_response.error.body, _response.rawResponse);
|
|
123
|
+
case 422:
|
|
124
|
+
throw new Phonic.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
125
|
+
case 500:
|
|
126
|
+
throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
127
|
+
default:
|
|
128
|
+
throw new errors.PhonicError({
|
|
129
|
+
statusCode: _response.error.statusCode,
|
|
130
|
+
body: _response.error.body,
|
|
131
|
+
rawResponse: _response.rawResponse,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/conversation_items/{id}/replay");
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.ConversationItemsClient = ConversationItemsClient;
|
|
@@ -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);
|
package/dist/cjs/api/resources/conversationItems/client/requests/ReplayConversationItemRequest.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* system_prompt: "system_prompt"
|
|
5
|
+
* }
|
|
6
|
+
*/
|
|
7
|
+
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;
|
|
10
|
+
/** Number of alternative responses to generate. */
|
|
11
|
+
num_responses?: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ReplayConversationItemRequest } from "./ReplayConversationItemRequest.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.ConversationItemsClient = void 0;
|
|
19
|
+
var Client_js_1 = require("./client/Client.js");
|
|
20
|
+
Object.defineProperty(exports, "ConversationItemsClient", { enumerable: true, get: function () { return Client_js_1.ConversationItemsClient; } });
|
|
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);
|
|
@@ -682,6 +682,7 @@ class ConversationsClient {
|
|
|
682
682
|
*
|
|
683
683
|
* @throws {@link Phonic.BadRequestError}
|
|
684
684
|
* @throws {@link Phonic.UnauthorizedError}
|
|
685
|
+
* @throws {@link Phonic.ConflictError}
|
|
685
686
|
* @throws {@link Phonic.InternalServerError}
|
|
686
687
|
*
|
|
687
688
|
* @example
|
|
@@ -731,6 +732,8 @@ class ConversationsClient {
|
|
|
731
732
|
throw new Phonic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
732
733
|
case 401:
|
|
733
734
|
throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
735
|
+
case 409:
|
|
736
|
+
throw new Phonic.ConflictError(_response.error.body, _response.rawResponse);
|
|
734
737
|
case 500:
|
|
735
738
|
throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
736
739
|
default:
|
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
import type * as Phonic from "../../../index.js";
|
|
2
|
-
export type ConversationsListResponse =
|
|
3
|
-
conversations: Phonic.Conversation[];
|
|
4
|
-
pagination: {
|
|
5
|
-
prev_cursor: string | null;
|
|
6
|
-
next_cursor: string | null;
|
|
7
|
-
};
|
|
8
|
-
} | {
|
|
9
|
-
conversation: Phonic.Conversation;
|
|
10
|
-
};
|
|
2
|
+
export type ConversationsListResponse = Phonic.ConversationsListResponseConversations | Phonic.ConversationsListResponseConversation;
|
|
@@ -4,6 +4,8 @@ export * from "./agents/types/index.js";
|
|
|
4
4
|
export * from "./auth/client/requests/index.js";
|
|
5
5
|
export * as auth from "./auth/index.js";
|
|
6
6
|
export * from "./auth/types/index.js";
|
|
7
|
+
export * from "./conversationItems/client/requests/index.js";
|
|
8
|
+
export * as conversationItems from "./conversationItems/index.js";
|
|
7
9
|
export * from "./conversations/client/requests/index.js";
|
|
8
10
|
export * as conversations from "./conversations/index.js";
|
|
9
11
|
export * from "./conversations/types/index.js";
|
|
@@ -19,3 +21,5 @@ export * from "./tools/types/index.js";
|
|
|
19
21
|
export * from "./voices/client/requests/index.js";
|
|
20
22
|
export * as voices from "./voices/index.js";
|
|
21
23
|
export * from "./voices/types/index.js";
|
|
24
|
+
export * as workspace from "./workspace/index.js";
|
|
25
|
+
export * from "./workspace/types/index.js";
|
|
@@ -36,13 +36,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.voices = exports.tools = exports.projects = exports.extractionSchemas = exports.conversations = exports.auth = exports.agents = void 0;
|
|
39
|
+
exports.workspace = exports.voices = exports.tools = exports.projects = exports.extractionSchemas = exports.conversations = exports.conversationItems = exports.auth = 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);
|
|
43
43
|
__exportStar(require("./auth/client/requests/index.js"), exports);
|
|
44
44
|
exports.auth = __importStar(require("./auth/index.js"));
|
|
45
45
|
__exportStar(require("./auth/types/index.js"), exports);
|
|
46
|
+
__exportStar(require("./conversationItems/client/requests/index.js"), exports);
|
|
47
|
+
exports.conversationItems = __importStar(require("./conversationItems/index.js"));
|
|
46
48
|
__exportStar(require("./conversations/client/requests/index.js"), exports);
|
|
47
49
|
exports.conversations = __importStar(require("./conversations/index.js"));
|
|
48
50
|
__exportStar(require("./conversations/types/index.js"), exports);
|
|
@@ -58,3 +60,5 @@ __exportStar(require("./tools/types/index.js"), exports);
|
|
|
58
60
|
__exportStar(require("./voices/client/requests/index.js"), exports);
|
|
59
61
|
exports.voices = __importStar(require("./voices/index.js"));
|
|
60
62
|
__exportStar(require("./voices/types/index.js"), exports);
|
|
63
|
+
exports.workspace = __importStar(require("./workspace/index.js"));
|
|
64
|
+
__exportStar(require("./workspace/types/index.js"), exports);
|
|
@@ -10,4 +10,6 @@ export interface UpdateProjectRequest {
|
|
|
10
10
|
name?: string;
|
|
11
11
|
/** The name of the new project's default agent. Set to `null` to remove the default agent. */
|
|
12
12
|
default_agent?: string | null;
|
|
13
|
+
/** Maximum number of concurrent conversations allowed for this project. When `null`, the workspace `max_active_conversations` limit is used. */
|
|
14
|
+
max_active_conversations?: number | null;
|
|
13
15
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 WorkspaceClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class WorkspaceClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<WorkspaceClient.Options>;
|
|
12
|
+
constructor(options?: WorkspaceClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Returns information about the workspace.
|
|
15
|
+
*
|
|
16
|
+
* @param {WorkspaceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
17
|
+
*
|
|
18
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
19
|
+
* @throws {@link Phonic.InternalServerError}
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* await client.workspace.get()
|
|
23
|
+
*/
|
|
24
|
+
get(requestOptions?: WorkspaceClient.RequestOptions): core.HttpResponsePromise<Phonic.WorkspaceGetResponse>;
|
|
25
|
+
private __get;
|
|
26
|
+
}
|