tencentcloud-sdk-lkeap 3.0.991 → 3.0.993
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.
- checksums.yaml +4 -4
- data/lib/VERSION +1 -1
- data/lib/v20240522/client.rb +94 -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: c8913f944b23edb62fcfde4a836cf2613308baa6
|
4
|
+
data.tar.gz: fc79381e1976cd6a702a580346c103032bb506b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85fafc1a6ba43b4adf7f04034fa5b641fb685dd59d106b3434f2a9668f5f36569e46a81e4f13a48153073b2989e1de42937e53c6290e5f83b72fd651ec8968f3
|
7
|
+
data.tar.gz: bdb5c02835a308f952183f4c49e70889f51d80e56b2d27113e34c9b5f9c6db98166b9f0bc09ce82bb6eb195e63a7b51b64d0fdaa55923350847eafd95521064f
|
data/lib/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.993
|
data/lib/v20240522/client.rb
CHANGED
@@ -29,7 +29,100 @@ 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
|
+
# 
|
50
|
+
|
51
|
+
# ### Openai兼容协议接口
|
52
|
+
# 知识引擎原子能力大模型对话 API 兼容了 OpenAI 的接口规范,这意味着您可以直接使用 OpenAI 官方提供的 SDK 来调用大模型对话接口。您仅需要将 base_url 和 [api_key](https://cloud.tencent.com/document/product/1772/115970) 替换成相关配置,不需要对应用做额外修改,即可无缝将您的应用切换到相应的大模型。
|
53
|
+
# > base_url: https://api.lkeap.cloud.tencent.com/v1
|
54
|
+
|
55
|
+
# > api_key的获取请参考[API KEY管理](https://cloud.tencent.com/document/product/1772/115970)
|
56
|
+
|
57
|
+
|
58
|
+
# #### 快速接入
|
59
|
+
# 1. 完成[实名认证](https://console.cloud.tencent.com/developer/auth)。
|
60
|
+
# 2. 主账户前往[控制台](https://console.cloud.tencent.com/lkeap)开通服务。若为子账户,需由主账号在[权限管理](https://console.cloud.tencent.com/cam)中为子账号授权,关联预设策略,策略名称:QcloudLKEAPFullAccess。
|
61
|
+
# 3. 通过API Explorer[在线调试](https://console.cloud.tencent.com/api/explorer?Product=lkeap&Version=2024-05-22&Action=ChatCompletions)。
|
62
|
+
# 4. 使用[官方 SDK ](https://cloud.tencent.com/document/product/1772/115963#SDK)调用本接口(支持Python/Java/PHP/Go/Node.js/.NET等语言)。
|
63
|
+
|
64
|
+
# -----------
|
65
|
+
|
66
|
+
# ### SDK调用示例
|
67
|
+
# 通过本地代码调用本接口(支持Python/Java/PHP/Go/Node.js/.NET等语言):下面的代码以 Python 语言为例,展示如何访问腾讯云上的DeepSeek模型API的样例。
|
68
|
+
# (1)安装环境
|
69
|
+
# ```
|
70
|
+
# python3 -m pip install --upgrade tencentcloud-sdk-python-common
|
71
|
+
# python3 -m pip install --upgrade tencentcloud-sdk-python-lkeap
|
72
|
+
# ```
|
73
|
+
|
74
|
+
# (2)示例代码
|
75
|
+
|
76
|
+
# - 其中SecretKey和SecretID需要从腾讯云控制台获取
|
77
|
+
|
78
|
+
# - 参数params中模型Model字段可以选择“deepseek-r1“和“deepseek-v3”
|
79
|
+
|
80
|
+
# ```
|
81
|
+
# # -*- coding: utf-8 -*-
|
82
|
+
# import json
|
83
|
+
|
84
|
+
# from tencentcloud.common.common_client import CommonClient
|
85
|
+
# from tencentcloud.common import credential
|
86
|
+
# from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
|
87
|
+
# from tencentcloud.common.profile.client_profile import ClientProfile
|
88
|
+
# from tencentcloud.common.profile.http_profile import HttpProfile
|
89
|
+
|
90
|
+
# class NonStreamResponse(object):
|
91
|
+
# def __init__(self):
|
92
|
+
# self.response = ""
|
93
|
+
|
94
|
+
# def _deserialize(self, obj):
|
95
|
+
# self.response = json.dumps(obj)
|
96
|
+
|
97
|
+
# try:
|
98
|
+
# # 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
|
99
|
+
# # 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
|
100
|
+
# # 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
|
101
|
+
# cred = credential.Credential("", "")
|
102
|
+
|
103
|
+
# httpProfile = HttpProfile()
|
104
|
+
# httpProfile.endpoint = "lkeap.tencentcloudapi.com"
|
105
|
+
# httpProfile.reqTimeout = 40000 # 流式接口可能耗时较长
|
106
|
+
# clientProfile = ClientProfile()
|
107
|
+
# clientProfile.httpProfile = httpProfile
|
108
|
+
|
109
|
+
# params = "{\"Model\":\"deepseek-r1\",\"Messages\":[{\"Role\":\"user\",\"Content\":\"你好\"}],\"Stream\":true}";
|
110
|
+
# common_client = CommonClient("lkeap", "2024-05-22", cred, "ap-guangzhou", profile=clientProfile)
|
111
|
+
# resp = common_client._call_and_deserialize("ChatCompletions", json.loads(params), NonStreamResponse)
|
112
|
+
# if isinstance(resp, NonStreamResponse): # 非流式响应
|
113
|
+
# print(resp.response)
|
114
|
+
# else: # 流式响应
|
115
|
+
# for event in resp:
|
116
|
+
# print(event)
|
117
|
+
# except TencentCloudSDKException as err:
|
118
|
+
# print(err)
|
119
|
+
|
120
|
+
# ```
|
121
|
+
|
122
|
+
# **DeepSeek-R1使用建议**
|
123
|
+
|
124
|
+
# 1. 将温度设置在 0.5-0.7 范围内(建议为0.6),以防止无休止的重复或不连贯的输出。
|
125
|
+
# 2. 避免添加system prompt,所有说明都应包含在user prompt中。
|
33
126
|
|
34
127
|
# @param request: Request instance for ChatCompletions.
|
35
128
|
# @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.993
|
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-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tencentcloud-sdk-common
|