tencentcloud-sdk-nodejs 4.0.1022 → 4.0.1023

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 CHANGED
@@ -13,18 +13,47 @@
13
13
 
14
14
  安装 NODEJS SDK 前,先获取安全凭证。在第一次使用云 API 之前,用户首先需要在腾讯云控制台上申请安全凭证,安全凭证包括 SecretID 和 SecretKey, SecretID 是用于标识 API 调用者的身份,SecretKey 是用于加密签名字符串和服务器端验证签名字符串的密钥。SecretKey 必须严格保管,避免泄露。
15
15
 
16
- ## 通过 Npm 安装
16
+ ## 通过 NPM 安装
17
17
 
18
- 通过 npm 获取安装是使用 NODEJS SDK 的推荐方法,npm 是 NODEJS 的包管理工具。关于 npm 详细可参考[ npm 官网](https://www.npmjs.com/) 。
18
+ 通过 NPM 获取安装是使用 NODEJS SDK 的推荐方法,NPM 是 NODEJS 的包管理工具。关于 NPM 详细可参考 [NPM 官网](https://www.npmjs.com/) 。
19
19
 
20
- 1. 执行以下安装命令:
21
- > npm install tencentcloud-sdk-nodejs --save
22
- 2. 在您的代码中引用对应模块代码,可参考示例。
23
- 3. 如上引用方式会将腾讯云所有产品sdk下载到本地,可以将tencentcloud-sdk-nodejs换成tencentcloud-sdk-nodejs-cvm/cbs/vpc等,即可引用特定产品的sdk,代码中可将require("tencentcloud-sdk-nodejs")改为require("tencentcloud-sdk-nodejs-cvm/cbs/vpc"),其余不变,可参考示例,可大大节省存储空间。
20
+ ### 安装指定产品 SDK(推荐)
21
+
22
+ 安装 CVM SDK:
23
+
24
+ ```
25
+ npm install tencentcloud-sdk-nodejs-cvm --save
26
+ ```
27
+
28
+ 安装 VPC SDK:
29
+
30
+ ```
31
+ npm install tencentcloud-sdk-nodejs-vpc --save
32
+ ```
33
+
34
+ 具体产品的缩写表请参考 [products.md](./products.md) 中的包名字段。
35
+
36
+ 安装指定产品 SDK 后,注意修改引入的包名:
37
+
38
+ ```diff
39
+ - const tencentcloud = require("tencentcloud-sdk-nodejs")
40
+ + const { cvm } = require("tencentcloud-sdk-nodejs-cvm")
41
+
42
+ - const CvmClient = tencentcloud.cvm.v20170312.Client
43
+ + const CvmClient = cvm.v20170312.Client
44
+ ```
45
+
46
+ ### 安装全产品 SDK
47
+
48
+ ```
49
+ npm install tencentcloud-sdk-nodejs --save
50
+ ```
51
+
52
+ 全产品 SDK 包含了所有云产品的调用代码,体积偏大,对体积敏感的场景,推荐安装指定产品 SDK。
24
53
 
25
54
  ## 通过源码包安装
26
55
 
27
- 1. 前往 [Github 仓库](https://github.com/tencentcloud/tencentcloud-sdk-nodejs) 或者 [Gitee 仓库](https://gitee.com/tencentcloud/tencentcloud-sdk-nodejs) 下载源码压缩包。
56
+ 1. 前往 [GitHub 仓库](https://github.com/tencentcloud/tencentcloud-sdk-nodejs) 或者 [Gitee 仓库](https://gitee.com/tencentcloud/tencentcloud-sdk-nodejs) 下载源码压缩包。
28
57
  2. 解压源码包到您项目合适的位置,例如 `sdk/tencentcloud-sdk-nodejs`。
29
58
  3. 执行 `npm install ./sdk/tencentcloud-sdk-nodejs`。
30
59
  4. 使用 `require("tencentcloud-sdk-nodejs")` 的方式引入sdk,具体可参考示例。
@@ -120,7 +149,7 @@ new XxxClient({
120
149
 
121
150
  # 旧版 SDK
122
151
 
123
- 我们推荐使用新版 NODEJS SDK,如果一定要用旧版 SDK,请前往[github 仓库](https://github.com/CFETeam/qcloudapi-sdk)下载。
152
+ 我们推荐使用新版 NODEJS SDK,如果一定要用旧版 SDK,请前往[GitHub 仓库](https://github.com/CFETeam/qcloudapi-sdk)下载。
124
153
 
125
154
  # 常见问题
126
155
  - webpack打包出错/浏览器报错
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tencentcloud-sdk-nodejs",
3
- "version": "4.0.1022",
3
+ "version": "4.0.1023",
4
4
  "description": "腾讯云 API NODEJS SDK",
5
5
  "main": "tencentcloud/index.js",
6
6
  "scripts": {
@@ -1 +1 @@
1
- export const sdkVersion = "4.0.1022"
1
+ export const sdkVersion = "4.0.1023"
@@ -18,13 +18,14 @@
18
18
  import { AbstractClient } from "../../../common/abstract_client"
19
19
  import { ClientConfig } from "../../../common/interface"
20
20
  import {
21
+ ChatCompletionsRequest,
21
22
  CreateSplitDocumentFlowRequest,
22
- ImportQAsResponse,
23
23
  RetrievalRecordMetadata,
24
24
  ListQAsRequest,
25
25
  ReconstructDocumentSSEResponse,
26
26
  DocItem,
27
27
  GetEmbeddingRequest,
28
+ ImportQAsResponse,
28
29
  UploadDocRealtimeRequest,
29
30
  DescribeDocResponse,
30
31
  AttributeLabelReferItem,
@@ -69,6 +70,7 @@ import {
69
70
  UploadDocRealtimeResponse,
70
71
  SplitDocumentFailedPage,
71
72
  ModifyAttributeLabelResponse,
73
+ QueryRewriteResponse,
72
74
  UploadDocRequest,
73
75
  DeleteQAsResponse,
74
76
  CreateKnowledgeBaseResponse,
@@ -78,7 +80,7 @@ import {
78
80
  CreateSplitDocumentFlowConfig,
79
81
  RunRerankResponse,
80
82
  CreateReconstructDocumentFlowResponse,
81
- QueryRewriteResponse,
83
+ ChatCompletionsResponse,
82
84
  CreateQARequest,
83
85
  UploadDocResponse,
84
86
  AttributeItem,
@@ -353,4 +355,14 @@ export class Client extends AbstractClient {
353
355
  ): Promise<UploadDocResponse> {
354
356
  return this.request("UploadDoc", req, cb)
355
357
  }
358
+
359
+ /**
360
+ * 对话
361
+ */
362
+ async ChatCompletions(
363
+ req: ChatCompletionsRequest,
364
+ cb?: (error: string, rep: ChatCompletionsResponse) => void
365
+ ): Promise<ChatCompletionsResponse> {
366
+ return this.request("ChatCompletions", req, cb)
367
+ }
356
368
  }
@@ -15,6 +15,24 @@
15
15
  * under the License.
16
16
  */
17
17
 
18
+ /**
19
+ * ChatCompletions请求参数结构体
20
+ */
21
+ export interface ChatCompletionsRequest {
22
+ /**
23
+ * 模型名称
24
+ */
25
+ Model: string
26
+ /**
27
+ * 会话列表
28
+ */
29
+ Messages: Array<Message>
30
+ /**
31
+ * 是否流式输出
32
+ */
33
+ Stream?: boolean
34
+ }
35
+
18
36
  /**
19
37
  * CreateSplitDocumentFlow请求参数结构体
20
38
  */
@@ -69,16 +87,6 @@ export interface CreateSplitDocumentFlowRequest {
69
87
  Config?: CreateSplitDocumentFlowConfig
70
88
  }
71
89
 
72
- /**
73
- * ImportQAs返回参数结构体
74
- */
75
- export interface ImportQAsResponse {
76
- /**
77
- * 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
78
- */
79
- RequestId?: string
80
- }
81
-
82
90
  /**
83
91
  * 检索结果的元数据
84
92
  */
@@ -192,6 +200,16 @@ export interface GetEmbeddingRequest {
192
200
  Inputs: Array<string>
193
201
  }
194
202
 
203
+ /**
204
+ * ImportQAs返回参数结构体
205
+ */
206
+ export interface ImportQAsResponse {
207
+ /**
208
+ * 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
209
+ */
210
+ RequestId?: string
211
+ }
212
+
195
213
  /**
196
214
  * UploadDocRealtime请求参数结构体
197
215
  */
@@ -860,6 +878,24 @@ export interface ModifyAttributeLabelResponse {
860
878
  RequestId?: string
861
879
  }
862
880
 
881
+ /**
882
+ * QueryRewrite返回参数结构体
883
+ */
884
+ export interface QueryRewriteResponse {
885
+ /**
886
+ * 改写结果
887
+ */
888
+ Content?: string
889
+ /**
890
+ * 消耗量,返回输入token数,输出token数以及总token数
891
+ */
892
+ Usage?: Usage
893
+ /**
894
+ * 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
895
+ */
896
+ RequestId?: string
897
+ }
898
+
863
899
  /**
864
900
  * UploadDoc请求参数结构体
865
901
  */
@@ -1067,19 +1103,11 @@ export interface CreateReconstructDocumentFlowResponse {
1067
1103
  }
1068
1104
 
1069
1105
  /**
1070
- * QueryRewrite返回参数结构体
1106
+ * ChatCompletions返回参数结构体
1071
1107
  */
1072
- export interface QueryRewriteResponse {
1108
+ export interface ChatCompletionsResponse {
1073
1109
  /**
1074
- * 改写结果
1075
- */
1076
- Content?: string
1077
- /**
1078
- * 消耗量,返回输入token数,输出token数以及总token数
1079
- */
1080
- Usage?: Usage
1081
- /**
1082
- * 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
1110
+ * 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。本接口为流式响应接口,当请求成功时,RequestId 会被放在 HTTP 响应的 Header "X-TC-RequestId" 中。
1083
1111
  */
1084
1112
  RequestId?: string
1085
1113
  }
@@ -1 +1 @@
1
- export declare const sdkVersion = "4.0.1022";
1
+ export declare const sdkVersion = "4.0.1023";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sdkVersion = void 0;
4
- exports.sdkVersion = "4.0.1022";
4
+ exports.sdkVersion = "4.0.1023";
@@ -1,6 +1,6 @@
1
1
  import { AbstractClient } from "../../../common/abstract_client";
2
2
  import { ClientConfig } from "../../../common/interface";
3
- import { CreateSplitDocumentFlowRequest, ImportQAsResponse, ListQAsRequest, ReconstructDocumentSSEResponse, GetEmbeddingRequest, UploadDocRealtimeRequest, DescribeDocResponse, DeleteQAsRequest, ModifyQARequest, GetReconstructDocumentResultRequest, ListQAsResponse, DeleteAttributeLabelsResponse, ListDocsRequest, CreateAttributeLabelResponse, RetrieveKnowledgeResponse, CreateSplitDocumentFlowResponse, CreateQAResponse, ModifyAttributeLabelRequest, ListDocsResponse, ListAttributeLabelsRequest, DeleteAttributeLabelsRequest, RetrieveKnowledgeRequest, GetReconstructDocumentResultResponse, RunRerankRequest, GetSplitDocumentResultRequest, ReconstructDocumentSSERequest, ListAttributeLabelsResponse, CreateAttributeLabelRequest, ImportQAsRequest, DescribeDocRequest, DeleteKnowledgeBaseResponse, DeleteDocsResponse, CreateReconstructDocumentFlowRequest, GetSplitDocumentResultResponse, ModifyQAResponse, UploadDocRealtimeResponse, ModifyAttributeLabelResponse, UploadDocRequest, DeleteQAsResponse, CreateKnowledgeBaseResponse, GetEmbeddingResponse, QueryRewriteRequest, RunRerankResponse, CreateReconstructDocumentFlowResponse, QueryRewriteResponse, CreateQARequest, UploadDocResponse, CreateKnowledgeBaseRequest, DeleteKnowledgeBaseRequest, DeleteDocsRequest } from "./lkeap_models";
3
+ import { ChatCompletionsRequest, CreateSplitDocumentFlowRequest, ListQAsRequest, ReconstructDocumentSSEResponse, GetEmbeddingRequest, ImportQAsResponse, UploadDocRealtimeRequest, DescribeDocResponse, DeleteQAsRequest, ModifyQARequest, GetReconstructDocumentResultRequest, ListQAsResponse, DeleteAttributeLabelsResponse, ListDocsRequest, CreateAttributeLabelResponse, RetrieveKnowledgeResponse, CreateSplitDocumentFlowResponse, CreateQAResponse, ModifyAttributeLabelRequest, ListDocsResponse, ListAttributeLabelsRequest, DeleteAttributeLabelsRequest, RetrieveKnowledgeRequest, GetReconstructDocumentResultResponse, RunRerankRequest, GetSplitDocumentResultRequest, ReconstructDocumentSSERequest, ListAttributeLabelsResponse, CreateAttributeLabelRequest, ImportQAsRequest, DescribeDocRequest, DeleteKnowledgeBaseResponse, DeleteDocsResponse, CreateReconstructDocumentFlowRequest, GetSplitDocumentResultResponse, ModifyQAResponse, UploadDocRealtimeResponse, ModifyAttributeLabelResponse, QueryRewriteResponse, UploadDocRequest, DeleteQAsResponse, CreateKnowledgeBaseResponse, GetEmbeddingResponse, QueryRewriteRequest, RunRerankResponse, CreateReconstructDocumentFlowResponse, ChatCompletionsResponse, CreateQARequest, UploadDocResponse, CreateKnowledgeBaseRequest, DeleteKnowledgeBaseRequest, DeleteDocsRequest } from "./lkeap_models";
4
4
  /**
5
5
  * lkeap client
6
6
  * @class
@@ -113,4 +113,8 @@ export declare class Client extends AbstractClient {
113
113
  使用场景:适用于需要长期存储和检索的文档内容,如产品手册、用户指南等。
114
114
  */
115
115
  UploadDoc(req: UploadDocRequest, cb?: (error: string, rep: UploadDocResponse) => void): Promise<UploadDocResponse>;
116
+ /**
117
+ * 对话
118
+ */
119
+ ChatCompletions(req: ChatCompletionsRequest, cb?: (error: string, rep: ChatCompletionsResponse) => void): Promise<ChatCompletionsResponse>;
116
120
  }
@@ -183,5 +183,11 @@ class Client extends abstract_client_1.AbstractClient {
183
183
  async UploadDoc(req, cb) {
184
184
  return this.request("UploadDoc", req, cb);
185
185
  }
186
+ /**
187
+ * 对话
188
+ */
189
+ async ChatCompletions(req, cb) {
190
+ return this.request("ChatCompletions", req, cb);
191
+ }
186
192
  }
187
193
  exports.Client = Client;
@@ -1,3 +1,20 @@
1
+ /**
2
+ * ChatCompletions请求参数结构体
3
+ */
4
+ export interface ChatCompletionsRequest {
5
+ /**
6
+ * 模型名称
7
+ */
8
+ Model: string;
9
+ /**
10
+ * 会话列表
11
+ */
12
+ Messages: Array<Message>;
13
+ /**
14
+ * 是否流式输出
15
+ */
16
+ Stream?: boolean;
17
+ }
1
18
  /**
2
19
  * CreateSplitDocumentFlow请求参数结构体
3
20
  */
@@ -51,15 +68,6 @@ export interface CreateSplitDocumentFlowRequest {
51
68
  */
52
69
  Config?: CreateSplitDocumentFlowConfig;
53
70
  }
54
- /**
55
- * ImportQAs返回参数结构体
56
- */
57
- export interface ImportQAsResponse {
58
- /**
59
- * 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
60
- */
61
- RequestId?: string;
62
- }
63
71
  /**
64
72
  * 检索结果的元数据
65
73
  */
@@ -168,6 +176,15 @@ export interface GetEmbeddingRequest {
168
176
  */
169
177
  Inputs: Array<string>;
170
178
  }
179
+ /**
180
+ * ImportQAs返回参数结构体
181
+ */
182
+ export interface ImportQAsResponse {
183
+ /**
184
+ * 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
185
+ */
186
+ RequestId?: string;
187
+ }
171
188
  /**
172
189
  * UploadDocRealtime请求参数结构体
173
190
  */
@@ -792,6 +809,23 @@ export interface ModifyAttributeLabelResponse {
792
809
  */
793
810
  RequestId?: string;
794
811
  }
812
+ /**
813
+ * QueryRewrite返回参数结构体
814
+ */
815
+ export interface QueryRewriteResponse {
816
+ /**
817
+ * 改写结果
818
+ */
819
+ Content?: string;
820
+ /**
821
+ * 消耗量,返回输入token数,输出token数以及总token数
822
+ */
823
+ Usage?: Usage;
824
+ /**
825
+ * 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
826
+ */
827
+ RequestId?: string;
828
+ }
795
829
  /**
796
830
  * UploadDoc请求参数结构体
797
831
  */
@@ -990,19 +1024,11 @@ export interface CreateReconstructDocumentFlowResponse {
990
1024
  RequestId?: string;
991
1025
  }
992
1026
  /**
993
- * QueryRewrite返回参数结构体
1027
+ * ChatCompletions返回参数结构体
994
1028
  */
995
- export interface QueryRewriteResponse {
996
- /**
997
- * 改写结果
998
- */
999
- Content?: string;
1029
+ export interface ChatCompletionsResponse {
1000
1030
  /**
1001
- * 消耗量,返回输入token数,输出token数以及总token数
1002
- */
1003
- Usage?: Usage;
1004
- /**
1005
- * 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
1031
+ * 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。本接口为流式响应接口,当请求成功时,RequestId 会被放在 HTTP 响应的 Header "X-TC-RequestId" 中。
1006
1032
  */
1007
1033
  RequestId?: string;
1008
1034
  }