@ctchealth/plato-sdk 0.0.6 → 0.0.8

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/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@ctchealth/plato-sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
- "@vapi-ai/web": "2.1.8"
6
+ "@vapi-ai/web": "2.1.8",
7
+ "axios": "^1.7.9"
7
8
  },
8
9
  "type": "commonjs",
9
10
  "main": "./src/index.js",
@@ -11,5 +12,5 @@
11
12
  "publishConfig": {
12
13
  "access": "public"
13
14
  },
14
- "types": "./src/index.d.ts"
15
+ "types": "./../libs/plato-sdk/src/index.d.ts"
15
16
  }
@@ -1,3 +1,16 @@
1
+ /**
2
+ * Copyright (c) 2025 ctcHealth. All rights reserved.
3
+ *
4
+ * This file is part of the ctcHealth Plato Platform, a proprietary software system developed by ctcHealth.
5
+ *
6
+ * This source code and all related materials are confidential and proprietary to ctcHealth.
7
+ * Unauthorized access, use, copying, modification, distribution, or disclosure is strictly prohibited
8
+ * and may result in disciplinary action and civil and/or criminal penalties.
9
+ *
10
+ * This software is intended solely for authorized use within ctcHealth and its designated partners.
11
+ *
12
+ * For internal use only.
13
+ */
1
14
  export declare enum YearOfExperience {
2
15
  '1-5' = "1-5 years",
3
16
  '6-10' = "6-10 years",
@@ -28,8 +41,6 @@ export declare class PersonalityAndBehaviourDto {
28
41
  recognitionNeed: number;
29
42
  brandLoyalty: number;
30
43
  patientEmpathy: number;
31
- trainingDifficulty: number;
32
- friendliness: number;
33
44
  }
34
45
  export declare class ProfessionalProfileDto {
35
46
  practiceSettings: string;
@@ -48,18 +59,12 @@ export declare class CharacterCreateDto {
48
59
  segment: SegmentType;
49
60
  personalityAndBehaviour: PersonalityAndBehaviourDto;
50
61
  context: ContextDto;
51
- assistantGender: AssistantVoiceGender;
62
+ assistantGender?: AssistantVoiceGender;
52
63
  }
53
64
  export declare class ProductConfig {
54
65
  name: string;
55
66
  description: string;
56
67
  }
57
- export declare class TrainingConfigurationDto {
58
- readonly trainingDifficulty: number;
59
- readonly communicationFormality: number;
60
- readonly friendlinessLevel: number;
61
- readonly subjectMatterExpertise: number;
62
- }
63
68
  export declare class CreateSimulationDto {
64
69
  persona: CharacterCreateDto;
65
70
  product: ProductConfig;
@@ -67,7 +72,27 @@ export declare class CreateSimulationDto {
67
72
  scenario: string;
68
73
  objectives?: string[];
69
74
  anticipatedObjections?: string[];
70
- trainingConfiguration: TrainingConfigurationDto;
75
+ }
76
+ export type RecordingsLimit = 5 | 10 | 25;
77
+ export declare class SimulationRecordingsQueryDto {
78
+ limit?: RecordingsLimit;
79
+ page?: number;
80
+ sort?: SortOrder;
81
+ }
82
+ export declare enum SortOrder {
83
+ ASC = "asc",
84
+ DESC = "desc"
85
+ }
86
+ export declare enum RecordingStatus {
87
+ STARTED = "STARTED",
88
+ PROCESSING = "PROCESSING",
89
+ FINISHED = "FINISHED",
90
+ FAILED = "FAILED"
91
+ }
92
+ export declare class SimulationRecordingsDto {
93
+ _id: string;
94
+ createdAt: Date;
95
+ recordingStatus?: RecordingStatus;
71
96
  }
72
97
  export interface CallCreateDto {
73
98
  /**
@@ -116,6 +141,10 @@ export interface CallDTO {
116
141
  * call Recording URL
117
142
  */
118
143
  recordingUrl: string;
144
+ /**
145
+ * Status of recording processing (e.g., 'STARTED', 'PROCESSING', 'FINISHED', 'FAILED')
146
+ */
147
+ recordingStatus?: RecordingStatus;
119
148
  /**
120
149
  * Date and Time of the creation of the message
121
150
  */
@@ -1,6 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CreationPhase = exports.CreationStatus = exports.CreateSimulationDto = exports.TrainingConfigurationDto = exports.ProductConfig = exports.CharacterCreateDto = exports.ContextDto = exports.ProfessionalProfileDto = exports.PersonalityAndBehaviourDto = exports.AssistantVoiceGender = exports.SegmentType = exports.PracticeType = exports.YearOfExperience = void 0;
3
+ exports.CreationPhase = exports.CreationStatus = exports.SimulationRecordingsDto = exports.RecordingStatus = exports.SortOrder = exports.SimulationRecordingsQueryDto = exports.CreateSimulationDto = exports.ProductConfig = exports.CharacterCreateDto = exports.ContextDto = exports.ProfessionalProfileDto = exports.PersonalityAndBehaviourDto = exports.AssistantVoiceGender = exports.SegmentType = exports.PracticeType = exports.YearOfExperience = void 0;
4
+ /**
5
+ * Copyright (c) 2025 ctcHealth. All rights reserved.
6
+ *
7
+ * This file is part of the ctcHealth Plato Platform, a proprietary software system developed by ctcHealth.
8
+ *
9
+ * This source code and all related materials are confidential and proprietary to ctcHealth.
10
+ * Unauthorized access, use, copying, modification, distribution, or disclosure is strictly prohibited
11
+ * and may result in disciplinary action and civil and/or criminal penalties.
12
+ *
13
+ * This software is intended solely for authorized use within ctcHealth and its designated partners.
14
+ *
15
+ * For internal use only.
16
+ */
4
17
  var YearOfExperience;
5
18
  (function (YearOfExperience) {
6
19
  YearOfExperience["1-5"] = "1-5 years";
@@ -35,8 +48,6 @@ class PersonalityAndBehaviourDto {
35
48
  recognitionNeed;
36
49
  brandLoyalty;
37
50
  patientEmpathy;
38
- trainingDifficulty;
39
- friendliness;
40
51
  }
41
52
  exports.PersonalityAndBehaviourDto = PersonalityAndBehaviourDto;
42
53
  class ProfessionalProfileDto {
@@ -66,13 +77,6 @@ class ProductConfig {
66
77
  description;
67
78
  }
68
79
  exports.ProductConfig = ProductConfig;
69
- class TrainingConfigurationDto {
70
- trainingDifficulty;
71
- communicationFormality;
72
- friendlinessLevel;
73
- subjectMatterExpertise;
74
- }
75
- exports.TrainingConfigurationDto = TrainingConfigurationDto;
76
80
  class CreateSimulationDto {
77
81
  persona;
78
82
  product;
@@ -80,9 +84,32 @@ class CreateSimulationDto {
80
84
  scenario;
81
85
  objectives;
82
86
  anticipatedObjections;
83
- trainingConfiguration;
84
87
  }
85
88
  exports.CreateSimulationDto = CreateSimulationDto;
89
+ class SimulationRecordingsQueryDto {
90
+ limit;
91
+ page;
92
+ sort;
93
+ }
94
+ exports.SimulationRecordingsQueryDto = SimulationRecordingsQueryDto;
95
+ var SortOrder;
96
+ (function (SortOrder) {
97
+ SortOrder["ASC"] = "asc";
98
+ SortOrder["DESC"] = "desc";
99
+ })(SortOrder || (exports.SortOrder = SortOrder = {}));
100
+ var RecordingStatus;
101
+ (function (RecordingStatus) {
102
+ RecordingStatus["STARTED"] = "STARTED";
103
+ RecordingStatus["PROCESSING"] = "PROCESSING";
104
+ RecordingStatus["FINISHED"] = "FINISHED";
105
+ RecordingStatus["FAILED"] = "FAILED";
106
+ })(RecordingStatus || (exports.RecordingStatus = RecordingStatus = {}));
107
+ class SimulationRecordingsDto {
108
+ _id;
109
+ createdAt;
110
+ recordingStatus;
111
+ }
112
+ exports.SimulationRecordingsDto = SimulationRecordingsDto;
86
113
  var CreationStatus;
87
114
  (function (CreationStatus) {
88
115
  CreationStatus["CREATING"] = "CREATING";
@@ -1 +1 @@
1
- {"version":3,"file":"plato-intefaces.js","sourceRoot":"","sources":["../../../../../libs/plato-sdk/src/lib/plato-intefaces.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,qCAAmB,CAAA;IACnB,uCAAqB,CAAA;IACrB,yCAAuB,CAAA;IACvB,qCAAmB,CAAA;AACrB,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AAGD,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,4CAA4B,CAAA;IAC5B,qCAAqB,CAAA;IACrB,iEAAiD,CAAA;IACjD,iCAAiB,CAAA;AACnB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AACD,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,oDAAqC,CAAA;IACrC,0CAA2B,CAAA;IAC3B,0EAA2D,CAAA;IAC3D,gFAAiE,CAAA;IACjE,qDAAsC,CAAA;IACtC,wEAAyD,CAAA;AAC3D,C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Y,aASX;AATD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,8BAAa,CAAA;IACb,0CAAyB,CAAA;IACzB,0DAAyC,CAAA;IACzC,kEAAiD,CAAA;IACjD,kCAAiB,CAAA;IACjB,sCAAqB,CAAA;IACrB,gCAAe,CAAA;AACjB,CAAC,EATW,aAAa,6BAAb,aAAa,QASxB"}
1
+ {"version":3,"file":"plato-intefaces.js","sourceRoot":"","sources":["../../../../../libs/plato-sdk/src/lib/plato-intefaces.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,qCAAmB,CAAA;IACnB,uCAAqB,CAAA;IACrB,yCAAuB,CAAA;IACvB,qCAAmB,CAAA;AACrB,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AAED,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,4CAA4B,CAAA;IAC5B,qCAAqB,CAAA;IACrB,iEAAiD,CAAA;IACjD,iCAAiB,CAAA;AACnB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AACD,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,oDAAqC,CAAA;IACrC,0CAA2B,CAAA;IAC3B,0EAA2D,CAAA;IAC3D,gFAAiE,CAAA;IACjE,qDAAsC,CAAA;IACtC,wEAAyD,CAAA;AAC3D,CAAC,EAPW,WAAW,2BAAX,WAAW,QAOtB;AAED,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,qCAAa,CAAA;IACb,yCAAiB,CAAA;AACnB,CAAC,EAHW,oBAAoB,oCAApB,oBAAoB,QAG/B;AAED,MAAa,0BAA0B;IACrC,aAAa,CAAU;IACvB,mBAAmB,CAAU;IAC7B,eAAe,CAAU;IACzB,YAAY,CAAU;IACtB,cAAc,CAAU;CACzB;AAND,gEAMC;AAED,MAAa,sBAAsB;IACjC,gBAAgB,CAAU;IAC1B,gBAAgB,CAAU;IAC1B,uBAAuB,CAAU;I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ACzC,kEAAiD,CAAA;IACjD,kCAAiB,CAAA;IACjB,sCAAqB,CAAA;IACrB,gCAAe,CAAA;AACjB,CAAC,EATW,aAAa,6BAAb,aAAa,QASxB"}
@@ -1,4 +1,4 @@
1
- import { CreateSimulationDto, CreationPhase } from './plato-intefaces';
1
+ import { CallDTO, CreateSimulationDto, CreationPhase, SimulationRecordingsDto, SimulationRecordingsQueryDto } from './plato-intefaces';
2
2
  export interface ApiClientConfig {
3
3
  baseUrl: string;
4
4
  token?: string;
@@ -12,8 +12,8 @@ export interface CallEventMap {
12
12
  'call-end': void;
13
13
  'speech-start': void;
14
14
  'speech-end': void;
15
- 'error': Error;
16
- 'message': {
15
+ error: Error;
16
+ message: {
17
17
  type: string;
18
18
  role: string;
19
19
  transcript?: string;
@@ -57,6 +57,9 @@ export declare class PlatoApiClient {
57
57
  checkSimulationStatus(simulationId: string): Promise<{
58
58
  phase: CreationPhase;
59
59
  }>;
60
+ getCallDetails(callId: string): Promise<CallDTO>;
61
+ getCallRecordings(queryParams: SimulationRecordingsQueryDto): Promise<SimulationRecordingsDto[]>;
62
+ getCallRecording(callId: string): Promise<string>;
60
63
  /**
61
64
  * Remove all listeners for all call events.
62
65
  */
@@ -101,6 +101,44 @@ class PlatoApiClient {
101
101
  const res = await this.http.get(`/api/v1/simulation/status/${simulationId}`);
102
102
  return res.data;
103
103
  }
104
+ async getCallDetails(callId) {
105
+ try {
106
+ const res = await this.http.get(`/api/v1/simulation/call/${callId}`);
107
+ return res.data;
108
+ }
109
+ catch (e) {
110
+ if (axios_1.default.isAxiosError(e)) {
111
+ console.error('Error getting call details:', e.response?.data.message);
112
+ }
113
+ throw e;
114
+ }
115
+ }
116
+ async getCallRecordings(queryParams) {
117
+ try {
118
+ const res = await this.http.get(`/api/v1/simulation/call/recordings`, {
119
+ params: queryParams,
120
+ });
121
+ return res.data;
122
+ }
123
+ catch (e) {
124
+ if (axios_1.default.isAxiosError(e)) {
125
+ console.error('Error getting call recordings:', e.response?.data.message);
126
+ }
127
+ throw e;
128
+ }
129
+ }
130
+ async getCallRecording(callId) {
131
+ try {
132
+ const res = await this.http.get(`/api/v1/simulation/call/recordings/${callId}`);
133
+ return res.data;
134
+ }
135
+ catch (e) {
136
+ if (axios_1.default.isAxiosError(e)) {
137
+ console.error('Error getting call recording:', e.response?.data.message);
138
+ }
139
+ throw e;
140
+ }
141
+ }
104
142
  /**
105
143
  * Remove all listeners for all call events.
106
144
  */
@@ -118,7 +156,8 @@ class PlatoApiClient {
118
156
  this.eventsAttached = false;
119
157
  }
120
158
  async startCall(simulationId) {
121
- this.callControllerInstance = new web_1.default('f07d17ec-d4e6-487d-a0b9-0539c01aecbb', 'https://db41aykk1gw9e.cloudfront.net');
159
+ this.callControllerInstance = new web_1.default('f07d17ec-d4e6-487d-a0b9-0539c01aecbb', 'https://db41aykk1gw9e.cloudfront.net' // base url
160
+ );
122
161
  if (!this.eventsAttached) {
123
162
  this.attachEvents();
124
163
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plato-sdk.js","sourceRoot":"","sources":["../../../../../libs/plato-sdk/src/lib/plato-sdk.ts"],"names":[],"mappings":";;;;AAAA,0DAA6C;AAE7C,+DAAgC;AAkChC,MAAa,cAAc;IAiBL;IAhBZ,IAAI,CAAgB;IAC5B,sEAAsE;IAC9D,cAAc,GAAgD,EAAE,CAAC;IACjE,sBAAsB,CAAQ;IAC9B,cAAc,GAAG,KAAK,CAAC;IAC/B,UAAU,GAAqB;QAC7B,YAAY;QACZ,UAAU;QACV,cAAc;QACd,YAAY;QACZ,OAAO;QACP,SAAS;QACT,cAAc;KACf,CAAC;IAGF,YAAoB,MAAuB;QAAvB,WAAM,GAAN,MAAM,CAAiB;QACzC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,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V,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,OAAsB;QAC7C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE;YAC/D,GAAG,OAAO;SACX,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAe,CAAC;IAClC,CAAC;CACF;AA7ND,wCA6NC"}
package/README.md DELETED
@@ -1,246 +0,0 @@
1
- # Plato SDK
2
-
3
- A TypeScript SDK for interacting with the Plato API to create and manage AI-powered medical training simulations.
4
-
5
- ## Overview
6
-
7
- The Plato SDK provides a simple and type-safe way to integrate with the Plato platform, allowing you to create medical training simulations with AI personas and manage voice-based interactions.
8
-
9
- ## Features
10
-
11
- - 🎭 Create AI personas with customizable professional profiles and personalities
12
- - 🗣️ Real-time voice interactions with AI assistants
13
- - 📊 Comprehensive event system for call management
14
- - 🔒 Type-safe API with full TypeScript support
15
- - 🎯 Medical training simulation configuration
16
-
17
- ## Installation
18
-
19
- ```bash
20
- npm install plato-sdk
21
- ```
22
-
23
- ## Quick Start
24
-
25
- ```typescript
26
- import { PlatoApiClient } from 'plato-sdk';
27
-
28
- // Initialize the client
29
- const client = new PlatoApiClient({
30
- baseUrl: 'https://your-plato-api.com',
31
- token: 'your-api-token',
32
- user: 'test@test.test'
33
- });
34
-
35
- // Create a simulation
36
- const simulation = await client.createSimulation({
37
- "persona": {
38
- "professionalProfile": {
39
- "location": "City Hospital, New York",
40
- "practiceSettings": "Outpatient Clinic",
41
- "yearOfExperience": 12,
42
- "specialityAndDepartment": "Cardiology"
43
- },
44
- "segment": SegmentType.CostConsciousPrescriber,
45
- "assistantGender": AssistantVoiceGender.Male,
46
- "name": "Dr Vegapunk",
47
- "personalityAndBehaviour": {
48
- "riskTolerance": 40,
49
- "researchOrientation": 70,
50
- "recognitionNeed": 60,
51
- "brandLoyalty": 55,
52
- "patientEmpathy": 80,
53
- "trainingDifficulty": 50,
54
- "friendliness": 75
55
- },
56
- "context": {
57
- "subSpecialityOrTherapyFocus": "Hypertension management",
58
- "typicalPatientMix": "Elderly with comorbidities",
59
- "keyClinicalDrivers": "Reducing cardiovascular risk"
60
- }
61
- },
62
- "product": {
63
- "name": "Ibuprofen 1000mg",
64
- "description": "A nonsteroidal anti-inflammatory drug used to reduce pain, inflammation, and fever"
65
- },
66
- "presentation": "Oral tablets, 10 tablets per pack",
67
- "scenario": "Discussing treatment options for an elderly patient with chronic arthritis",
68
- "objectives": [
69
- "Demonstrate efficacy of Ibuprofen in pain management",
70
- "Highlight safety profile and contraindications",
71
- "Encourage patient adherence"
72
- ],
73
- "anticipatedObjections": [
74
- "Concerns about gastrointestinal side effects",
75
- "Preference for lower-cost generic alternatives",
76
- "Potential interactions with other medications"
77
- ],
78
- "trainingConfiguration": {
79
- "trainingDifficulty": 70,
80
- "communicationFormality": 75,
81
- "friendlinessLevel": 65,
82
- "subjectMatterExpertise": 80
83
- }
84
- });
85
-
86
- // Check the simulation status - If simulation creation phase is equals to FINISHED, the simulation is ready to use
87
- // If the simulation creation phase is ERROR the simulation creation failed and you need to retry creating a new one
88
- // tip: you can also check the simulation status periodically using a polling mechanism
89
- const status = await client.getSimulationStatus(simulation.simulationId);
90
-
91
- // Start a voice call
92
- const call = await client.startCall(simulation.simulationId);
93
-
94
- // Listen to call events
95
- call.on('call-start', () => {
96
- console.log('Call started');
97
- });
98
-
99
- call.on('message', (message) => {
100
- console.log('Message received:', message.transcript);
101
- });
102
-
103
- call.on('call-end', () => {
104
- console.log('Call ended');
105
- });
106
-
107
- // Stop the call when done
108
- call.stopCall();
109
- ```
110
-
111
- ## API Reference
112
-
113
- ### PlatoApiClient
114
-
115
- The main class for interacting with the Plato API.
116
-
117
- #### Constructor
118
-
119
- ```typescript
120
- new PlatoApiClient(config: ApiClientConfig)
121
- ```
122
-
123
- **Parameters:**
124
- - `config.baseUrl` (string): The base URL of the Plato API
125
- - `config.token` (string): Your API authentication token
126
- - `config.user` (string): Your user identifier
127
-
128
- #### Methods
129
-
130
- ##### createSimulation(params: CreateSimulationDto)
131
-
132
- Creates a new medical training simulation. It may take a few minutes for the simulation to be ready for use.
133
-
134
- **Returns:** `Promise<{ simulationId: string, phase: CreationPhase }>`
135
-
136
- ##### startCall(simulationId: string)
137
-
138
- Starts a voice call with the AI persona for the specified simulation.
139
-
140
- **Returns:** Object with:
141
- - `stopCall()`: Function to end the call
142
- - `callId`: Unique identifier for the call
143
- - `on<K>(event: K, listener: CallEventListener<K>)`: Subscribe to call events
144
- - `off<K>(event: K, listener: CallEventListener<K>)`: Unsubscribe from call events
145
-
146
- ## Checking Simulation Status
147
-
148
- You can check the current phase/status of a simulation using the `checkSimulationStatus` method. This is useful for polling the simulation creation process until it is ready or has failed.
149
-
150
- ```typescript
151
- const status = await client.checkSimulationStatus(simulation.simulationId);
152
- console.log('Current phase:', status.phase); // e.g., 'FINISHED', 'ERROR', etc.
153
- ```
154
-
155
- - **Returns:** `{ phase: CreationPhase }` — The current phase of the simulation creation process.
156
- - **Typical usage:** Poll this method until the phase is `FINISHED` or `ERROR` before starting a call.
157
-
158
- ## Event System
159
-
160
- The SDK provides a comprehensive event system for managing voice calls:
161
-
162
- ### Available Events
163
-
164
- - `call-start`: Triggered when a call begins
165
- - `call-end`: Triggered when a call ends
166
- - `speech-start`: Triggered when speech detection starts
167
- - `speech-end`: Triggered when speech detection ends
168
- - `message`: Triggered when a message is received (contains transcript and metadata)
169
- - `volume-level`: Triggered with volume level updates (number)
170
- - `error`: Triggered when an error occurs
171
-
172
- ### Event Usage
173
-
174
- ```typescript
175
- // Subscribe to events
176
- call.on('message', (message) => {
177
- console.log('Transcript:', message.transcript);
178
- console.log('Type:', message.transcriptType); // 'final' or 'partial'
179
- });
180
-
181
- call.on('volume-level', (level) => {
182
- console.log('Volume level:', level);
183
- });
184
-
185
- call.on('error', (error) => {
186
- console.error('Call error:', error);
187
- });
188
-
189
- ```
190
-
191
- ## Data Types
192
-
193
- ### CreateSimulationDto
194
-
195
- Configuration for creating a simulation:
196
-
197
- ```typescript
198
- interface CreateSimulationDto {
199
- persona: CharacterCreateDto;
200
- product: ProductConfig;
201
- presentation?: string;
202
- scenario: string;
203
- objectives?: string[];
204
- anticipatedObjections?: string[];
205
- trainingConfiguration: TrainingConfigurationDto;
206
- }
207
- ```
208
-
209
- ### CharacterCreateDto
210
-
211
- AI persona configuration:
212
-
213
- ```typescript
214
- interface CharacterCreateDto {
215
- name: string;
216
- professionalProfile: ProfessionalProfileDto;
217
- segment: SegmentType;
218
- personalityAndBehaviour: PersonalityAndBehaviourDto;
219
- context: ContextDto;
220
- assistantGender: AssistantVoiceGender;
221
- }
222
- ```
223
-
224
- ## Error Handling
225
-
226
- The SDK throws errors for invalid configurations and API failures:
227
-
228
- ```typescript
229
- try {
230
- const client = new PlatoApiClient({
231
- baseUrl: 'https://api.plato.com',
232
- token: 'your-token',
233
- user: 'your-user'
234
- });
235
-
236
- const simulation = await client.createSimulation(simulationConfig);
237
- const call = await client.startCall(simulation.simulationId);
238
- } catch (error) {
239
- console.error('Error:', error.message);
240
- }
241
- ```
242
-
243
-
244
- ## Support
245
-
246
- For support and questions, please contact the development team.