tencentcloud-sdk-hunyuan 3.0.741 → 3.0.742
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/VERSION +1 -1
- data/lib/v20230901/client.rb +24 -0
- data/lib/v20230901/models.rb +97 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ae186995e6e651f55659e6faa5ed56f5b6991cd
|
4
|
+
data.tar.gz: 9f9e60bf66ffedabd87eaea018143d6e90d9c81b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 151bf6f1fc593ccfc96038396bdf4520a198220f6ccb4110ff61a8cddc584e2d235a9d1504b19036ebb4fd1449d4700d4b2b1f4fdf58c281fd29783d0d9a04b7
|
7
|
+
data.tar.gz: f11adffea0332bceeebfcadd3d4923b060c07d54d1648c2f1b49e4b9da4ef2ddcda0074ed2bab4aaafd6ca0e6aa3d618ad06cc3d01101e5a386823153853cef6
|
data/lib/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.742
|
data/lib/v20230901/client.rb
CHANGED
@@ -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.
|
data/lib/v20230901/models.rb
CHANGED
@@ -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: 输入文本
|