whio-api-sdk 1.0.176 → 1.0.178-beta
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/README.md +83 -0
- package/dist/src/sdk/sdk.d.ts +15 -2
- package/dist/src/sdk/sdk.js +77 -2
- package/dist/src/sdk/types.d.ts +40 -0
- package/dist/src/sdk/urls.d.ts +1 -0
- package/dist/src/sdk/urls.js +2 -0
- package/example-agent-settings.ts +77 -0
- package/package.json +1 -1
- package/src/sdk/sdk.ts +75 -1
- package/src/sdk/types.ts +49 -0
- package/src/sdk/urls.ts +3 -0
package/README.md
CHANGED
|
@@ -1,2 +1,85 @@
|
|
|
1
1
|
# whio-sdk
|
|
2
2
|
A JS SDK that interacts with our medical-assistant-api
|
|
3
|
+
|
|
4
|
+
## Audio Transcription Queue
|
|
5
|
+
|
|
6
|
+
The SDK now supports automatic audio transcription through a background queue system. When you upload audio files, they are automatically processed and transcribed.
|
|
7
|
+
|
|
8
|
+
### Upload Audio with Transcription Queue
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
import { ApiSDK, AudioFileStatus } from 'whio-sdk';
|
|
12
|
+
|
|
13
|
+
const sdk = new ApiSDK({ baseUrl: 'https://your-api.com' });
|
|
14
|
+
|
|
15
|
+
// Simple upload (automatically triggers transcription)
|
|
16
|
+
const audioFile = await sdk.uploadAudioFileToSession(sessionId, file);
|
|
17
|
+
|
|
18
|
+
// Upload with cultural context
|
|
19
|
+
const audioFileWithContext = await sdk.uploadAudioFileToSession(
|
|
20
|
+
sessionId,
|
|
21
|
+
file,
|
|
22
|
+
'audio.mp3',
|
|
23
|
+
'This is cultural context for the audio'
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// Alternative method with options object
|
|
27
|
+
const audioFileAlt = await sdk.uploadAudioFileWithTranscriptionQueue(sessionId, file, {
|
|
28
|
+
fileName: 'recording.mp3',
|
|
29
|
+
culturalTranscription: 'Patient discussing symptoms in Māori'
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Check Transcription Results
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
// Get specific audio file with transcription results
|
|
37
|
+
const audioFile = await sdk.getAudioFile(audioFileId);
|
|
38
|
+
|
|
39
|
+
if (audioFile.status === AudioFileStatus.TRANSCRIBED) {
|
|
40
|
+
console.log('Transcription:', audioFile.transcription);
|
|
41
|
+
console.log('Cultural Context:', audioFile.cultural_transcription);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Get all transcribed files
|
|
45
|
+
const transcribedFiles = await sdk.getTranscribedAudioFiles();
|
|
46
|
+
|
|
47
|
+
// Get files currently being processed
|
|
48
|
+
const processingFiles = await sdk.getProcessingAudioFiles();
|
|
49
|
+
|
|
50
|
+
// Get failed transcriptions
|
|
51
|
+
const failedFiles = await sdk.getFailedAudioFiles();
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Audio File Status
|
|
55
|
+
|
|
56
|
+
Audio files have the following status values:
|
|
57
|
+
- `UPLOADED` - File uploaded, waiting for transcription
|
|
58
|
+
- `PROCESSING` - Currently being transcribed
|
|
59
|
+
- `TRANSCRIBED` - Transcription complete
|
|
60
|
+
- `FAILED` - Transcription failed
|
|
61
|
+
|
|
62
|
+
### Key Features
|
|
63
|
+
|
|
64
|
+
- **Automatic Processing**: Upload triggers transcription automatically
|
|
65
|
+
- **Serial Processing**: Files are processed one at a time for reliability
|
|
66
|
+
- **Cultural Context**: Optional cultural transcription field for context
|
|
67
|
+
- **Status Tracking**: Monitor transcription progress
|
|
68
|
+
- **Error Handling**: Graceful handling of transcription failures
|
|
69
|
+
- **Fire and Forget**: No polling required - just upload and check later
|
|
70
|
+
|
|
71
|
+
### Example Usage
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
// Upload and get immediate response
|
|
75
|
+
const audioFile = await sdk.uploadAudioFileToSession(sessionId, audioBlob, 'recording.wav');
|
|
76
|
+
console.log('Status:', audioFile.status); // 'UPLOADED'
|
|
77
|
+
|
|
78
|
+
// Check later for transcription results
|
|
79
|
+
setTimeout(async () => {
|
|
80
|
+
const updatedFile = await sdk.getAudioFile(audioFile.id);
|
|
81
|
+
if (updatedFile.status === AudioFileStatus.TRANSCRIBED) {
|
|
82
|
+
console.log('Transcription ready:', updatedFile.transcription);
|
|
83
|
+
}
|
|
84
|
+
}, 10000); // Check after 10 seconds
|
|
85
|
+
```
|
package/dist/src/sdk/sdk.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoginResponse, LoginCredentials, SDKConfig, User, UpdateUserDto, Organization, TemplateCategory, Template, Team, UserTemplate, TranscriptionSummary, TranscriptionAudioUploadResponse, PasswordChangeResponse, Session, CreateSessionDto, UpdateSessionDto, Agent, AudioFile, UpdateAudioFileDto } from './types';
|
|
1
|
+
import { LoginResponse, LoginCredentials, SDKConfig, User, UpdateUserDto, Organization, TemplateCategory, Template, Team, UserTemplate, TranscriptionSummary, TranscriptionAudioUploadResponse, PasswordChangeResponse, Session, CreateSessionDto, UpdateSessionDto, Agent, AudioFile, UpdateAudioFileDto, AgentSettings, CreateAgentSettingsDto, UpdateAgentSettingsDto } from './types';
|
|
2
2
|
export declare class ApiSDK {
|
|
3
3
|
private baseUrl;
|
|
4
4
|
private storage;
|
|
@@ -96,7 +96,17 @@ export declare class ApiSDK {
|
|
|
96
96
|
deleteAgent(id: string): Promise<void>;
|
|
97
97
|
addAgentToOrganization(agentId: string, organizationId: string): Promise<void>;
|
|
98
98
|
removeAgentFromOrganization(agentId: string, organizationId: string): Promise<void>;
|
|
99
|
-
|
|
99
|
+
createAgentSettings(settingsData: CreateAgentSettingsDto): Promise<AgentSettings>;
|
|
100
|
+
getAgentSettings(organizationId?: string, agentId?: string): Promise<AgentSettings[]>;
|
|
101
|
+
getAgentSettingsById(id: string): Promise<AgentSettings>;
|
|
102
|
+
getAgentSettingsByAgentAndOrganization(agentId: string, organizationId: string): Promise<AgentSettings>;
|
|
103
|
+
updateAgentSettings(id: string, settingsData: UpdateAgentSettingsDto): Promise<AgentSettings>;
|
|
104
|
+
deleteAgentSettings(id: string): Promise<void>;
|
|
105
|
+
uploadAudioFileToSession(sessionId: string, file: File | Blob, fileName?: string, culturalTranscription?: string): Promise<AudioFile>;
|
|
106
|
+
uploadAudioFileWithTranscriptionQueue(sessionId: string, file: File | Blob, options?: {
|
|
107
|
+
fileName?: string;
|
|
108
|
+
culturalTranscription?: string;
|
|
109
|
+
}): Promise<AudioFile>;
|
|
100
110
|
getMyAudioFiles(): Promise<AudioFile[]>;
|
|
101
111
|
getAllAudioFiles(): Promise<AudioFile[]>;
|
|
102
112
|
getOrganizationAudioFiles(): Promise<AudioFile[]>;
|
|
@@ -106,4 +116,7 @@ export declare class ApiSDK {
|
|
|
106
116
|
deleteAudioFile(id: string): Promise<void>;
|
|
107
117
|
downloadAudioFile(id: string): Promise<Blob>;
|
|
108
118
|
downloadAudioFileAsUrl(id: string): Promise<string>;
|
|
119
|
+
getTranscribedAudioFiles(): Promise<AudioFile[]>;
|
|
120
|
+
getProcessingAudioFiles(): Promise<AudioFile[]>;
|
|
121
|
+
getFailedAudioFiles(): Promise<AudioFile[]>;
|
|
109
122
|
}
|
package/dist/src/sdk/sdk.js
CHANGED
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
// sdk.ts
|
|
11
|
-
import { OrganizationRoleType, } from './types';
|
|
11
|
+
import { OrganizationRoleType, AudioFileStatus, } from './types';
|
|
12
12
|
import urls from './urls';
|
|
13
13
|
import { jwtDecode } from 'jwt-decode';
|
|
14
14
|
export class ApiSDK {
|
|
@@ -724,12 +724,66 @@ export class ApiSDK {
|
|
|
724
724
|
});
|
|
725
725
|
}
|
|
726
726
|
// ======================
|
|
727
|
+
// AGENT SETTINGS METHODS
|
|
728
|
+
// ======================
|
|
729
|
+
createAgentSettings(settingsData) {
|
|
730
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
731
|
+
return this.request(urls.agentSettings, 'POST', settingsData);
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
getAgentSettings(organizationId, agentId) {
|
|
735
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
736
|
+
const params = new URLSearchParams();
|
|
737
|
+
if (organizationId)
|
|
738
|
+
params.append('organizationId', organizationId);
|
|
739
|
+
if (agentId)
|
|
740
|
+
params.append('agentId', agentId);
|
|
741
|
+
const queryString = params.toString();
|
|
742
|
+
const endpoint = queryString ? `${urls.agentSettings}?${queryString}` : urls.agentSettings;
|
|
743
|
+
return this.request(endpoint, 'GET');
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
getAgentSettingsById(id) {
|
|
747
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
748
|
+
return this.request(`${urls.agentSettings}/${id}`, 'GET');
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
getAgentSettingsByAgentAndOrganization(agentId, organizationId) {
|
|
752
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
753
|
+
return this.request(`${urls.agentSettings}/agent/${agentId}/organization/${organizationId}`, 'GET');
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
updateAgentSettings(id, settingsData) {
|
|
757
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
758
|
+
return this.request(`${urls.agentSettings}/${id}`, 'PATCH', settingsData);
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
deleteAgentSettings(id) {
|
|
762
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
763
|
+
yield this.request(`${urls.agentSettings}/${id}`, 'DELETE');
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
// ======================
|
|
727
767
|
// AUDIO FILE METHODS
|
|
728
768
|
// ======================
|
|
729
|
-
uploadAudioFileToSession(sessionId, file, fileName) {
|
|
769
|
+
uploadAudioFileToSession(sessionId, file, fileName, culturalTranscription) {
|
|
730
770
|
return __awaiter(this, void 0, void 0, function* () {
|
|
731
771
|
const formData = new FormData();
|
|
732
772
|
formData.append('file', file, fileName);
|
|
773
|
+
if (culturalTranscription) {
|
|
774
|
+
formData.append('cultural_transcription', culturalTranscription);
|
|
775
|
+
}
|
|
776
|
+
return this.fileUploadRequest(`${urls.audioFiles}/upload/${sessionId}`, formData);
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
uploadAudioFileWithTranscriptionQueue(sessionId, file, options) {
|
|
780
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
781
|
+
const formData = new FormData();
|
|
782
|
+
formData.append('file', file, options === null || options === void 0 ? void 0 : options.fileName);
|
|
783
|
+
if (options === null || options === void 0 ? void 0 : options.culturalTranscription) {
|
|
784
|
+
formData.append('cultural_transcription', options.culturalTranscription);
|
|
785
|
+
}
|
|
786
|
+
// This will automatically trigger the transcription queue
|
|
733
787
|
return this.fileUploadRequest(`${urls.audioFiles}/upload/${sessionId}`, formData);
|
|
734
788
|
});
|
|
735
789
|
}
|
|
@@ -797,4 +851,25 @@ export class ApiSDK {
|
|
|
797
851
|
return URL.createObjectURL(blob);
|
|
798
852
|
});
|
|
799
853
|
}
|
|
854
|
+
// ======================
|
|
855
|
+
// TRANSCRIPTION QUEUE HELPER METHODS
|
|
856
|
+
// ======================
|
|
857
|
+
getTranscribedAudioFiles() {
|
|
858
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
859
|
+
const audioFiles = yield this.getMyAudioFiles();
|
|
860
|
+
return audioFiles.filter(file => file.status === AudioFileStatus.TRANSCRIBED && file.transcription);
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
getProcessingAudioFiles() {
|
|
864
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
865
|
+
const audioFiles = yield this.getMyAudioFiles();
|
|
866
|
+
return audioFiles.filter(file => file.status === AudioFileStatus.PROCESSING);
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
getFailedAudioFiles() {
|
|
870
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
871
|
+
const audioFiles = yield this.getMyAudioFiles();
|
|
872
|
+
return audioFiles.filter(file => file.status === AudioFileStatus.FAILED);
|
|
873
|
+
});
|
|
874
|
+
}
|
|
800
875
|
}
|
package/dist/src/sdk/types.d.ts
CHANGED
|
@@ -270,6 +270,8 @@ export interface PasswordChangeResponse {
|
|
|
270
270
|
export interface Session {
|
|
271
271
|
id: string;
|
|
272
272
|
transcript: string;
|
|
273
|
+
medicalTranscription?: string;
|
|
274
|
+
culturalTranscription?: string;
|
|
273
275
|
dateTime: string;
|
|
274
276
|
startDateTime?: string;
|
|
275
277
|
stopDateTime?: string;
|
|
@@ -288,6 +290,8 @@ export interface Session {
|
|
|
288
290
|
}
|
|
289
291
|
export interface CreateSessionDto {
|
|
290
292
|
transcript: string;
|
|
293
|
+
medicalTranscription?: string;
|
|
294
|
+
culturalTranscription?: string;
|
|
291
295
|
dateTime: string;
|
|
292
296
|
startDateTime?: string;
|
|
293
297
|
stopDateTime?: string;
|
|
@@ -299,6 +303,8 @@ export interface CreateSessionDto {
|
|
|
299
303
|
}
|
|
300
304
|
export interface UpdateSessionDto {
|
|
301
305
|
transcript?: string;
|
|
306
|
+
medicalTranscription?: string;
|
|
307
|
+
culturalTranscription?: string;
|
|
302
308
|
dateTime?: string;
|
|
303
309
|
startDateTime?: string;
|
|
304
310
|
stopDateTime?: string;
|
|
@@ -343,6 +349,8 @@ export interface AudioFile {
|
|
|
343
349
|
mimeType: string;
|
|
344
350
|
uploadId?: string;
|
|
345
351
|
transcriptionUrl?: string;
|
|
352
|
+
transcription?: string;
|
|
353
|
+
cultural_transcription?: string;
|
|
346
354
|
status: AudioFileStatus;
|
|
347
355
|
createdAt: string;
|
|
348
356
|
updatedAt: string;
|
|
@@ -362,5 +370,37 @@ export interface CreateAudioFileDto {
|
|
|
362
370
|
}
|
|
363
371
|
export interface UpdateAudioFileDto {
|
|
364
372
|
transcriptionUrl?: string;
|
|
373
|
+
transcription?: string;
|
|
374
|
+
cultural_transcription?: string;
|
|
365
375
|
status?: AudioFileStatus;
|
|
366
376
|
}
|
|
377
|
+
export interface UploadAudioFileDto {
|
|
378
|
+
cultural_transcription?: string;
|
|
379
|
+
}
|
|
380
|
+
export interface AgentSettings {
|
|
381
|
+
id: string;
|
|
382
|
+
temperature: number;
|
|
383
|
+
topK: number;
|
|
384
|
+
topP: number;
|
|
385
|
+
repetitionPenalty: number;
|
|
386
|
+
createdAt: string;
|
|
387
|
+
updatedAt: string;
|
|
388
|
+
agentId: string;
|
|
389
|
+
organizationId: string;
|
|
390
|
+
agent?: Agent;
|
|
391
|
+
organization?: Organization;
|
|
392
|
+
}
|
|
393
|
+
export interface CreateAgentSettingsDto {
|
|
394
|
+
agentId: string;
|
|
395
|
+
organizationId: string;
|
|
396
|
+
temperature?: number;
|
|
397
|
+
topK?: number;
|
|
398
|
+
topP?: number;
|
|
399
|
+
repetitionPenalty?: number;
|
|
400
|
+
}
|
|
401
|
+
export interface UpdateAgentSettingsDto {
|
|
402
|
+
temperature?: number;
|
|
403
|
+
topK?: number;
|
|
404
|
+
topP?: number;
|
|
405
|
+
repetitionPenalty?: number;
|
|
406
|
+
}
|
package/dist/src/sdk/urls.d.ts
CHANGED
package/dist/src/sdk/urls.js
CHANGED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Example usage of AgentSettings functionality
|
|
2
|
+
import { ApiSDK, CreateAgentSettingsDto, UpdateAgentSettingsDto } from './src/sdk';
|
|
3
|
+
|
|
4
|
+
async function exampleAgentSettingsUsage() {
|
|
5
|
+
// Initialize SDK
|
|
6
|
+
const sdk = new ApiSDK({
|
|
7
|
+
baseUrl: 'http://localhost:3000',
|
|
8
|
+
storage: {
|
|
9
|
+
getItem: (key) => localStorage.getItem(key),
|
|
10
|
+
setItem: (key, value) => localStorage.setItem(key, value),
|
|
11
|
+
removeItem: (key) => localStorage.removeItem(key),
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
// Login first (superuser required for agent settings)
|
|
17
|
+
await sdk.login({
|
|
18
|
+
email: 'superuser@example.com',
|
|
19
|
+
password: 'password123'
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Create agent settings
|
|
23
|
+
const createData: CreateAgentSettingsDto = {
|
|
24
|
+
agentId: 'agent-uuid-here',
|
|
25
|
+
organizationId: 'org-uuid-here',
|
|
26
|
+
temperature: 0.7,
|
|
27
|
+
topK: 40,
|
|
28
|
+
topP: 0.9,
|
|
29
|
+
repetitionPenalty: 1.1
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const newSettings = await sdk.createAgentSettings(createData);
|
|
33
|
+
console.log('Created agent settings:', newSettings);
|
|
34
|
+
|
|
35
|
+
// Get all agent settings
|
|
36
|
+
const allSettings = await sdk.getAgentSettings();
|
|
37
|
+
console.log('All agent settings:', allSettings);
|
|
38
|
+
|
|
39
|
+
// Get settings for specific organization
|
|
40
|
+
const orgSettings = await sdk.getAgentSettings('org-uuid-here');
|
|
41
|
+
console.log('Organization settings:', orgSettings);
|
|
42
|
+
|
|
43
|
+
// Get settings for specific agent
|
|
44
|
+
const agentSettings = await sdk.getAgentSettings(undefined, 'agent-uuid-here');
|
|
45
|
+
console.log('Agent settings:', agentSettings);
|
|
46
|
+
|
|
47
|
+
// Get specific settings by agent and organization
|
|
48
|
+
const specificSettings = await sdk.getAgentSettingsByAgentAndOrganization(
|
|
49
|
+
'agent-uuid-here',
|
|
50
|
+
'org-uuid-here'
|
|
51
|
+
);
|
|
52
|
+
console.log('Specific settings:', specificSettings);
|
|
53
|
+
|
|
54
|
+
// Update agent settings
|
|
55
|
+
const updateData: UpdateAgentSettingsDto = {
|
|
56
|
+
temperature: 0.8,
|
|
57
|
+
topK: 50
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const updatedSettings = await sdk.updateAgentSettings(newSettings.id, updateData);
|
|
61
|
+
console.log('Updated settings:', updatedSettings);
|
|
62
|
+
|
|
63
|
+
// Get settings by ID
|
|
64
|
+
const settingsById = await sdk.getAgentSettingsById(newSettings.id);
|
|
65
|
+
console.log('Settings by ID:', settingsById);
|
|
66
|
+
|
|
67
|
+
// Delete agent settings
|
|
68
|
+
await sdk.deleteAgentSettings(newSettings.id);
|
|
69
|
+
console.log('Agent settings deleted');
|
|
70
|
+
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error('Error:', error);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Export for use in other files
|
|
77
|
+
export { exampleAgentSettingsUsage };
|
package/package.json
CHANGED
package/src/sdk/sdk.ts
CHANGED
|
@@ -44,6 +44,10 @@ import {
|
|
|
44
44
|
AudioFileStatus,
|
|
45
45
|
CreateAudioFileDto,
|
|
46
46
|
UpdateAudioFileDto,
|
|
47
|
+
UploadAudioFileDto,
|
|
48
|
+
AgentSettings,
|
|
49
|
+
CreateAgentSettingsDto,
|
|
50
|
+
UpdateAgentSettingsDto,
|
|
47
51
|
} from './types';
|
|
48
52
|
import urls from './urls';
|
|
49
53
|
import { jwtDecode } from 'jwt-decode';
|
|
@@ -790,14 +794,65 @@ export class ApiSDK {
|
|
|
790
794
|
await this.request(`${urls.agents}/${agentId}/organizations/${organizationId}`, 'DELETE');
|
|
791
795
|
}
|
|
792
796
|
|
|
797
|
+
// ======================
|
|
798
|
+
// AGENT SETTINGS METHODS
|
|
799
|
+
// ======================
|
|
800
|
+
|
|
801
|
+
public async createAgentSettings(settingsData: CreateAgentSettingsDto): Promise<AgentSettings> {
|
|
802
|
+
return this.request<AgentSettings>(urls.agentSettings, 'POST', settingsData);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
public async getAgentSettings(organizationId?: string, agentId?: string): Promise<AgentSettings[]> {
|
|
806
|
+
const params = new URLSearchParams();
|
|
807
|
+
if (organizationId) params.append('organizationId', organizationId);
|
|
808
|
+
if (agentId) params.append('agentId', agentId);
|
|
809
|
+
|
|
810
|
+
const queryString = params.toString();
|
|
811
|
+
const endpoint = queryString ? `${urls.agentSettings}?${queryString}` : urls.agentSettings;
|
|
812
|
+
|
|
813
|
+
return this.request<AgentSettings[]>(endpoint, 'GET');
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
public async getAgentSettingsById(id: string): Promise<AgentSettings> {
|
|
817
|
+
return this.request<AgentSettings>(`${urls.agentSettings}/${id}`, 'GET');
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
public async getAgentSettingsByAgentAndOrganization(agentId: string, organizationId: string): Promise<AgentSettings> {
|
|
821
|
+
return this.request<AgentSettings>(`${urls.agentSettings}/agent/${agentId}/organization/${organizationId}`, 'GET');
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
public async updateAgentSettings(id: string, settingsData: UpdateAgentSettingsDto): Promise<AgentSettings> {
|
|
825
|
+
return this.request<AgentSettings>(`${urls.agentSettings}/${id}`, 'PATCH', settingsData);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
public async deleteAgentSettings(id: string): Promise<void> {
|
|
829
|
+
await this.request(`${urls.agentSettings}/${id}`, 'DELETE');
|
|
830
|
+
}
|
|
831
|
+
|
|
793
832
|
// ======================
|
|
794
833
|
// AUDIO FILE METHODS
|
|
795
834
|
// ======================
|
|
796
835
|
|
|
797
|
-
public async uploadAudioFileToSession(sessionId: string, file: File | Blob, fileName?: string): Promise<AudioFile> {
|
|
836
|
+
public async uploadAudioFileToSession(sessionId: string, file: File | Blob, fileName?: string, culturalTranscription?: string): Promise<AudioFile> {
|
|
798
837
|
const formData = new FormData();
|
|
799
838
|
formData.append('file', file, fileName);
|
|
800
839
|
|
|
840
|
+
if (culturalTranscription) {
|
|
841
|
+
formData.append('cultural_transcription', culturalTranscription);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
return this.fileUploadRequest<AudioFile>(`${urls.audioFiles}/upload/${sessionId}`, formData);
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
public async uploadAudioFileWithTranscriptionQueue(sessionId: string, file: File | Blob, options?: { fileName?: string; culturalTranscription?: string }): Promise<AudioFile> {
|
|
848
|
+
const formData = new FormData();
|
|
849
|
+
formData.append('file', file, options?.fileName);
|
|
850
|
+
|
|
851
|
+
if (options?.culturalTranscription) {
|
|
852
|
+
formData.append('cultural_transcription', options.culturalTranscription);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
// This will automatically trigger the transcription queue
|
|
801
856
|
return this.fileUploadRequest<AudioFile>(`${urls.audioFiles}/upload/${sessionId}`, formData);
|
|
802
857
|
}
|
|
803
858
|
|
|
@@ -864,4 +919,23 @@ export class ApiSDK {
|
|
|
864
919
|
return URL.createObjectURL(blob);
|
|
865
920
|
}
|
|
866
921
|
|
|
922
|
+
// ======================
|
|
923
|
+
// TRANSCRIPTION QUEUE HELPER METHODS
|
|
924
|
+
// ======================
|
|
925
|
+
|
|
926
|
+
public async getTranscribedAudioFiles(): Promise<AudioFile[]> {
|
|
927
|
+
const audioFiles = await this.getMyAudioFiles();
|
|
928
|
+
return audioFiles.filter(file => file.status === AudioFileStatus.TRANSCRIBED && file.transcription);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
public async getProcessingAudioFiles(): Promise<AudioFile[]> {
|
|
932
|
+
const audioFiles = await this.getMyAudioFiles();
|
|
933
|
+
return audioFiles.filter(file => file.status === AudioFileStatus.PROCESSING);
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
public async getFailedAudioFiles(): Promise<AudioFile[]> {
|
|
937
|
+
const audioFiles = await this.getMyAudioFiles();
|
|
938
|
+
return audioFiles.filter(file => file.status === AudioFileStatus.FAILED);
|
|
939
|
+
}
|
|
940
|
+
|
|
867
941
|
}
|
package/src/sdk/types.ts
CHANGED
|
@@ -345,6 +345,8 @@ export interface PasswordChangeResponse {
|
|
|
345
345
|
export interface Session {
|
|
346
346
|
id: string;
|
|
347
347
|
transcript: string;
|
|
348
|
+
medicalTranscription?: string;
|
|
349
|
+
culturalTranscription?: string;
|
|
348
350
|
dateTime: string;
|
|
349
351
|
startDateTime?: string;
|
|
350
352
|
stopDateTime?: string;
|
|
@@ -367,6 +369,8 @@ export interface Session {
|
|
|
367
369
|
// Session DTOs
|
|
368
370
|
export interface CreateSessionDto {
|
|
369
371
|
transcript: string;
|
|
372
|
+
medicalTranscription?: string;
|
|
373
|
+
culturalTranscription?: string;
|
|
370
374
|
dateTime: string;
|
|
371
375
|
startDateTime?: string;
|
|
372
376
|
stopDateTime?: string;
|
|
@@ -380,6 +384,8 @@ export interface CreateSessionDto {
|
|
|
380
384
|
|
|
381
385
|
export interface UpdateSessionDto {
|
|
382
386
|
transcript?: string;
|
|
387
|
+
medicalTranscription?: string;
|
|
388
|
+
culturalTranscription?: string;
|
|
383
389
|
dateTime?: string;
|
|
384
390
|
startDateTime?: string;
|
|
385
391
|
stopDateTime?: string;
|
|
@@ -434,6 +440,8 @@ export interface AudioFile {
|
|
|
434
440
|
mimeType: string;
|
|
435
441
|
uploadId?: string;
|
|
436
442
|
transcriptionUrl?: string;
|
|
443
|
+
transcription?: string;
|
|
444
|
+
cultural_transcription?: string;
|
|
437
445
|
status: AudioFileStatus;
|
|
438
446
|
createdAt: string;
|
|
439
447
|
updatedAt: string;
|
|
@@ -459,5 +467,46 @@ export interface CreateAudioFileDto {
|
|
|
459
467
|
|
|
460
468
|
export interface UpdateAudioFileDto {
|
|
461
469
|
transcriptionUrl?: string;
|
|
470
|
+
transcription?: string;
|
|
471
|
+
cultural_transcription?: string;
|
|
462
472
|
status?: AudioFileStatus;
|
|
463
473
|
}
|
|
474
|
+
|
|
475
|
+
// Audio File Upload DTO (for transcription queue)
|
|
476
|
+
export interface UploadAudioFileDto {
|
|
477
|
+
cultural_transcription?: string;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Agent Settings types
|
|
481
|
+
export interface AgentSettings {
|
|
482
|
+
id: string;
|
|
483
|
+
temperature: number;
|
|
484
|
+
topK: number;
|
|
485
|
+
topP: number;
|
|
486
|
+
repetitionPenalty: number;
|
|
487
|
+
createdAt: string;
|
|
488
|
+
updatedAt: string;
|
|
489
|
+
agentId: string;
|
|
490
|
+
organizationId: string;
|
|
491
|
+
|
|
492
|
+
// Relationships (populated by API)
|
|
493
|
+
agent?: Agent;
|
|
494
|
+
organization?: Organization;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// Agent Settings DTOs
|
|
498
|
+
export interface CreateAgentSettingsDto {
|
|
499
|
+
agentId: string;
|
|
500
|
+
organizationId: string;
|
|
501
|
+
temperature?: number;
|
|
502
|
+
topK?: number;
|
|
503
|
+
topP?: number;
|
|
504
|
+
repetitionPenalty?: number;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export interface UpdateAgentSettingsDto {
|
|
508
|
+
temperature?: number;
|
|
509
|
+
topK?: number;
|
|
510
|
+
topP?: number;
|
|
511
|
+
repetitionPenalty?: number;
|
|
512
|
+
}
|