diff --git a/VERSION b/VERSION index d180a00ca..9efcb8fd9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1628 \ No newline at end of file +1.36.1629 \ No newline at end of file diff --git a/nlp-automl/CMakeLists.txt b/nlp-automl/CMakeLists.txt index c0019ba36..413a0e19e 100644 --- a/nlp-automl/CMakeLists.txt +++ b/nlp-automl/CMakeLists.txt @@ -29,6 +29,8 @@ set(nlp-automl_public_header_model include/alibabacloud/nlp-automl/model/GetAsyncPredictResult.h include/alibabacloud/nlp-automl/model/GetPredictResultRequest.h include/alibabacloud/nlp-automl/model/GetPredictResultResult.h + include/alibabacloud/nlp-automl/model/GetPredictResultHighRequest.h + include/alibabacloud/nlp-automl/model/GetPredictResultHighResult.h include/alibabacloud/nlp-automl/model/RunPreTrainServiceRequest.h include/alibabacloud/nlp-automl/model/RunPreTrainServiceResult.h include/alibabacloud/nlp-automl/model/RunPreTrainServiceNewRequest.h @@ -44,6 +46,8 @@ set(nlp-automl_src src/model/GetAsyncPredictResult.cc src/model/GetPredictResultRequest.cc src/model/GetPredictResultResult.cc + src/model/GetPredictResultHighRequest.cc + src/model/GetPredictResultHighResult.cc src/model/RunPreTrainServiceRequest.cc src/model/RunPreTrainServiceResult.cc src/model/RunPreTrainServiceNewRequest.cc diff --git a/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h b/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h index 73d57de22..d4d85a824 100644 --- a/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h +++ b/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h @@ -30,6 +30,8 @@ #include "model/GetAsyncPredictResult.h" #include "model/GetPredictResultRequest.h" #include "model/GetPredictResultResult.h" +#include "model/GetPredictResultHighRequest.h" +#include "model/GetPredictResultHighResult.h" #include "model/RunPreTrainServiceRequest.h" #include "model/RunPreTrainServiceResult.h" #include "model/RunPreTrainServiceNewRequest.h" @@ -55,6 +57,9 @@ namespace AlibabaCloud typedef Outcome GetPredictResultOutcome; typedef std::future GetPredictResultOutcomeCallable; typedef std::function&)> GetPredictResultAsyncHandler; + typedef Outcome GetPredictResultHighOutcome; + typedef std::future GetPredictResultHighOutcomeCallable; + typedef std::function&)> GetPredictResultHighAsyncHandler; typedef Outcome RunPreTrainServiceOutcome; typedef std::future RunPreTrainServiceOutcomeCallable; typedef std::function&)> RunPreTrainServiceAsyncHandler; @@ -78,6 +83,9 @@ namespace AlibabaCloud GetPredictResultOutcome getPredictResult(const Model::GetPredictResultRequest &request)const; void getPredictResultAsync(const Model::GetPredictResultRequest& request, const GetPredictResultAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GetPredictResultOutcomeCallable getPredictResultCallable(const Model::GetPredictResultRequest& request) const; + GetPredictResultHighOutcome getPredictResultHigh(const Model::GetPredictResultHighRequest &request)const; + void getPredictResultHighAsync(const Model::GetPredictResultHighRequest& request, const GetPredictResultHighAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetPredictResultHighOutcomeCallable getPredictResultHighCallable(const Model::GetPredictResultHighRequest& request) const; RunPreTrainServiceOutcome runPreTrainService(const Model::RunPreTrainServiceRequest &request)const; void runPreTrainServiceAsync(const Model::RunPreTrainServiceRequest& request, const RunPreTrainServiceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; RunPreTrainServiceOutcomeCallable runPreTrainServiceCallable(const Model::RunPreTrainServiceRequest& request) const; diff --git a/nlp-automl/include/alibabacloud/nlp-automl/model/GetPredictResultHighRequest.h b/nlp-automl/include/alibabacloud/nlp-automl/model/GetPredictResultHighRequest.h new file mode 100644 index 000000000..ccca004ef --- /dev/null +++ b/nlp-automl/include/alibabacloud/nlp-automl/model/GetPredictResultHighRequest.h @@ -0,0 +1,57 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_NLP_AUTOML_MODEL_GETPREDICTRESULTHIGHREQUEST_H_ +#define ALIBABACLOUD_NLP_AUTOML_MODEL_GETPREDICTRESULTHIGHREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Nlp_automl { +namespace Model { +class ALIBABACLOUD_NLP_AUTOML_EXPORT GetPredictResultHighRequest : public RpcServiceRequest { +public: + GetPredictResultHighRequest(); + ~GetPredictResultHighRequest(); + int getTopK() const; + void setTopK(int topK); + std::string getProduct() const; + void setProduct(const std::string &product); + int getModelId() const; + void setModelId(int modelId); + std::string getDetailTag() const; + void setDetailTag(const std::string &detailTag); + std::string getContent() const; + void setContent(const std::string &content); + std::string getModelVersion() const; + void setModelVersion(const std::string &modelVersion); + +private: + int topK_; + std::string product_; + int modelId_; + std::string detailTag_; + std::string content_; + std::string modelVersion_; +}; +} // namespace Model +} // namespace Nlp_automl +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_GETPREDICTRESULTHIGHREQUEST_H_ diff --git a/nlp-automl/include/alibabacloud/nlp-automl/model/GetPredictResultHighResult.h b/nlp-automl/include/alibabacloud/nlp-automl/model/GetPredictResultHighResult.h new file mode 100644 index 000000000..70c5c3767 --- /dev/null +++ b/nlp-automl/include/alibabacloud/nlp-automl/model/GetPredictResultHighResult.h @@ -0,0 +1,51 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_NLP_AUTOML_MODEL_GETPREDICTRESULTHIGHRESULT_H_ +#define ALIBABACLOUD_NLP_AUTOML_MODEL_GETPREDICTRESULTHIGHRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Nlp_automl + { + namespace Model + { + class ALIBABACLOUD_NLP_AUTOML_EXPORT GetPredictResultHighResult : public ServiceResult + { + public: + + + GetPredictResultHighResult(); + explicit GetPredictResultHighResult(const std::string &payload); + ~GetPredictResultHighResult(); + std::string getContent()const; + + protected: + void parse(const std::string &payload); + private: + std::string content_; + + }; + } + } +} +#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_GETPREDICTRESULTHIGHRESULT_H_ \ No newline at end of file diff --git a/nlp-automl/src/Nlp-automlClient.cc b/nlp-automl/src/Nlp-automlClient.cc index 962b61fca..bab73b703 100644 --- a/nlp-automl/src/Nlp-automlClient.cc +++ b/nlp-automl/src/Nlp-automlClient.cc @@ -195,6 +195,42 @@ Nlp_automlClient::GetPredictResultOutcomeCallable Nlp_automlClient::getPredictRe return task->get_future(); } +Nlp_automlClient::GetPredictResultHighOutcome Nlp_automlClient::getPredictResultHigh(const GetPredictResultHighRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetPredictResultHighOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetPredictResultHighOutcome(GetPredictResultHighResult(outcome.result())); + else + return GetPredictResultHighOutcome(outcome.error()); +} + +void Nlp_automlClient::getPredictResultHighAsync(const GetPredictResultHighRequest& request, const GetPredictResultHighAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getPredictResultHigh(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +Nlp_automlClient::GetPredictResultHighOutcomeCallable Nlp_automlClient::getPredictResultHighCallable(const GetPredictResultHighRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getPredictResultHigh(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + Nlp_automlClient::RunPreTrainServiceOutcome Nlp_automlClient::runPreTrainService(const RunPreTrainServiceRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/nlp-automl/src/model/GetPredictResultHighRequest.cc b/nlp-automl/src/model/GetPredictResultHighRequest.cc new file mode 100644 index 000000000..bbb206486 --- /dev/null +++ b/nlp-automl/src/model/GetPredictResultHighRequest.cc @@ -0,0 +1,81 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +using AlibabaCloud::Nlp_automl::Model::GetPredictResultHighRequest; + +GetPredictResultHighRequest::GetPredictResultHighRequest() + : RpcServiceRequest("nlp-automl", "2019-11-11", "GetPredictResultHigh") { + setMethod(HttpRequest::Method::Post); +} + +GetPredictResultHighRequest::~GetPredictResultHighRequest() {} + +int GetPredictResultHighRequest::getTopK() const { + return topK_; +} + +void GetPredictResultHighRequest::setTopK(int topK) { + topK_ = topK; + setBodyParameter(std::string("TopK"), std::to_string(topK)); +} + +std::string GetPredictResultHighRequest::getProduct() const { + return product_; +} + +void GetPredictResultHighRequest::setProduct(const std::string &product) { + product_ = product; + setBodyParameter(std::string("Product"), product); +} + +int GetPredictResultHighRequest::getModelId() const { + return modelId_; +} + +void GetPredictResultHighRequest::setModelId(int modelId) { + modelId_ = modelId; + setBodyParameter(std::string("ModelId"), std::to_string(modelId)); +} + +std::string GetPredictResultHighRequest::getDetailTag() const { + return detailTag_; +} + +void GetPredictResultHighRequest::setDetailTag(const std::string &detailTag) { + detailTag_ = detailTag; + setBodyParameter(std::string("DetailTag"), detailTag); +} + +std::string GetPredictResultHighRequest::getContent() const { + return content_; +} + +void GetPredictResultHighRequest::setContent(const std::string &content) { + content_ = content; + setBodyParameter(std::string("Content"), content); +} + +std::string GetPredictResultHighRequest::getModelVersion() const { + return modelVersion_; +} + +void GetPredictResultHighRequest::setModelVersion(const std::string &modelVersion) { + modelVersion_ = modelVersion; + setBodyParameter(std::string("ModelVersion"), modelVersion); +} + diff --git a/nlp-automl/src/model/GetPredictResultHighResult.cc b/nlp-automl/src/model/GetPredictResultHighResult.cc new file mode 100644 index 000000000..3f4e992c9 --- /dev/null +++ b/nlp-automl/src/model/GetPredictResultHighResult.cc @@ -0,0 +1,51 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::Nlp_automl; +using namespace AlibabaCloud::Nlp_automl::Model; + +GetPredictResultHighResult::GetPredictResultHighResult() : + ServiceResult() +{} + +GetPredictResultHighResult::GetPredictResultHighResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetPredictResultHighResult::~GetPredictResultHighResult() +{} + +void GetPredictResultHighResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["Content"].isNull()) + content_ = value["Content"].asString(); + +} + +std::string GetPredictResultHighResult::getContent()const +{ + return content_; +} +