@equos/node-sdk 1.2.0 → 2.0.0
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 +2 -2
- package/dist/apis/agent.d.ts +4 -2
- package/dist/apis/agent.js +16 -2
- package/dist/apis/avatar.d.ts +4 -2
- package/dist/apis/avatar.js +16 -2
- package/dist/apis/session.d.ts +1 -1
- package/dist/apis/session.js +6 -2
- package/dist/types/agent.type.d.ts +11 -4
- package/dist/types/avatar.type.d.ts +4 -5
- package/dist/types/session.type.d.ts +1 -1
- package/dist/utils/http.utils.d.ts +2 -0
- package/dist/utils/http.utils.js +30 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,13 +37,12 @@ const data: CreateEquosAvatarRequest = {
|
|
|
37
37
|
// Create an avatar.
|
|
38
38
|
const avatar: EquosAvatar = await client.avatars.create(data);
|
|
39
39
|
|
|
40
|
+
console.log(avatar);
|
|
40
41
|
```
|
|
41
42
|
|
|
42
43
|
### Create Agent
|
|
43
44
|
|
|
44
45
|
```ts
|
|
45
|
-
console.log(avatar);
|
|
46
|
-
|
|
47
46
|
import {
|
|
48
47
|
EquosAgent,
|
|
49
48
|
CreateEquosAgentRequest,
|
|
@@ -63,6 +62,7 @@ const data: CreateEquosAgentRequest = {
|
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
const agent: EquosAgent = await client.agents.create(data);
|
|
65
|
+
console.log(agent);
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
|
package/dist/apis/agent.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { HttpUtils } from '../utils/http.utils';
|
|
2
|
-
import { CreateEquosAgentRequest, EquosAgent, ListEquosAgentsResponse } from '../types/agent.type';
|
|
2
|
+
import { CreateEquosAgentRequest, EquosAgent, ListEquosAgentsResponse, UpdateEquosAgentRequest } from '../types/agent.type';
|
|
3
3
|
export declare class EquosAgentApi {
|
|
4
4
|
private readonly http;
|
|
5
5
|
constructor(http: HttpUtils);
|
|
6
6
|
create(data: CreateEquosAgentRequest): Promise<EquosAgent>;
|
|
7
|
-
list(skip?: number, take?: number): Promise<ListEquosAgentsResponse>;
|
|
7
|
+
list(skip?: number, take?: number, client?: string): Promise<ListEquosAgentsResponse>;
|
|
8
8
|
get(agentId: string): Promise<EquosAgent | null>;
|
|
9
|
+
delete(agentId: string): Promise<EquosAgent | null>;
|
|
10
|
+
update(agentId: string, data: UpdateEquosAgentRequest): Promise<EquosAgent>;
|
|
9
11
|
}
|
package/dist/apis/agent.js
CHANGED
|
@@ -12,9 +12,13 @@ class EquosAgentApi {
|
|
|
12
12
|
.post('/agents', data)
|
|
13
13
|
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
14
14
|
}
|
|
15
|
-
async list(skip = 0, take = 10) {
|
|
15
|
+
async list(skip = 0, take = 10, client) {
|
|
16
|
+
let path = `/avatars?skip=${skip}&take=${take}`;
|
|
17
|
+
if (client) {
|
|
18
|
+
path += `&client=${client}`;
|
|
19
|
+
}
|
|
16
20
|
return this.http
|
|
17
|
-
.get(
|
|
21
|
+
.get(path)
|
|
18
22
|
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
19
23
|
}
|
|
20
24
|
async get(agentId) {
|
|
@@ -22,5 +26,15 @@ class EquosAgentApi {
|
|
|
22
26
|
.get(`/agents/${agentId}`)
|
|
23
27
|
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
24
28
|
}
|
|
29
|
+
async delete(agentId) {
|
|
30
|
+
return this.http
|
|
31
|
+
.delete(`/agents/${agentId}`)
|
|
32
|
+
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
33
|
+
}
|
|
34
|
+
async update(agentId, data) {
|
|
35
|
+
return this.http
|
|
36
|
+
.put(`/agents/${agentId}`, data)
|
|
37
|
+
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
38
|
+
}
|
|
25
39
|
}
|
|
26
40
|
exports.EquosAgentApi = EquosAgentApi;
|
package/dist/apis/avatar.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { HttpUtils } from '../utils/http.utils';
|
|
2
|
-
import { CreateEquosAvatarRequest, EquosAvatar, ListEquosAvatarsResponse } from '../types/avatar.type';
|
|
2
|
+
import { CreateEquosAvatarRequest, EquosAvatar, ListEquosAvatarsResponse, UpdateEquosAvatarRequest } from '../types/avatar.type';
|
|
3
3
|
export declare class EquosAvatarApi {
|
|
4
4
|
private readonly http;
|
|
5
5
|
constructor(http: HttpUtils);
|
|
6
6
|
create(data: CreateEquosAvatarRequest): Promise<EquosAvatar>;
|
|
7
|
-
list(skip?: number, take?: number): Promise<ListEquosAvatarsResponse>;
|
|
7
|
+
list(skip?: number, take?: number, client?: string): Promise<ListEquosAvatarsResponse>;
|
|
8
8
|
get(avatarId: string): Promise<EquosAvatar | null>;
|
|
9
|
+
delete(agentId: string): Promise<EquosAvatar | null>;
|
|
10
|
+
update(agentId: string, data: UpdateEquosAvatarRequest): Promise<EquosAvatar>;
|
|
9
11
|
}
|
package/dist/apis/avatar.js
CHANGED
|
@@ -12,9 +12,13 @@ class EquosAvatarApi {
|
|
|
12
12
|
.post('/avatars', data)
|
|
13
13
|
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
14
14
|
}
|
|
15
|
-
async list(skip = 0, take = 10) {
|
|
15
|
+
async list(skip = 0, take = 10, client) {
|
|
16
|
+
let path = `/avatars?skip=${skip}&take=${take}`;
|
|
17
|
+
if (client) {
|
|
18
|
+
path += `&client=${client}`;
|
|
19
|
+
}
|
|
16
20
|
return this.http
|
|
17
|
-
.get(
|
|
21
|
+
.get(path)
|
|
18
22
|
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
19
23
|
}
|
|
20
24
|
async get(avatarId) {
|
|
@@ -22,5 +26,15 @@ class EquosAvatarApi {
|
|
|
22
26
|
.get(`/avatars/${avatarId}`)
|
|
23
27
|
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
24
28
|
}
|
|
29
|
+
async delete(agentId) {
|
|
30
|
+
return this.http
|
|
31
|
+
.delete(`/avatars/${agentId}`)
|
|
32
|
+
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
33
|
+
}
|
|
34
|
+
async update(agentId, data) {
|
|
35
|
+
return this.http
|
|
36
|
+
.put(`/avatars/${agentId}`, data)
|
|
37
|
+
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
38
|
+
}
|
|
25
39
|
}
|
|
26
40
|
exports.EquosAvatarApi = EquosAvatarApi;
|
package/dist/apis/session.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export declare class EquosSessionApi {
|
|
|
5
5
|
constructor(http: HttpUtils);
|
|
6
6
|
get(id: string): Promise<EquosSession>;
|
|
7
7
|
create(data: CreateEquosSessionRequest): Promise<CreateEquosSessionResponse>;
|
|
8
|
-
list(skip?: number, take?: number): Promise<ListEquosSessionsResponse>;
|
|
8
|
+
list(skip?: number, take?: number, client?: string): Promise<ListEquosSessionsResponse>;
|
|
9
9
|
stop(id: string): Promise<EquosSession>;
|
|
10
10
|
}
|
package/dist/apis/session.js
CHANGED
|
@@ -17,9 +17,13 @@ class EquosSessionApi {
|
|
|
17
17
|
.post('/sessions', data)
|
|
18
18
|
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
19
19
|
}
|
|
20
|
-
async list(skip = 0, take = 10) {
|
|
20
|
+
async list(skip = 0, take = 10, client) {
|
|
21
|
+
let path = `/sessions?skip=${skip}&take=${take}`;
|
|
22
|
+
if (client) {
|
|
23
|
+
path += `&client=${client}`;
|
|
24
|
+
}
|
|
21
25
|
return this.http
|
|
22
|
-
.get(
|
|
26
|
+
.get(path)
|
|
23
27
|
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
24
28
|
}
|
|
25
29
|
async stop(id) {
|
|
@@ -34,26 +34,29 @@ export declare enum AgentProvider {
|
|
|
34
34
|
elevenlabs = "elevenlabs"
|
|
35
35
|
}
|
|
36
36
|
export interface OpenaiAgentConfig {
|
|
37
|
+
instructions: string;
|
|
37
38
|
model: OpenaiRealtimeModels;
|
|
38
39
|
voice: OpenaiRealtimeVoices;
|
|
39
40
|
}
|
|
40
41
|
export interface GeminiAgentConfig {
|
|
42
|
+
instructions: string;
|
|
41
43
|
model: GoogleRealtimeModels;
|
|
42
44
|
voice: GoogleRealtimeVoices;
|
|
43
45
|
}
|
|
46
|
+
export interface ElevenlabsAgentConfig {
|
|
47
|
+
elevenlabsAgentId: string;
|
|
48
|
+
}
|
|
44
49
|
export interface CreateEquosAgentRequest {
|
|
45
|
-
instructions: string;
|
|
46
50
|
provider: AgentProvider;
|
|
47
51
|
client?: string | null;
|
|
48
|
-
config: OpenaiAgentConfig | GeminiAgentConfig;
|
|
52
|
+
config: OpenaiAgentConfig | GeminiAgentConfig | ElevenlabsAgentConfig;
|
|
49
53
|
}
|
|
50
54
|
export interface EquosAgent {
|
|
51
55
|
id: string;
|
|
52
56
|
organizationId: string;
|
|
53
|
-
instructions: string;
|
|
54
57
|
provider: AgentProvider;
|
|
55
58
|
client?: string;
|
|
56
|
-
config: OpenaiAgentConfig | GeminiAgentConfig;
|
|
59
|
+
config: OpenaiAgentConfig | GeminiAgentConfig | ElevenlabsAgentConfig;
|
|
57
60
|
createdAt: Date;
|
|
58
61
|
updatedAt: Date;
|
|
59
62
|
}
|
|
@@ -63,3 +66,7 @@ export interface ListEquosAgentsResponse {
|
|
|
63
66
|
total: number;
|
|
64
67
|
agents: EquosAgent[];
|
|
65
68
|
}
|
|
69
|
+
export interface UpdateEquosAgentRequest extends CreateEquosAgentRequest {
|
|
70
|
+
id: string;
|
|
71
|
+
organizationId: string;
|
|
72
|
+
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { CreateEquosAgentRequest, EquosAgent } from './agent.type';
|
|
2
1
|
export interface CreateEquosAvatarRequest {
|
|
3
2
|
identity: string;
|
|
4
3
|
name: string;
|
|
5
4
|
refImage: string;
|
|
6
5
|
client?: string | null;
|
|
7
|
-
agentId?: string;
|
|
8
|
-
agent?: CreateEquosAgentRequest;
|
|
9
6
|
}
|
|
10
7
|
export interface EquosAvatar {
|
|
11
8
|
id: string;
|
|
@@ -16,8 +13,6 @@ export interface EquosAvatar {
|
|
|
16
13
|
thumbnailUrl: string;
|
|
17
14
|
createdAt: Date;
|
|
18
15
|
updatedAt: Date;
|
|
19
|
-
agentId?: string;
|
|
20
|
-
agent?: EquosAgent;
|
|
21
16
|
}
|
|
22
17
|
export interface ListEquosAvatarsResponse {
|
|
23
18
|
skip: number;
|
|
@@ -25,3 +20,7 @@ export interface ListEquosAvatarsResponse {
|
|
|
25
20
|
total: number;
|
|
26
21
|
avatars: EquosAvatar[];
|
|
27
22
|
}
|
|
23
|
+
export interface UpdateEquosAvatarRequest extends CreateEquosAvatarRequest {
|
|
24
|
+
id: string;
|
|
25
|
+
organizationId: string;
|
|
26
|
+
}
|
package/dist/utils/http.utils.js
CHANGED
|
@@ -92,5 +92,35 @@ class HttpUtils {
|
|
|
92
92
|
throw e;
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
+
async put(path, data) {
|
|
96
|
+
return axios_1.default
|
|
97
|
+
.put(this.getPath(path), data, {
|
|
98
|
+
headers: {
|
|
99
|
+
'x-api-key': this.apiKey,
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
.then((response) => response.data)
|
|
103
|
+
.catch((e) => {
|
|
104
|
+
if (e instanceof axios_1.AxiosError) {
|
|
105
|
+
throw e.response?.data || { message: e?.message, code: e?.code };
|
|
106
|
+
}
|
|
107
|
+
throw e;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
async delete(path) {
|
|
111
|
+
return axios_1.default
|
|
112
|
+
.delete(this.getPath(path), {
|
|
113
|
+
headers: {
|
|
114
|
+
'x-api-key': this.apiKey,
|
|
115
|
+
},
|
|
116
|
+
})
|
|
117
|
+
.then((response) => response.data)
|
|
118
|
+
.catch((e) => {
|
|
119
|
+
if (e instanceof axios_1.AxiosError) {
|
|
120
|
+
throw e.response?.data || { message: e?.message, code: e?.code };
|
|
121
|
+
}
|
|
122
|
+
throw e;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
95
125
|
}
|
|
96
126
|
exports.HttpUtils = HttpUtils;
|