日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

搜索判定API

1. 參數(shù)

1.1 入?yún)?/b>

一級參數(shù)

參數(shù)

類型

是否必傳

說明

algorithm

string

標識符

model

string

模型版本,默認不傳

input

map<string, object>

輸入?yún)?shù)

parameters

map<string, object>

配置參數(shù)

debug

boolean

調試模式,默認false

二級參數(shù)

二級參數(shù)

類型

是否必傳

說明

input.query

string

搜索判定內容

{
    "algorithm": "retrieve_router",
    "model": "",
    "input": {
        "query": "你好"
    }
}

1.2 出參

一級參數(shù)

參數(shù)

類型

說明

requestId

string

請求id

status

int

請求結果狀態(tài)

message

string

響應信息

data

map<string, object>

搜索判定結果

debugInfo

map<string, object>

調試信息

二級參數(shù)

二級參數(shù)

類型

說明

data.retrieveRouter

boolean

搜索判定的結果:

  • true:需要搜索

  • false:不需要搜索

data.timeCost

float

服務時間消耗,單位ms

data.inputTokens

int

輸入token數(shù)

data.outputTokens

int

輸出token數(shù)

{
    "data": {
        "retrieveRouter": false,
        "outputTokens": 1,
        "timeCost": 36.9,
        "inputTokens": 4
    },
    "requestId": null,
    "debugInfo": null,
    "message": null,
    "status": 0
}

2. SDK調用

2.1 Java SDK

2.1.1 Maven依賴

<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>alinlp20200629</artifactId>
    <version>3.0.0</version>
</dependency>

<!--出現(xiàn)java.lang.NoSuchMethodError: com.aliyun.credentials.Client.getCredential()Lcom/aliyun/credentials/models/CredentialModel;異常則引入-->
<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>credentials-java</artifactId>
    <version>0.3.0</version>
</dependency>

2.1.2 調用示例

 * 使用AK&SK初始化賬號Client
 * @param accessKeyId
 * @param accessKeySecret
 * @return Client
 * @throws Exception
 */
public static Client createClient(String accessKeyId, String accessKeySecret) throws Exception {
    Config config = new Config()
    // 必填,您的 AccessKey ID
    .setAccessKeyId(accessKeyId)
    // 必填,您的 AccessKey Secret
    .setAccessKeySecret(accessKeySecret);
    // Endpoint 請參考 https://api.aliyun.com/product/alinlp
    config.endpoint = "alinlp.cn-beijing.aliyuncs.com";
    return new Client(config);
}

public static void main(String[] args) throws Exception {
    String accessKeyId = "xxx";
    String accessKeySecret = "xxx";
    Client client = createClient(accessKeyId, accessKeySecret);
		PostISRetrieveRouterRequest request = new PostISRetrieveRouterRequest();
		request.setAlgorithm("retrieve_router");
		String input = "{\"query\": \"你好\"}";
		Map<String, Object> inputMap = JSONObject.parseObject(input, Map.class);
    request.setInput(inputMap);
    PostISRetrieveRouterResponse response = client.postISRetrieveRouter(request);
    System.out.println(JSONObject.toJSONString(response.getBody()));
}

2.2 Python SDK

2.2.1 pip源

pip install alibabacloud-alinlp20200629==3.0.0

2.2.2 調用示例

import json

from alibabacloud_alinlp20200629 import client
from alibabacloud_tea_openapi import models as api_models
from alibabacloud_alinlp20200629 import models


def retrieve_router():
    config = api_models.Config(
        access_key_id='xxx',
        access_key_secret='xxx',
        region_id="cn-beijing")
    nlp_client = client.Client(config)
    request = models.PostISRetrieveRouterRequest()
    input_str = '{\"query\": \"你好\"}'
    request.input = json.loads(input_str)
    request.algorithm = 'retrieve_router'
    response = nlp_client.post_isretrieve_router(request)
    print(json.dumps(response.body.data, ensure_ascii=False))


if __name__ == '__main__':
    retrieve_router()