tencentcloud-sdk-hunyuan 3.0.741 → 3.0.743

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b851110ab877f073099c3a0ff4b75bfc4863db8
4
- data.tar.gz: 08014f7ba5388bea05c60b42f8db7574d8d2d1d5
3
+ metadata.gz: be9aeba27b1d7d529987d07a3288926a7b5d95b1
4
+ data.tar.gz: 50fa9bfeaec4a02ff792ea4ff2a011e9417af4fb
5
5
  SHA512:
6
- metadata.gz: 74f5b58fdf229bee0aa25a4aa3b30ad4ed6acd3005fd43be6f77cbe3f4f53cb0fdeefbd3c613ab8ecf2f812671faded78a6e55ec6428e107cc7a142711ce53e9
7
- data.tar.gz: 506eaebb9fc54091a299dfcb91284d8cb524f4c8c1f9ffb2d965664c9b119f401394bd5630b6d7c14a9c0dc8dfa1bcf1ce02d6e8b448eff0faa0d3a9e1e8e687
6
+ metadata.gz: aa00ba0dd3d41111a81d9063fdadba750b27ed04c4d86cbbd36cbf604be446c8ba22fe245ebd9c70fac04e3fefd6b1e88abc87151e9872548265ca9978a417a5
7
+ data.tar.gz: 1ca9b876e8e6817e7975a2c6d9898dfef3e582dd8736c88f379c4d66b3670885910ac83f455e0c30ae5bd73e5fd3d7914bb934a551ad0303e4ac2f9fae16d9db
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.741
1
+ 3.0.743
@@ -85,6 +85,30 @@ module TencentCloud
85
85
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
86
86
  end
87
87
 
88
+ # 腾讯混元-Embedding接口,可以将文本转化为高质量的向量数据。
89
+
90
+ # @param request: Request instance for GetEmbedding.
91
+ # @type request: :class:`Tencentcloud::hunyuan::V20230901::GetEmbeddingRequest`
92
+ # @rtype: :class:`Tencentcloud::hunyuan::V20230901::GetEmbeddingResponse`
93
+ def GetEmbedding(request)
94
+ body = send_request('GetEmbedding', request.serialize)
95
+ response = JSON.parse(body)
96
+ if response['Response'].key?('Error') == false
97
+ model = GetEmbeddingResponse.new
98
+ model.deserialize(response['Response'])
99
+ model
100
+ else
101
+ code = response['Response']['Error']['Code']
102
+ message = response['Response']['Error']['Message']
103
+ reqid = response['Response']['RequestId']
104
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
105
+ end
106
+ rescue TencentCloud::Common::TencentCloudSDKException => e
107
+ raise e
108
+ rescue StandardError => e
109
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
110
+ end
111
+
88
112
  # 该接口用于计算文本对应Token数、字符数。
89
113
 
90
114
  # @param request: Request instance for GetTokenCount.
@@ -22,7 +22,7 @@ module TencentCloud
22
22
  # @param Messages: 聊天上下文信息。
23
23
  # 说明:
24
24
  # 1.长度最多为40, 按对话时间从旧到新在数组中排列。
25
- # 2.Message的Role当前可选值:user、assistant,其中,user和assistant需要交替出现(一问一答),最后一个为user提问, 且Content不能为空。
25
+ # 2.Message的Role当前可选值:system、user、assistant,其中,system角色是可选的,如果存在,必须位于列表的最开始。user和assistant需要交替出现(一问一答),最后一个为user提问, 且Content不能为空。
26
26
  # 3.Messages中Content总长度不超过16000 token,超过则会截断最前面的内容,只保留尾部内容。建议不超过4000 token。
27
27
  # @type Messages: Array
28
28
  # @param TopP: 说明:
@@ -254,6 +254,53 @@ module TencentCloud
254
254
  end
255
255
  end
256
256
 
