tencentcloud-sdk-lkeap 3.0.991 → 3.0.992
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/v20240522/client.rb +88 -1
- data/lib/v20240522/models.rb +131 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c7926661ae4f3534bced3b8c0f24bc9ce8a5f27
|
4
|
+
data.tar.gz: 4b6d220e67e9f61203f38a6bac1ad54af57d3582
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41af88b6d45199f92342afcc0931768c058ea5d3a35cc32d3157fcd6240b4c0d6652e974e0b0d0ee2ce627486acdcf3d06d7f110e5dfbbe3212d44990702f5ec
|
7
|
+
data.tar.gz: ce1cea53469dde359002376a0e6abdee0dafac75e76e499508f47c776fd60ccd30880bf20e84d07ea98c51bc9fd1e24f5a2c9fac36804f9013695fb82df4c60d
|
data/lib/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.992
|
data/lib/v20240522/client.rb
CHANGED
@@ -29,7 +29,94 @@ module TencentCloud
|
|
29
29
|
end
|
30
30
|
|
31
31
|
|
32
|
-
#
|
32
|
+
# #### 接口功能
|
33
|
+
|
34
|
+
# 调用接口,发起一次对话请求。
|
35
|
+
|
36
|
+
# #### 已支持的模型
|
37
|
+
# - DeepSeek-V3(model 参数值为**deepseek-v3**)
|
38
|
+
# - DeepSeek-V3为671B参数MoE模型,在百科知识、数学推理等多项任务上优势突出,评测成绩在主流榜单中位列开源模型榜首。
|
39
|
+
# - 支持64K上下文长度,最大支持8K输出长度。
|
40
|
+
# - DeepSeek-R1(model 参数值为**deepseek-r1**)
|
41
|
+
# - DeepSeek-R1为671B模型,使用强化学习训练,推理过程包含大量反思和验证,思维链长度可达数万字。 该系列模型在数学、代码以及各种复杂逻辑推理任务上推理效果优异,并为用户展现了完整的思考过程。
|
42
|
+
# - 支持64K上下文长度,最大支持8K输出长度。
|
43
|
+
|
44
|
+
# #### 计费说明
|
45
|
+
# - 限时免费
|
46
|
+
|
47
|
+
# 本接口调用DeepSeek系列模型限时免费。即日至北京时间2025年2月25日23:59:59,所有腾讯云用户均可享受DeepSeek-V3、DeepSeek-R1模型限时免费服务,单账号限制接口并发上限为5。在此之后,模型价格将恢复至原价。
|
48
|
+
# - 标准计费(2025年2月26日起生效)
|
49
|
+
# ![image](https://cdn.xiaowei.qq.com/static/lke/deepseek-token.png)
|
50
|
+
|
51
|
+
|
52
|
+
# #### 快速接入
|
53
|
+
# 1. 完成[实名认证](https://console.cloud.tencent.com/developer/auth)。
|
54
|
+
# 2. 主账户前往[控制台](https://console.cloud.tencent.com/lkeap)开通服务。若为子账户,需由主账号在[权限管理](https://console.cloud.tencent.com/cam)中为子账号授权,关联预设策略,策略名称:QcloudLKEAPFullAccess。
|
55
|
+
# 3. 通过API Explorer[在线调试](https://console.cloud.tencent.com/api/explorer?Product=lkeap&Version=2024-05-22&Action=ChatCompletions)。
|
56
|
+
# 4. 使用[官方 SDK ](https://cloud.tencent.com/document/product/1772/115963#SDK)调用本接口(支持Python/Java/PHP/Go/Node.js/.NET等语言)。
|
57
|
+
|
58
|
+
# -----------
|
59
|
+
|
60
|
+
# ### SDK调用示例
|
61
|
+
# 通过本地代码调用本接口(支持Python/Java/PHP/Go/Node.js/.NET等语言):下面的代码以 Python 语言为例,展示如何访问腾讯云上的DeepSeek模型API的样例。
|
62
|
+
# (1)安装环境
|
63
|
+
# ```
|
64
|
+
# python3 -m pip install --upgrade tencentcloud-sdk-python-common
|
65
|
+
# python3 -m pip install --upgrade tencentcloud-sdk-python-lkeap
|
66
|
+
# ```
|
67
|
+
|
68
|
+
# (2)示例代码
|
69
|
+
|
70
|
+
# - 其中SecretKey和SecretID需要从腾讯云控制台获取
|
71
|
+
|
72
|
+
# - 参数params中模型Model字段可以选择“deepseek-r1“和“deepseek-v3”
|
73
|
+
|
74
|
+
# ```
|
75
|
+
# # -*- coding: utf-8 -*-
|
76
|
+
# import json
|
77
|
+
|
78
|
+
# from tencentcloud.common.common_client import CommonClient
|
79
|
+
# from tencentcloud.common import credential
|
80
|
+
# from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
|
81
|
+
# from tencentcloud.common.profile.client_profile import ClientProfile
|
82
|
+
# from tencentcloud.common.profile.http_profile import HttpProfile
|
83
|
+
|
84
|
+
# class NonStreamResponse(object):
|
85
|
+
# def __init__(self):
|
86
|
+
# self.response = ""
|
87
|
+
|
88
|
+
# def _deserialize(self, obj):
|
89
|
+
# self.response = json.dumps(obj)
|
90
|
+
|
91
|
+
# try:
|
92
|
+
# # 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
|
93
|
+
# # 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
|
94
|
+
# # 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
|
95
|
+
# cred = credential.Credential("", "")
|
96
|
+
|
97
|
+
# httpProfile = HttpProfile()
|
98
|
+
# httpProfile.endpoint = "lkeap.tencentcloudapi.com"
|
99
|
+
# httpProfile.reqTimeout = 40000 # 流式接口可能耗时较长
|
100
|
+
# clientProfile = ClientProfile()
|
101
|
+
# clientProfile.httpProfile = httpProfile
|
102
|
+
|
103
|
+
# params = "{\"Model\":\"deepseek-r1\",\"Messages\":[{\"Role\":\"user\",\"Content\":\"你好\"}],\"Stream\":true}";
|
104
|
+
# common_client = CommonClient("lkeap", "2024-05-22", cred, "ap-guangzhou", profile=clientProfile)
|
105
|
+
# resp = common_client._call_and_deserialize("ChatCompletions", json.loads(params), NonStreamResponse)
|
106
|
+
# if isinstance(resp, NonStreamResponse): # 非流式响应
|
107
|
+
# print(resp.response)
|
108
|
+
# else: # 流式响应
|
109
|
+
# for event in resp:
|
110
|
+
# print(event)
|
111
|
+
# except TencentCloudSDKException as err:
|
112
|
+
# print(err)
|
113
|
+
|
114
|
+
# ```
|
115
|
+
|
116
|
+
# **DeepSeek-R1使用建议**
|
117
|
+
|
118
|
+
# 1. 将温度设置在 0.5-0.7 范围内(建议为0.6),以防止无休止的重复或不连贯的输出。
|
119
|
+
# 2. 避免添加system prompt,所有说明都应包含在user prompt中。
|
33
120
|
|
34
121
|
# @param request: Request instance for ChatCompletions.
|
35
122
|
# @type request: :class:`Tencentcloud::lkeap::V20240522::ChatCompletionsRequest`
|
data/lib/v20240522/models.rb
CHANGED
@@ -108,13 +108,19 @@ module TencentCloud
|
|
108
108
|
# @type Messages: Array
|
109
109
|
# @param Stream: 是否流式输出
|
110
110
|
# @type Stream: Boolean
|
111
|
+
# @param Temperature: 控制生成的随机性,较高的值会产生更多样化的输出。
|
112
|
+
# @type Temperature: Float
|
113
|
+
# @param MaxTokens: 最大生成的token数量
|
114
|
+
# @type MaxTokens: Integer
|
111
115
|
|
112
|
-
attr_accessor :Model, :Messages, :Stream
|
116
|
+
attr_accessor :Model, :Messages, :Stream, :Temperature, :MaxTokens
|
113
117
|
|
114
|
-
def initialize(model=nil, messages=nil, stream=nil)
|
118
|
+
def initialize(model=nil, messages=nil, stream=nil, temperature=nil, maxtokens=nil)
|
115
119
|
@Model = model
|
116
120
|
@Messages = messages
|
117
121
|
@Stream = stream
|
122
|
+
@Temperature = temperature
|
123
|
+
@MaxTokens = maxtokens
|
118
124
|
end
|
119
125
|
|
120
126
|
def deserialize(params)
|
@@ -128,25 +134,119 @@ module TencentCloud
|
|
128
134
|
end
|
129
135
|
end
|
130
136
|
@Stream = params['Stream']
|
137
|
+
@Temperature = params['Temperature']
|
138
|
+
@MaxTokens = params['MaxTokens']
|
131
139
|
end
|
132
140
|
end
|
133
141
|
|
134
142
|
# ChatCompletions返回参数结构体
|
135
143
|
class ChatCompletionsResponse < TencentCloud::Common::AbstractModel
|
144
|
+
# @param Created: Unix 时间戳,单位为秒。
|
145
|
+
# @type Created: Integer
|
146
|
+
# @param Usage: Token 统计信息。
|
147
|
+
# 按照总 Token 数量计费。
|
148
|
+
# @type Usage: :class:`Tencentcloud::Lkeap.v20240522.models.ChatUsage`
|
149
|
+
# @param Id: 本次请求的 RequestId。
|
150
|
+
# @type Id: String
|
151
|
+
# @param Choices: 回复内容。
|
152
|
+
# @type Choices: Array
|
153
|
+
# @param Model: 模型名称。
|
154
|
+
# @type Model: String
|
136
155
|
# @param RequestId: 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。本接口为流式响应接口,当请求成功时,RequestId 会被放在 HTTP 响应的 Header "X-TC-RequestId" 中。
|
137
156
|
# @type RequestId: String
|
138
157
|
|
139
|
-
attr_accessor :RequestId
|
158
|
+
attr_accessor :Created, :Usage, :Id, :Choices, :Model, :RequestId
|
140
159
|
|
141
|
-
def initialize(requestid=nil)
|
160
|
+
def initialize(created=nil, usage=nil, id=nil, choices=nil, model=nil, requestid=nil)
|
161
|
+
@Created = created
|
162
|
+
@Usage = usage
|
163
|
+
@Id = id
|
164
|
+
@Choices = choices
|
165
|
+
@Model = model
|
142
166
|
@RequestId = requestid
|
143
167
|
end
|
144
168
|
|
145
169
|
def deserialize(params)
|
170
|
+
@Created = params['Created']
|
171
|
+
unless params['Usage'].nil?
|
172
|
+
@Usage = ChatUsage.new
|
173
|
+
@Usage.deserialize(params['Usage'])
|
174
|
+
end
|
175
|
+
@Id = params['Id']
|
176
|
+
unless params['Choices'].nil?
|
177
|
+
@Choices = []
|
178
|
+
params['Choices'].each do |i|
|
179
|
+
choice_tmp = Choice.new
|
180
|
+
choice_tmp.deserialize(i)
|
181
|
+
@Choices << choice_tmp
|
182
|
+
end
|
183
|
+
end
|
184
|
+
@Model = params['Model']
|
146
185
|
@RequestId = params['RequestId']
|
147
186
|
end
|
148
187
|
end
|
149
188
|
|
189
|
+
# 消耗量
|
190
|
+
class ChatUsage < TencentCloud::Common::AbstractModel
|
191
|
+
# @param PromptTokens: 输入token数
|
192
|
+
# @type PromptTokens: Integer
|
193
|
+
# @param CompletionTokens: 输出token数
|
194
|
+
# @type CompletionTokens: Integer
|
195
|
+
# @param TotalTokens: 总token数
|
196
|
+
# @type TotalTokens: Integer
|
197
|
+
|
198
|
+
attr_accessor :PromptTokens, :CompletionTokens, :TotalTokens
|
199
|
+
|
200
|
+
def initialize(prompttokens=nil, completiontokens=nil, totaltokens=nil)
|
201
|
+
@PromptTokens = prompttokens
|
202
|
+
@CompletionTokens = completiontokens
|
203
|
+
@TotalTokens = totaltokens
|
204
|
+
end
|
205
|
+
|
206
|
+
def deserialize(params)
|
207
|
+
@PromptTokens = params['PromptTokens']
|
208
|
+
@CompletionTokens = params['CompletionTokens']
|
209
|
+
@TotalTokens = params['TotalTokens']
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
# 返回的回复, 支持多个
|
214
|
+
class Choice < TencentCloud::Common::AbstractModel
|
215
|
+
# @param FinishReason: 结束标志位,可能为 stop、 sensitive或者tool_calls。
|
216
|
+
# stop 表示输出正常结束。
|
217
|
+
# sensitive 只在开启流式输出审核时会出现,表示安全审核未通过。
|
218
|
+
# tool_calls 标识函数调用。
|
219
|
+
# @type FinishReason: String
|
220
|
+
# @param Delta: 增量返回值,流式调用时使用该字段。
|
221
|
+
# @type Delta: :class:`Tencentcloud::Lkeap.v20240522.models.Delta`
|
222
|
+
# @param Message: 返回值,非流式调用时使用该字段。
|
223
|
+
# @type Message: :class:`Tencentcloud::Lkeap.v20240522.models.Message`
|
224
|
+
# @param Index: 索引值,流式调用时使用该字段。
|
225
|
+
# @type Index: Integer
|
226
|
+
|
227
|
+
attr_accessor :FinishReason, :Delta, :Message, :Index
|
228
|
+
|
229
|
+
def initialize(finishreason=nil, delta=nil, message=nil, index=nil)
|
230
|
+
@FinishReason = finishreason
|
231
|
+
@Delta = delta
|
232
|
+
@Message = message
|
233
|
+
@Index = index
|
234
|
+
end
|
235
|
+
|
236
|
+
def deserialize(params)
|
237
|
+
@FinishReason = params['FinishReason']
|
238
|
+
unless params['Delta'].nil?
|
239
|
+
@Delta = Delta.new
|
240
|
+
@Delta.deserialize(params['Delta'])
|
241
|
+
end
|
242
|
+
unless params['Message'].nil?
|
243
|
+
@Message = Message.new
|
244
|
+
@Message.deserialize(params['Message'])
|
245
|
+
end
|
246
|
+
@Index = params['Index']
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
150
250
|
# CreateAttributeLabel请求参数结构体
|
151
251
|
class CreateAttributeLabelRequest < TencentCloud::Common::AbstractModel
|
152
252
|
# @param Labels: 属性标签信息
|
@@ -601,6 +701,26 @@ module TencentCloud
|
|
601
701
|
end
|
602
702
|
end
|
603
703
|
|
704
|
+
# 返回的内容
|
705
|
+
class Delta < TencentCloud::Common::AbstractModel
|
706
|
+
# @param Role: 角色名称。
|
707
|
+
# @type Role: String
|
708
|
+
# @param Content: 内容详情。
|
709
|
+
# @type Content: String
|
710
|
+
|
711
|
+
attr_accessor :Role, :Content
|
712
|
+
|
713
|
+
def initialize(role=nil, content=nil)
|
714
|
+
@Role = role
|
715
|
+
@Content = content
|
716
|
+
end
|
717
|
+
|
718
|
+
def deserialize(params)
|
719
|
+
@Role = params['Role']
|
720
|
+
@Content = params['Content']
|
721
|
+
end
|
722
|
+
end
|
723
|
+
|
604
724
|
# DescribeDoc请求参数结构体
|
605
725
|
class DescribeDocRequest < TencentCloud::Common::AbstractModel
|
606
726
|
|
@@ -1082,17 +1202,22 @@ module TencentCloud
|
|
1082
1202
|
# @type Role: String
|
1083
1203
|
# @param Content: 内容
|
1084
1204
|
# @type Content: String
|
1205
|
+
# @param ReasoningContent: 思维链内容。
|
1206
|
+
# ReasoningConent参数仅支持出参,且只有deepseek-r1模型会返回。
|
1207
|
+
# @type ReasoningContent: String
|
1085
1208
|
|
1086
|
-
attr_accessor :Role, :Content
|
1209
|
+
attr_accessor :Role, :Content, :ReasoningContent
|
1087
1210
|
|
1088
|
-
def initialize(role=nil, content=nil)
|
1211
|
+
def initialize(role=nil, content=nil, reasoningcontent=nil)
|
1089
1212
|
@Role = role
|
1090
1213
|
@Content = content
|
1214
|
+
@ReasoningContent = reasoningcontent
|
1091
1215
|
end
|
1092
1216
|
|
1093
1217
|
def deserialize(params)
|
1094
1218
|
@Role = params['Role']
|
1095
1219
|
@Content = params['Content']
|
1220
|
+
@ReasoningContent = params['ReasoningContent']
|
1096
1221
|
end
|
1097
1222
|
end
|
1098
1223
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tencentcloud-sdk-lkeap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.992
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tencent Cloud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tencentcloud-sdk-common
|