链接复制成功!
Create Request接口
功能介绍
create a code generation request.if agent receives a code generation request, it will:- record the request into mysql,- decompose the request into topn tasks.- send the tasks to kafka.if agent receives a duplicated code generation request, it will not decompose request and send to kafka.
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
URI
POST /v2/aims/codemodelserver/code-generation/request
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
topn |
否 |
Integer |
the number of samples |
scenario |
否 |
String |
the scenario of code content |
resubmit |
否 |
Boolean |
if resubmit is true, the de-duplication will be ignored |
model_id |
否 |
String |
choose the model |
request_type |
否 |
String |
An enumeration.
枚举值:
|
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
x-auth-token |
是 |
String |
iam x-auth-token |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
context |
否 |
String |
context |
docstring |
否 |
String |
docstring |
ide_type |
否 |
String |
the type of ide |
ide_version |
否 |
String |
the version of ide |
language |
是 |
String |
code language |
plugin_version |
否 |
String |
the version of plugin |
signature |
否 |
String |
signature |
above_text |
否 |
String |
the text above the cursor |
following_text |
否 |
String |
the text following the cursor |
响应参数
状态码: 200
参数 |
参数类型 |
描述 |
---|---|---|
request_id |
String |
the unique id of the request |
status |
String |
the status of the request 枚举值:
|
dispatched_task_number |
Integer |
the number of tasks dispatched successfully |
请求示例
创建一个签名为“def add(x, y):”、语言为“python”、文档字符串为“sum two numbers”的代码生成请求。
POST https://{endpoint}/v2/aims/codemodelserver/code-generation/request
{
"signature" : "def add(x, y):",
"language" : "python",
"docstring" : "sum two numbers",
"context" : " return x + y",
"ide_type" : "pycharm professional",
"ide_version" : "2022.1.3",
"plugin_version" : "v0.1.0"
}
响应示例
状态码: 200
Successful Response
{
"request_id" : "d980c2b5242eb97aa07a1f6645a6793a",
"status" : "created",
"dispatched_task_number" : 0
}
状态码
状态码 |
描述 |
---|---|
200 |
Successful Response |
错误码
请参见错误码。