257
+ # embedding 信息,当前不支持批量,所以数组元素数目为1。
258
+ class EmbeddingData < TencentCloud::Common::AbstractModel
259
+ # @param Embedding: embedding 信息。
260
+ # 注意:此字段可能返回 null,表示取不到有效值。
261
+ # @type Embedding: Array
262
+ # @param Index: 下标。
263
+ # 注意:此字段可能返回 null,表示取不到有效值。
264
+ # @type Index: Integer
265
+ # @param Object: embedding
266
+ # 注意:此字段可能返回 null,表示取不到有效值。
267
+ # @type Object: String
268
+
269
+ attr_accessor :Embedding, :Index, :Object
270
+
271
+ def initialize(embedding=nil, index=nil, object=nil)
272
+ @Embedding = embedding
273
+ @Index = index
274
+ @Object = object
275
+ end
276
+
277
+ def deserialize(params)
278
+ @Embedding = params['Embedding']
279
+ @Index = params['Index']
280
+ @Object = params['Object']
281
+ end
282
+ end
283
+
284
+ # token 使用计数。
285
+ class EmbeddingUsage < TencentCloud::Common::AbstractModel
286
+ # @param PromptTokens: 输入Token数。
287
+ # @type PromptTokens: Integer
288
+ # @param TotalTokens: 总Token数。
289
+ # @type TotalTokens: Integer
290
+
291
+ attr_accessor :PromptTokens, :TotalTokens
292
+
293
+ def initialize(prompttokens=nil, totaltokens=nil)
294
+ @PromptTokens = prompttokens
295
+ @TotalTokens = totaltokens
296
+ end
297
+
298
+ def deserialize(params)
299
+ @PromptTokens = params['PromptTokens']
300
+ @TotalTokens = params['TotalTokens']
301
+ end
302
+ end
303
+
257
304
  # 运行时异常信息。
258
305
  class ErrorMsg < TencentCloud::Common::AbstractModel
259
306
  # @param Msg: 错误提示信息。
@@ -276,6 +323,56 @@ module TencentCloud
276
323
  end
277
324
  end
278
325
 
326
+ # GetEmbedding请求参数结构体
327
+ class GetEmbeddingRequest < TencentCloud::Common::AbstractModel
328
+ # @param Input: 输入文本。总长度不超过1024 个token, 超过则会截断最后面的内容。
329
+ # @type Input: String
330
+
331
+ attr_accessor :Input
332
+
333
+ def initialize(input=nil)
334
+ @Input = input
335
+ end
336
+
337
+ def deserialize(params)
338
+ @Input = params['Input']
339
+ end
340
+ end
341
+
342
+ # GetEmbedding返回参数结构体
343
+ class GetEmbeddingResponse < TencentCloud::Common::AbstractModel
344
+ # @param Data: 返回的 embedding 信息。
345
+ # @type Data: Array
346
+ # @param Usage: token 使用计数,按照总token数量收费。
347
+ # @type Usage: :class:`Tencentcloud::Hunyuan.v20230901.models.EmbeddingUsage`
348
+ # @param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
349
+ # @type RequestId: String
350
+
351
+ attr_accessor :Data, :Usage, :RequestId
352
+
353
+ def initialize(data=nil, usage=nil, requestid=nil)
354
+ @Data = data
355
+ @Usage = usage
356
+ @RequestId = requestid
357
+ end
358
+
359
+ def deserialize(params)
360
+ unless params['Data'].nil?
361
+ @Data = []
362
+ params['Data'].each do |i|
363
+ embeddingdata_tmp = EmbeddingData.new
364
+ embeddingdata_tmp.deserialize(i)
365
+ @Data << embeddingdata_tmp
366
+ end
367
+ end
368
+ unless params['Usage'].nil?
369
+ @Usage = EmbeddingUsage.new
370
+ @Usage.deserialize(params['Usage'])
371
+ end
372
+ @RequestId = params['RequestId']
373
+ end
374
+ end
375
+
279
376
  # GetTokenCount请求参数结构体
280
377
  class GetTokenCountRequest < TencentCloud::Common::AbstractModel
281
378
  # @param Prompt: 输入文本
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tencentcloud-sdk-hunyuan
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.741
4
+ version: 3.0.743
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tencent Cloud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-04 00:00:00.000000000 Z
11
+ date: 2024-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tencentcloud-sdk-common