@equos/node-sdk 2.1.4 → 2.2.2
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/apis/knowledge-base.d.ts +13 -0
- package/dist/apis/knowledge-base.js +50 -0
- package/dist/equos.d.ts +3 -0
- package/dist/equos.js +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/types/knowledge-base.type.d.ts +41 -0
- package/dist/types/knowledge-base.type.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HttpUtils } from '../utils/http.utils';
|
|
2
|
+
import { CreateDocumentRequest, CreateDocumentResponse, CreateKnowledgeBaseRequest, EquosDocument, EquosKnowledgeBase, ListEquosKnowledgeBasesResponse } from '../types/knowledge-base.type';
|
|
3
|
+
export declare class EquosKnowledgeBaseApi {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: HttpUtils);
|
|
6
|
+
create(data: CreateKnowledgeBaseRequest): Promise<EquosKnowledgeBase>;
|
|
7
|
+
list(skip?: number, take?: number, client?: string): Promise<ListEquosKnowledgeBasesResponse>;
|
|
8
|
+
get(knowledgeBaseId: string): Promise<EquosKnowledgeBase | null>;
|
|
9
|
+
delete(knowledgeBaseId: string): Promise<EquosKnowledgeBase | null>;
|
|
10
|
+
createDocument(knowledgeBaseId: string, data: CreateDocumentRequest): Promise<CreateDocumentResponse>;
|
|
11
|
+
indexDocument(knowledgeBaseId: string, documentId: string): Promise<EquosDocument>;
|
|
12
|
+
deleteDocument(knowledgeBaseId: string, documentId: string): Promise<EquosDocument | null>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EquosKnowledgeBaseApi = void 0;
|
|
4
|
+
const error_utils_1 = require("../utils/error.utils");
|
|
5
|
+
class EquosKnowledgeBaseApi {
|
|
6
|
+
http;
|
|
7
|
+
constructor(http) {
|
|
8
|
+
this.http = http;
|
|
9
|
+
}
|
|
10
|
+
async create(data) {
|
|
11
|
+
return this.http
|
|
12
|
+
.post('/knowledge-bases', data)
|
|
13
|
+
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
14
|
+
}
|
|
15
|
+
async list(skip = 0, take = 10, client) {
|
|
16
|
+
let path = `/knowledge-bases?skip=${skip}&take=${take}`;
|
|
17
|
+
if (client) {
|
|
18
|
+
path += `&client=${client}`;
|
|
19
|
+
}
|
|
20
|
+
return this.http
|
|
21
|
+
.get(path)
|
|
22
|
+
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
23
|
+
}
|
|
24
|
+
async get(knowledgeBaseId) {
|
|
25
|
+
return this.http
|
|
26
|
+
.get(`/knowledge-bases/${knowledgeBaseId}`)
|
|
27
|
+
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
28
|
+
}
|
|
29
|
+
async delete(knowledgeBaseId) {
|
|
30
|
+
return this.http
|
|
31
|
+
.delete(`/knowledge-bases/${knowledgeBaseId}`)
|
|
32
|
+
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
33
|
+
}
|
|
34
|
+
async createDocument(knowledgeBaseId, data) {
|
|
35
|
+
return this.http
|
|
36
|
+
.post(`/knowledge-bases/${knowledgeBaseId}/documents`, data)
|
|
37
|
+
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
38
|
+
}
|
|
39
|
+
async indexDocument(knowledgeBaseId, documentId) {
|
|
40
|
+
return this.http
|
|
41
|
+
.patch(`/knowledge-bases/${knowledgeBaseId}/documents/${documentId}/index`, null)
|
|
42
|
+
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
43
|
+
}
|
|
44
|
+
async deleteDocument(knowledgeBaseId, documentId) {
|
|
45
|
+
return this.http
|
|
46
|
+
.delete(`/knowledge-bases/${knowledgeBaseId}/documents/${documentId}`)
|
|
47
|
+
.catch(error_utils_1.ErrorUtils.convertToEquosError);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.EquosKnowledgeBaseApi = EquosKnowledgeBaseApi;
|
package/dist/equos.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EquosAgentApi } from './apis/agent';
|
|
2
2
|
import { EquosAvatarApi } from './apis/avatar';
|
|
3
|
+
import { EquosKnowledgeBaseApi } from './apis/knowledge-base';
|
|
3
4
|
import { EquosSessionApi } from './apis/session';
|
|
4
5
|
export interface EquosOptions {
|
|
5
6
|
/**
|
|
@@ -19,6 +20,7 @@ export declare class Equos {
|
|
|
19
20
|
private readonly avatarApi;
|
|
20
21
|
private readonly sessionApi;
|
|
21
22
|
private readonly agentApi;
|
|
23
|
+
private readonly knowledgeBaseApi;
|
|
22
24
|
private readonly version;
|
|
23
25
|
private readonly endpoint;
|
|
24
26
|
private constructor();
|
|
@@ -26,4 +28,5 @@ export declare class Equos {
|
|
|
26
28
|
get agents(): EquosAgentApi;
|
|
27
29
|
get avatars(): EquosAvatarApi;
|
|
28
30
|
get sessions(): EquosSessionApi;
|
|
31
|
+
get knowledgeBases(): EquosKnowledgeBaseApi;
|
|
29
32
|
}
|
package/dist/equos.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Equos = void 0;
|
|
4
4
|
const agent_1 = require("./apis/agent");
|
|
5
5
|
const avatar_1 = require("./apis/avatar");
|
|
6
|
+
const knowledge_base_1 = require("./apis/knowledge-base");
|
|
6
7
|
const session_1 = require("./apis/session");
|
|
7
8
|
const constants_utils_1 = require("./utils/constants.utils");
|
|
8
9
|
const http_utils_1 = require("./utils/http.utils");
|
|
@@ -13,6 +14,7 @@ class Equos {
|
|
|
13
14
|
avatarApi;
|
|
14
15
|
sessionApi;
|
|
15
16
|
agentApi;
|
|
17
|
+
knowledgeBaseApi;
|
|
16
18
|
version;
|
|
17
19
|
endpoint;
|
|
18
20
|
constructor(apiKey, opts) {
|
|
@@ -24,6 +26,7 @@ class Equos {
|
|
|
24
26
|
this.avatarApi = new avatar_1.EquosAvatarApi(this.http);
|
|
25
27
|
this.sessionApi = new session_1.EquosSessionApi(this.http);
|
|
26
28
|
this.agentApi = new agent_1.EquosAgentApi(this.http);
|
|
29
|
+
this.knowledgeBaseApi = new knowledge_base_1.EquosKnowledgeBaseApi(this.http);
|
|
27
30
|
}
|
|
28
31
|
static client(apiKey, opts) {
|
|
29
32
|
return new Equos(apiKey, opts);
|
|
@@ -37,5 +40,8 @@ class Equos {
|
|
|
37
40
|
get sessions() {
|
|
38
41
|
return this.sessionApi;
|
|
39
42
|
}
|
|
43
|
+
get knowledgeBases() {
|
|
44
|
+
return this.knowledgeBaseApi;
|
|
45
|
+
}
|
|
40
46
|
}
|
|
41
47
|
exports.Equos = Equos;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export * from './types/error.type';
|
|
|
3
3
|
export * from './types/agent.type';
|
|
4
4
|
export * from './types/avatar.type';
|
|
5
5
|
export * from './types/session.type';
|
|
6
|
+
export * from './types/knowledge-base.type';
|
|
6
7
|
export * from './apis/agent';
|
|
7
8
|
export * from './apis/avatar';
|
|
8
9
|
export * from './apis/session';
|
|
10
|
+
export * from './apis/knowledge-base';
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,8 @@ __exportStar(require("./types/error.type"), exports);
|
|
|
19
19
|
__exportStar(require("./types/agent.type"), exports);
|
|
20
20
|
__exportStar(require("./types/avatar.type"), exports);
|
|
21
21
|
__exportStar(require("./types/session.type"), exports);
|
|
22
|
+
__exportStar(require("./types/knowledge-base.type"), exports);
|
|
22
23
|
__exportStar(require("./apis/agent"), exports);
|
|
23
24
|
__exportStar(require("./apis/avatar"), exports);
|
|
24
25
|
__exportStar(require("./apis/session"), exports);
|
|
26
|
+
__exportStar(require("./apis/knowledge-base"), exports);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface CreateKnowledgeBaseRequest {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
client?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface EquosKnowledgeBase {
|
|
7
|
+
id: string;
|
|
8
|
+
organizationId: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
client?: string;
|
|
12
|
+
documents: EquosDocument[];
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
updatedAt: Date;
|
|
15
|
+
}
|
|
16
|
+
export interface CreateDocumentRequest {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
mimeType: string;
|
|
20
|
+
}
|
|
21
|
+
export interface CreateDocumentResponse {
|
|
22
|
+
document: EquosDocument;
|
|
23
|
+
uploadUrl: string;
|
|
24
|
+
expireAt: Date;
|
|
25
|
+
}
|
|
26
|
+
export interface EquosDocument {
|
|
27
|
+
id: string;
|
|
28
|
+
knowledgeBaseId: string;
|
|
29
|
+
name: string;
|
|
30
|
+
description: string;
|
|
31
|
+
size: number;
|
|
32
|
+
status: string;
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
updatedAt: Date;
|
|
35
|
+
}
|
|
36
|
+
export interface ListEquosKnowledgeBasesResponse {
|
|
37
|
+
skip: number;
|
|
38
|
+
take: number;
|
|
39
|
+
total: number;
|
|
40
|
+
items: EquosKnowledgeBase[];
|
|
41
|
+
}
|