Class: TencentCloud::Hunyuan::V20230901::Client

Inherits:
Common::AbstractClient
  • Object
show all
Defined in:
lib/v20230901/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(credential, region, profile = nil) ⇒ Client



24
25
26
27
28
29
# File 'lib/v20230901/client.rb', line 24

def initialize(credential, region, profile = nil)
    api_version = '2023-09-01'
    api_endpoint = 'hunyuan.tencentcloudapi.com'
    sdk_version = 'HUNYUAN_' + File.read(File.expand_path('../VERSION', __dir__)).strip
    super(credential, region, api_version, api_endpoint, sdk_version, profile)
end

Instance Method Details

#ActivateService(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::ActivateServiceResponse



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/v20230901/client.rb', line 37

def ActivateService(request)
  body = send_request('ActivateService', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = ActivateServiceResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#ChatCompletions(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::ChatCompletionsResponse



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/v20230901/client.rb', line 68

def ChatCompletions(request)
  body = send_request('ChatCompletions', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = ChatCompletionsResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#ChatTranslations(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::ChatTranslationsResponse



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/v20230901/client.rb', line 97

def ChatTranslations(request)
  body = send_request('ChatTranslations', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = ChatTranslationsResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#CreateThread(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::CreateThreadResponse



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/v20230901/client.rb', line 126

def CreateThread(request)
  body = send_request('CreateThread', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = CreateThreadResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#FilesDeletions(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::FilesDeletionsResponse



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/v20230901/client.rb', line 150

def FilesDeletions(request)
  body = send_request('FilesDeletions', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = FilesDeletionsResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#FilesList(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::FilesListResponse



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/v20230901/client.rb', line 174

def FilesList(request)
  body = send_request('FilesList', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = FilesListResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#FilesUploads(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::FilesUploadsResponse



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/v20230901/client.rb', line 199

def FilesUploads(request)
  body = send_request('FilesUploads', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = FilesUploadsResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#GetEmbedding(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::GetEmbeddingResponse



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/v20230901/client.rb', line 223

def GetEmbedding(request)
  body = send_request('GetEmbedding', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = GetEmbeddingResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#GetThread(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::GetThreadResponse



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/v20230901/client.rb', line 252

def GetThread(request)
  body = send_request('GetThread', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = GetThreadResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#GetThreadMessage(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::GetThreadMessageResponse



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/v20230901/client.rb', line 281

def GetThreadMessage(request)
  body = send_request('GetThreadMessage', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = GetThreadMessageResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#GetThreadMessageList(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::GetThreadMessageListResponse



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/v20230901/client.rb', line 310

def GetThreadMessageList(request)
  body = send_request('GetThreadMessageList', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = GetThreadMessageListResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#GetTokenCount(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::GetTokenCountResponse



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/v20230901/client.rb', line 334

def GetTokenCount(request)
  body = send_request('GetTokenCount', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = GetTokenCountResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#GroupChatCompletions(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::GroupChatCompletionsResponse



365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/v20230901/client.rb', line 365

def GroupChatCompletions(request)
  body = send_request('GroupChatCompletions', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = GroupChatCompletionsResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#ImageQuestion(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::ImageQuestionResponse



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/v20230901/client.rb', line 396

def ImageQuestion(request)
  body = send_request('ImageQuestion', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = ImageQuestionResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#QueryHunyuanImageChatJob(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::QueryHunyuanImageChatJobResponse



423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/v20230901/client.rb', line 423

def QueryHunyuanImageChatJob(request)
  body = send_request('QueryHunyuanImageChatJob', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = QueryHunyuanImageChatJobResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#QueryHunyuanImageJob(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::QueryHunyuanImageJobResponse



450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/v20230901/client.rb', line 450

def QueryHunyuanImageJob(request)
  body = send_request('QueryHunyuanImageJob', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = QueryHunyuanImageJobResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#RunThread(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::RunThreadResponse



479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/v20230901/client.rb', line 479

def RunThread(request)
  body = send_request('RunThread', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = RunThreadResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#SetPayMode(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::SetPayModeResponse



503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
# File 'lib/v20230901/client.rb', line 503

def SetPayMode(request)
  body = send_request('SetPayMode', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = SetPayModeResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#SubmitHunyuanImageChatJob(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::SubmitHunyuanImageChatJobResponse



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/v20230901/client.rb', line 530

def SubmitHunyuanImageChatJob(request)
  body = send_request('SubmitHunyuanImageChatJob', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = SubmitHunyuanImageChatJobResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#SubmitHunyuanImageJob(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::SubmitHunyuanImageJobResponse



557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
# File 'lib/v20230901/client.rb', line 557

def SubmitHunyuanImageJob(request)
  body = send_request('SubmitHunyuanImageJob', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = SubmitHunyuanImageJobResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#TextToImageLite(request) ⇒ Object

@rtype: :class:Tencentcloud::hunyuan::V20230901::TextToImageLiteResponse



582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
# File 'lib/v20230901/client.rb', line 582

def TextToImageLite(request)
  body = send_request('TextToImageLite', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = TextToImageLiteResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end