Эх сурвалжийг харах

五大指标的进出水告警 + 决策 + 当时数据记录 等处理

wangmiaomiao 10 сар өмнө
parent
commit
e1a94a510c
20 өөрчлөгдсөн 3874 нэмэгдсэн , 51 устгасан
  1. 3 0
      slibra-common/src/main/java/com/slibra/common/constant/MyConstants.java
  2. 11 0
      slibra-common/src/main/java/com/slibra/common/utils/DateUtils.java
  3. 31 0
      slibra-quartz/pom.xml
  4. 248 37
      slibra-quartz/src/main/java/com/slibra/quartz/task/RyTask.java
  5. 115 0
      slibra-quartz/src/main/java/inference/Inference.java
  6. 514 0
      slibra-quartz/src/main/java/inference/InferenceAPIsServiceGrpc.java
  7. 850 0
      slibra-quartz/src/main/java/inference/PredictionResponse.java
  8. 61 0
      slibra-quartz/src/main/java/inference/PredictionResponseOrBuilder.java
  9. 1175 0
      slibra-quartz/src/main/java/inference/PredictionsRequest.java
  10. 117 0
      slibra-quartz/src/main/java/inference/PredictionsRequestOrBuilder.java
  11. 70 0
      slibra-quartz/src/main/java/inference/Test.java
  12. 20 0
      slibra-quartz/src/main/java/inference/TestJC.java
  13. 544 0
      slibra-quartz/src/main/java/inference/TorchServeHealthResponse.java
  14. 27 0
      slibra-quartz/src/main/java/inference/TorchServeHealthResponseOrBuilder.java
  15. 5 5
      slibra-system/src/main/java/com/slibra/business/domain/TXinyiChatRecord.java
  16. 1 1
      slibra-system/src/main/java/com/slibra/business/domain/TXinyiWarningRecord.java
  17. 3 0
      slibra-system/src/main/java/com/slibra/business/mapper/TXinyiIndustryMapper.java
  18. 6 6
      slibra-system/src/main/resources/mapper/business/TXinyiChatRecordMapper.xml
  19. 72 1
      slibra-system/src/main/resources/mapper/business/TXinyiIndustryMapper.xml
  20. 1 1
      slibra-system/src/main/resources/mapper/business/TXinyiWarningRecordMapper.xml

+ 3 - 0
slibra-common/src/main/java/com/slibra/common/constant/MyConstants.java

@@ -21,4 +21,7 @@ public class MyConstants {
     public static final String WARNING_LEVEL_THREE = "三级";
     public static final String WARNING_DEFAULT_CREATE = "task-job";
 
+
+    public static final int maxCount = 30;
+
 }

+ 11 - 0
slibra-common/src/main/java/com/slibra/common/utils/DateUtils.java

@@ -25,6 +25,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
     public static String YYYY_MM_DD = "yyyy-MM-dd";
 
     public static String YYYY_MM_DD_HH = "yyyy-MM-dd HH";
+    public static String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
 
     public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
 
@@ -151,6 +152,16 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
     }
 
+
+
+    /**
+     * 计算相差小时数
+     */
+    public static int differentHoursByMillisecond(Date date1, Date date2)
+    {
+        return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600)));
+    }
+
     /**
      * 计算时间差
      *

+ 31 - 0
slibra-quartz/pom.xml

@@ -51,6 +51,37 @@
             <artifactId>slibra-framework</artifactId>
         </dependency>
 
+
+        <dependency>
+            <groupId>com.google.protobuf</groupId>
+            <artifactId>protobuf-java</artifactId>
+            <version>3.11.0</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/com.google.api.grpc/proto-google-common-protos -->
+        <dependency>
+            <groupId>com.google.api.grpc</groupId>
+            <artifactId>proto-google-common-protos</artifactId>
+            <version>2.37.1</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/io.grpc/grpc-protobuf -->
+        <dependency>
+            <groupId>io.grpc</groupId>
+            <artifactId>grpc-protobuf</artifactId>
+            <version>1.62.2</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/io.grpc/grpc-stub -->
+        <dependency>
+            <groupId>io.grpc</groupId>
+            <artifactId>grpc-stub</artifactId>
+            <version>1.62.2</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/io.grpc/grpc-netty -->
+        <dependency>
+            <groupId>io.grpc</groupId>
+            <artifactId>grpc-netty</artifactId>
+            <version>1.62.2</version>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 248 - 37
slibra-quartz/src/main/java/com/slibra/quartz/task/RyTask.java

@@ -4,31 +4,37 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.http.HttpRequest;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+import com.google.protobuf.ByteString;
 import com.slibra.business.domain.TXinyiIndustry;
 import com.slibra.business.domain.TXinyiNormConfig;
 import com.slibra.business.domain.TXinyiRobot;
 import com.slibra.business.domain.TXinyiWarningRecord;
-import com.slibra.business.mapper.TXinyiIndustryMapper;
-import com.slibra.business.mapper.TXinyiNormConfigMapper;
-import com.slibra.business.mapper.TXinyiRobotMapper;
-import com.slibra.business.mapper.TXinyiWarningRecordMapper;
+import com.slibra.business.mapper.*;
+import com.slibra.business.req.ChatReq;
 import com.slibra.common.constant.MyConstants;
 import com.slibra.common.enums.BusinessEnum;
 import com.slibra.common.enums.DataSourceType;
 import com.slibra.common.utils.DateUtils;
+import com.slibra.common.utils.SecurityUtils;
+import com.slibra.common.utils.uuid.IdUtils;
 import com.slibra.framework.datasource.DynamicDataSourceContextHolder;
+import inference.InferenceAPIsServiceGrpc;
+import inference.PredictionResponse;
+import inference.PredictionsRequest;
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import com.slibra.common.utils.StringUtils;
 import org.springframework.util.CollectionUtils;
-import org.springframework.util.StopWatch;
 
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
-import java.util.concurrent.TimeUnit;
 
 import static com.slibra.common.constant.MyConstants.*;
 
@@ -70,6 +76,9 @@ public class RyTask
     @Autowired
     private TXinyiWarningRecordMapper xinyiWarningRecordMapper;
 
+    @Autowired
+    private TXinyiChatRecordMapper xinyiChatRecordMapper;
+
 
 //    public final static StopWatch watch = new StopWatch("task");
     public static final String[] queryTags = {"信义污水厂JS_COD_Value","信义污水厂JS_PH_Value","信义污水厂JS_SS_Value","信义污水厂JS_ZL_Value","信义污水厂JS_ZA_Value","信义污水厂JS_AD_Value","信义污水厂JS_T_Value","信义污水厂进水泵房液位","信义污水厂出水瞬时流量","信义污水厂升级出水COD","信义污水厂升级出水PH","信义污水厂升级出水SS","信义污水厂升级出水TN","信义污水厂升级出水TP","信义污水厂升级出水氨氮","信义污水厂AIT202_Value","信义污水厂AIT203_Value","信义污水厂AIT207_Value","信义污水厂AIT206_Value","信义污水厂AIT209_Value","信义污水厂AIT210_Value","信义污水厂进水TDS","信义污水厂FT101_Value","信义污水厂SWCHHYHLB1_R_Value","信义污水厂SWCHHYHLB2_R_Value","信义污水厂SWCHHYHLB3_R_Value","信义污水厂SWCHHYHLB4_R_Value","信义污水厂SWCHHYHLB5_R_Value","信义污水厂SWCHHYHLB6_R_Value","信义污水厂SWCWNHLB1_R_Value","信义污水厂SWCWNHLB2_R_Value","信义污水厂SWCWNHLB3_R_Value","信义污水厂SWCWNHLB4_R_Value","信义污水厂SWCWNHLB5_R_Value","信义污水厂GFJ1_R_Value","信义污水厂GFJ2_R_Value","信义污水厂GFJ3_R_Value","信义污水厂GFJ4_R_Value","信义污水厂GFJ5_R_Value","信义污水厂GFJ6_R_Value","信义污水厂GFJ1_KQLL_Value","信义污水厂GFJ2_KQLL_Value","信义污水厂GFJ3_KQLL_Value","信义污水厂GFJ4_KQLL_Value","信义污水厂GFJ5_KQLL_Value","信义污水厂GFJ6_KQLL_Value","信义污水厂实际碳源加药量","信义污水厂除磷加药瞬时流量", "信义污水厂_除磷P04预测值_"};
@@ -334,9 +343,12 @@ public class RyTask
         BigDecimal cscodGkz = normConfig.getCscodGkz();
         if(!Objects.isNull(csCod) && !Objects.isNull(cscodBzz)){
             TXinyiWarningRecord tXinyiWarningRecord = gettXinyiWarningRecordCS(cscodBzz, csCod, cscodGkz, BusinessEnum.WarningCategoryEnum.CS_COD.getCode());
-            //保存到数据库中
-            this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
-            //继续调用决策 todo
+            if(!Objects.isNull(tXinyiWarningRecord)){
+                //保存到数据库中
+                this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
+                //继续调用决策
+                this.handleDecision(tXinyiWarningRecord, tXinyiIndustry, normConfig);
+            }
         }
 
         //出水总磷超标报警
@@ -345,9 +357,12 @@ public class RyTask
         BigDecimal cszlGkz = normConfig.getCszlGkz();
         if(!Objects.isNull(csTp) && !Objects.isNull(cszlBzz)){
             TXinyiWarningRecord tXinyiWarningRecord = gettXinyiWarningRecordCS(cszlBzz, csTp, cszlGkz, BusinessEnum.WarningCategoryEnum.CS_ZL.getCode());
-            //保存到数据库中
-            this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
-            //继续调用决策 todo
+            if(!Objects.isNull(tXinyiWarningRecord)){
+                //保存到数据库中
+                this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
+                //继续调用决策
+                this.handleDecision(tXinyiWarningRecord, tXinyiIndustry, normConfig);
+            }
         }
 
 
@@ -357,9 +372,12 @@ public class RyTask
         BigDecimal cszzGkz = normConfig.getCszzGkz();
         if(!Objects.isNull(csTn) && !Objects.isNull(cszzBzz)){
             TXinyiWarningRecord tXinyiWarningRecord = gettXinyiWarningRecordCS(cszzBzz, csTn, cszzGkz, BusinessEnum.WarningCategoryEnum.CS_ZD.getCode());
-            //保存到数据库中
-            this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
-            //继续调用决策 todo
+            if(!Objects.isNull(tXinyiWarningRecord)){
+                //保存到数据库中
+                this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
+                //继续调用决策
+                this.handleDecision(tXinyiWarningRecord, tXinyiIndustry, normConfig);
+            }
         }
 
         //出水氨氮超标报警
@@ -368,9 +386,12 @@ public class RyTask
         BigDecimal csadGkz = normConfig.getCsadGkz();
         if(!Objects.isNull(csNh3) && !Objects.isNull(csadBzz)){
             TXinyiWarningRecord tXinyiWarningRecord = gettXinyiWarningRecordCS(csadBzz, csNh3, csadGkz, BusinessEnum.WarningCategoryEnum.CS_AD.getCode());
-            //保存到数据库中
-            this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
-            //继续调用决策 todo
+            if(!Objects.isNull(tXinyiWarningRecord)){
+                //保存到数据库中
+                this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
+                //继续调用决策
+                this.handleDecision(tXinyiWarningRecord, tXinyiIndustry, normConfig);
+            }
         }
 
         //出水SS超标报警
@@ -379,9 +400,12 @@ public class RyTask
         BigDecimal csssGkz = normConfig.getCsssGkz();
         if(!Objects.isNull(csSS) && !Objects.isNull(csSSBzz)){
             TXinyiWarningRecord tXinyiWarningRecord = gettXinyiWarningRecordCS(csSSBzz, csSS, csssGkz, BusinessEnum.WarningCategoryEnum.CS_SS.getCode());
-            //保存到数据库中
-            this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
-            //继续调用决策 todo
+            if(!Objects.isNull(tXinyiWarningRecord)){
+                //保存到数据库中
+                this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
+                //继续调用决策
+                this.handleDecision(tXinyiWarningRecord, tXinyiIndustry, normConfig);
+            }
         }
 
         //进水相关报警
@@ -390,9 +414,12 @@ public class RyTask
         BigDecimal jszlSjz = normConfig.getJszlSjz();
         if(!Objects.isNull(jsTp) && !Objects.isNull(jszlSjz)){
             TXinyiWarningRecord tXinyiWarningRecord = gettXinyiWarningRecordJS(jszlSjz, jsTp, BusinessEnum.WarningCategoryEnum.JS_ZL.getCode());
-            //保存到数据库中
-            this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
-            //继续调用决策 todo
+            if(!Objects.isNull(tXinyiWarningRecord)){
+                //保存到数据库中
+                this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
+                //继续调用决策
+                this.handleDecision(tXinyiWarningRecord, tXinyiIndustry, normConfig);
+            }
         }
 
         //进水COD超标报警
@@ -400,9 +427,12 @@ public class RyTask
         BigDecimal jscodSjz = normConfig.getJscodSjz();
         if(!Objects.isNull(jsCod) && !Objects.isNull(jscodSjz)){
             TXinyiWarningRecord tXinyiWarningRecord = gettXinyiWarningRecordJS(jscodSjz, jsCod, BusinessEnum.WarningCategoryEnum.JS_COD.getCode());
-            //保存到数据库中
-            this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
-            //继续调用决策 todo
+            if(!Objects.isNull(tXinyiWarningRecord)){
+                //保存到数据库中
+                this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
+                //继续调用决策
+                this.handleDecision(tXinyiWarningRecord, tXinyiIndustry, normConfig);
+            }
         }
 
         //进水总氮超标报警
@@ -410,9 +440,12 @@ public class RyTask
         BigDecimal jszdSjz = normConfig.getJszdSjz();
         if(!Objects.isNull(jsTn) && !Objects.isNull(jszdSjz)){
             TXinyiWarningRecord tXinyiWarningRecord = gettXinyiWarningRecordJS(jszdSjz, jsTn, BusinessEnum.WarningCategoryEnum.JS_ZD.getCode());
-            //保存到数据库中
-            this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
-            //继续调用决策 todo
+            if(!Objects.isNull(tXinyiWarningRecord)){
+                //保存到数据库中
+                this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
+                //继续调用决策
+                this.handleDecision(tXinyiWarningRecord, tXinyiIndustry, normConfig);
+            }
         }
 
         //进水氨氮超标报警
@@ -420,9 +453,12 @@ public class RyTask
         BigDecimal jsadSjz = normConfig.getJsadSjz();
         if(!Objects.isNull(jsNh3) && !Objects.isNull(jsadSjz)){
             TXinyiWarningRecord tXinyiWarningRecord = gettXinyiWarningRecordJS(jsadSjz, jsNh3, BusinessEnum.WarningCategoryEnum.JS_AD.getCode());
-            //保存到数据库中
-            this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
-            //继续调用决策 todo
+            if(!Objects.isNull(tXinyiWarningRecord)){
+                //保存到数据库中
+                this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
+                //继续调用决策
+                this.handleDecision(tXinyiWarningRecord, tXinyiIndustry, normConfig);
+            }
         }
 
         //进水SS超标报警
@@ -430,13 +466,182 @@ public class RyTask
         BigDecimal jsSSSjz = normConfig.getJsssSjz();
         if(!Objects.isNull(jsSS) && !Objects.isNull(jsSSSjz)){
             TXinyiWarningRecord tXinyiWarningRecord = gettXinyiWarningRecordJS(jsSSSjz, jsSS, BusinessEnum.WarningCategoryEnum.JS_SS.getCode());
-            //保存到数据库中
-            this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
-            //继续调用决策 todo
+            if(!Objects.isNull(tXinyiWarningRecord)){
+                //保存到数据库中
+                this.xinyiWarningRecordMapper.insertTXinyiWarningRecord(tXinyiWarningRecord);
+                //继续调用决策
+                this.handleDecision(tXinyiWarningRecord, tXinyiIndustry, normConfig);
+            }
         }
         
     }
 
+    /**
+     * 调用大模型获取决策结果 并同时记录对应信息到聊天记录表中
+     *
+     * @param tXinyiWarningRecord
+     * @param tXinyiIndustry
+     * @param normConfig
+     */
+    private void handleDecision(TXinyiWarningRecord tXinyiWarningRecord, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
+        log.info("进入了调⽤大模型决策接口");
+        ChatReq chatReq = new ChatReq();
+        StringBuilder sb = new StringBuilder();
+        //决策和问答不一样 没有历史的概念 所以sessionId都是新的  次数都是1
+        String sessionId = IdUtils.simpleUUID();
+        String feedback = chatReq.getFeedback();
+        //决策请求的业务参数
+        List<HashMap<String, Object>> list = this.xinyiIndustryMapper.selectLast10RecordsForDecision();
+        String rows = JSON.toJSONString(list);
+        // 获取输出流
+        ManagedChannel channel = null;
+        String dataJson = "";
+        try {
+            channel = ManagedChannelBuilder.forAddress("10.0.0.24", 17070)
+                    .usePlaintext()
+                    .build();
+            InferenceAPIsServiceGrpc.InferenceAPIsServiceBlockingStub stub = InferenceAPIsServiceGrpc.newBlockingStub(channel);
+            dataJson = "{\"bot_id\":\"b00001\",\"exp_id\":\"721\",\"norm\":\"" + tXinyiWarningRecord.getCategory() + "\",\"feedback\":" + feedback + ",\"session_id\":" + sessionId + ",\"generate_args\":{\"max_new_tokens\":1024,\"max_length\":4096,\"num_beams\":1,\"do_sample\":true,\"top_p\":0.7,\"temperature\":0.95},\"extra\":{\"rows\":" +  rows + "}}";
+            System.out.println(dataJson);
+            PredictionsRequest request = PredictionsRequest.newBuilder()
+                    .setModelName("slibra_bot")
+                    .putInput("method", ByteString.copyFrom("decision_stream", "utf-8"))//推理
+                    .putInput("data", ByteString.copyFrom(dataJson, "utf-8"))
+                    .buildPartial();
+            Iterator<PredictionResponse> predictions = stub.streamPredictions(request);
+            while (predictions.hasNext()) {
+                String responseStr = predictions.next().getPrediction().toStringUtf8();
+                System.out.println(responseStr);
+                responseStr = JSON.parseObject(responseStr).getString("message");
+                if("complete".equals(responseStr)){
+                    System.out.println("结尾语句并且是非JSON,无需处理");
+                }else{
+                    sb.append(responseStr);
+                }
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        } finally {
+            System.out.println(sb.toString());
+            //保存聊天记录
+            //将问答更新到数据库中
+            chatReq.setSessionId(sessionId);
+            chatReq.setType(0);//0问答 1决策
+            chatReq.setModule(3);
+            String userId = SecurityUtils.getUserId().toString();
+            String username = SecurityUtils.getUsername();
+            chatReq.setUserId(userId);
+            String showVal = this.buildShowValue(tXinyiWarningRecord, tXinyiIndustry, normConfig);
+            chatReq.setShowVal(showVal);//前端展示的数据和提问的数据不一致
+            chatReq.setQuestion(dataJson);
+            chatReq.setAnswer(sb.toString());
+            chatReq.setWarningId(String.valueOf(tXinyiWarningRecord.getId()));
+            chatReq.setCounts(1);//问答次数
+
+            chatReq.setCreateBy(username);
+            chatReq.setCreateTime(DateUtils.getNowDate());
+            this.xinyiChatRecordMapper.insertTXinyiChatRecord(chatReq);
+            // 关闭输出流
+            if(!Objects.isNull(channel))
+                channel.shutdown();
+        }
+    }
+
+    private String buildShowValue(TXinyiWarningRecord tXinyiWarningRecord, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
+        JSONObject result = new JSONObject();
+        JSONObject basic = new JSONObject();
+        Long status = tXinyiWarningRecord.getStatus();
+        Date warningTime = tXinyiWarningRecord.getTime();
+        int count = DateUtils.differentHoursByMillisecond(warningTime, DateUtils.getNowDate()) + 1;
+        basic.put(tXinyiWarningRecord.getReason(), tXinyiWarningRecord.getReason());
+        basic.put("报警时间", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM ,warningTime));
+        basic.put("报警值", tXinyiWarningRecord.getWarningVal());
+        basic.put("标准值", tXinyiWarningRecord.getDesignVal());
+        basic.put("管控值", tXinyiWarningRecord.getControlVal());
+        basic.put("报警次数", Math.min(count, maxCount));
+        if(tXinyiWarningRecord.getType() != 2)
+            basic.put("状态", status == 0 ? "告警中" : status == 1 ? "用户关闭" : status == 2 ? "系统自动关闭" : "用户转为应急处理中");
+        else
+            basic.put("状态", status == 0 ? "预警中" : "已完成");
+        result.put("basic", basic);
+        JSONObject jsData = getJsonObject(tXinyiIndustry, normConfig);//进水数据
+        result.put("jsData", jsData);
+        JSONObject csData = getCsonObject(tXinyiIndustry, normConfig);//出水数据
+        result.put("csData", csData);
+        return JSON.toJSONString(result);
+    }
+
+    private static JSONObject getJsonObject(TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
+        JSONObject jsData = new JSONObject();
+        HashMap<Object, Object> temp1 = new HashMap<>();
+        BigDecimal jsSlq = tXinyiIndustry.getJsSlq();
+        temp1.put("value", jsSlq);
+        temp1.put("exceed", jsSlq.compareTo(normConfig.getJsslSjz()) >0);
+        jsData.put("流量", temp1);
+        HashMap<Object, Object> temp2 = new HashMap<>();
+        BigDecimal jsCod = tXinyiIndustry.getJsCod();
+        temp2.put("value", jsCod);
+        temp2.put("exceed", jsCod.compareTo(normConfig.getJscodSjz()) > 0);
+        jsData.put("COD", temp2);
+        HashMap<Object, Object> temp3 = new HashMap<>();
+        BigDecimal jsNh3 = tXinyiIndustry.getJsNh3();
+        temp3.put("value", jsNh3);
+        temp3.put("exceed", jsNh3.compareTo(normConfig.getJsadSjz()) > 0);
+        jsData.put("NH3-N", temp3);
+        HashMap<Object, Object> temp4 = new HashMap<>();
+        BigDecimal jsTp = tXinyiIndustry.getJsTp();
+        temp4.put("value", jsTp);
+        temp4.put("exceed", jsTp.compareTo(normConfig.getJszlSjz()) > 0);
+        jsData.put("TP", temp4);
+        HashMap<Object, Object> temp5 = new HashMap<>();
+        BigDecimal jsSs = tXinyiIndustry.getJsSs();
+        temp5.put("value", jsSs);
+        temp5.put("exceed", jsSs.compareTo(normConfig.getJsssSjz()) > 0);
+        jsData.put("SS", temp5);
+        HashMap<Object, Object> temp6 = new HashMap<>();
+        BigDecimal jsTn = tXinyiIndustry.getJsTn();
+        temp6.put("value", jsTn);
+        temp6.put("exceed", jsTn.compareTo(normConfig.getJszdSjz()) > 0);
+        jsData.put("TN", temp6);
+        return jsData;
+    }
+
+
+    private static JSONObject getCsonObject(TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
+        JSONObject csData = new JSONObject();
+        HashMap<Object, Object> temp1 = new HashMap<>();
+        BigDecimal csSlq = tXinyiIndustry.getCsSlqc();
+        temp1.put("value", csSlq);
+        temp1.put("exceed", false);//出水水量没有管控值
+        csData.put("流量", temp1);
+        HashMap<Object, Object> temp2 = new HashMap<>();
+        BigDecimal csCod = tXinyiIndustry.getCsCod();
+        temp2.put("value", csCod);
+        temp2.put("exceed", csCod.compareTo(normConfig.getCscodGkz()) > 0);
+        csData.put("COD", temp2);
+        HashMap<Object, Object> temp3 = new HashMap<>();
+        BigDecimal csNh3 = tXinyiIndustry.getCsNh3();
+        temp3.put("value", csNh3);
+        temp3.put("exceed", csNh3.compareTo(normConfig.getCsadGkz()) > 0);
+        csData.put("NH3-N", temp3);
+        HashMap<Object, Object> temp4 = new HashMap<>();
+        BigDecimal csTp = tXinyiIndustry.getCsTp();
+        temp4.put("value", csTp);
+        temp4.put("exceed", csTp.compareTo(normConfig.getCszlGkz()) > 0);
+        csData.put("TP", temp4);
+        HashMap<Object, Object> temp5 = new HashMap<>();
+        BigDecimal csSs = tXinyiIndustry.getCsSs();
+        temp5.put("value", csSs);
+        temp5.put("exceed", csSs.compareTo(normConfig.getCsssGkz()) > 0);
+        csData.put("SS", temp5);
+        HashMap<Object, Object> temp6 = new HashMap<>();
+        BigDecimal csTn = tXinyiIndustry.getCsTn();
+        temp6.put("value", csTn);
+        temp6.put("exceed", csTn.compareTo(normConfig.getCszzGkz()) > 0);
+        csData.put("TN", temp6);
+        return csData;
+    }
+
     /**
      * 通过输入的值 生成对应类型的报警对象(出水)
      * @param csBzz
@@ -467,6 +672,8 @@ public class RyTask
         }else if(!Objects.isNull(csGkz) && currentVal.compareTo(csGkz) > 0){
             tXinyiWarningRecord.setReason(category + CHAOGUANKONG_WARNING);
             tXinyiWarningRecord.setLevel(WARNING_LEVEL_THREE);
+        }else{
+            tXinyiWarningRecord = null;//这种的无需处理
         }
         return tXinyiWarningRecord;
     }
@@ -498,6 +705,8 @@ public class RyTask
         }else if(currentVal.compareTo(jsBzz) >= 0 && currentVal.compareTo(multiply) <= 0){//二级
             tXinyiWarningRecord.setReason(category + CHAOBIAO_WARNING);
             tXinyiWarningRecord.setLevel(WARNING_LEVEL_TWO);
+        }else{
+            tXinyiWarningRecord = null;//这种的无需处理
         }
         /*else if(!Objects.isNull(csGkz) && currentVal.compareTo(csGkz) > 0){
             tXinyiWarningRecord.setReason(category + CHAOGUANKONG_WARNING);
@@ -605,7 +814,9 @@ public class RyTask
         objects.clear();
         System.out.println(objects);
 
-        test();
+//        test();
+        Date date = new Date();
+        System.out.println(DateUtils.differentHoursByMillisecond(date, date));
 
     }
 

+ 115 - 0
slibra-quartz/src/main/java/inference/Inference.java

@@ -0,0 +1,115 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: inference.proto
+
+package inference;
+
+public final class Inference {
+  private Inference() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistryLite registry) {
+  }
+
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+    registerAllExtensions(
+        (com.google.protobuf.ExtensionRegistryLite) registry);
+  }
+  static final com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_descriptor;
+  static final 
+    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+      internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_fieldAccessorTable;
+  static final com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_InputEntry_descriptor;
+  static final 
+    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+      internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_InputEntry_fieldAccessorTable;
+  static final com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_pytorch_serve_grpc_inference_PredictionResponse_descriptor;
+  static final 
+    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+      internal_static_org_pytorch_serve_grpc_inference_PredictionResponse_fieldAccessorTable;
+  static final com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_pytorch_serve_grpc_inference_TorchServeHealthResponse_descriptor;
+  static final 
+    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+      internal_static_org_pytorch_serve_grpc_inference_TorchServeHealthResponse_fieldAccessorTable;
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static  com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    String[] descriptorData = {
+      "\n\017inference.proto\022 org.pytorch.serve.grp" +
+      "c.inference\032\033google/protobuf/empty.proto" +
+      "\032\027google/rpc/status.proto\"\322\001\n\022Prediction" +
+      "sRequest\022\022\n\nmodel_name\030\001 \001(\t\022\025\n\rmodel_ve" +
+      "rsion\030\002 \001(\t\022N\n\005input\030\003 \003(\0132?.org.pytorch" +
+      ".serve.grpc.inference.PredictionsRequest" +
+      ".InputEntry\022\023\n\013sequence_id\030\004 \001(\t\032,\n\nInpu" +
+      "tEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\014:\0028\001\"a" +
+      "\n\022PredictionResponse\022\022\n\nprediction\030\001 \001(\014" +
+      "\022\023\n\013sequence_id\030\002 \001(\t\022\"\n\006status\030\003 \001(\0132\022." +
+      "google.rpc.Status\"*\n\030TorchServeHealthRes" +
+      "ponse\022\016\n\006health\030\001 \001(\t2\200\004\n\024InferenceAPIsS" +
+      "ervice\022\\\n\004Ping\022\026.google.protobuf.Empty\032:" +
+      ".org.pytorch.serve.grpc.inference.TorchS" +
+      "erveHealthResponse\"\000\022{\n\013Predictions\0224.or" +
+      "g.pytorch.serve.grpc.inference.Predictio" +
+      "nsRequest\0324.org.pytorch.serve.grpc.infer" +
+      "ence.PredictionResponse\"\000\022\203\001\n\021StreamPred" +
+      "ictions\0224.org.pytorch.serve.grpc.inferen" +
+      "ce.PredictionsRequest\0324.org.pytorch.serv" +
+      "e.grpc.inference.PredictionResponse\"\0000\001\022" +
+      "\206\001\n\022StreamPredictions2\0224.org.pytorch.ser" +
+      "ve.grpc.inference.PredictionsRequest\0324.o" +
+      "rg.pytorch.serve.grpc.inference.Predicti" +
+      "onResponse\"\000(\0010\001B\002P\001b\006proto3"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+        new com.google.protobuf.Descriptors.FileDescriptor.    InternalDescriptorAssigner() {
+          public com.google.protobuf.ExtensionRegistry assignDescriptors(
+              com.google.protobuf.Descriptors.FileDescriptor root) {
+            descriptor = root;
+            return null;
+          }
+        };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+          com.google.protobuf.EmptyProto.getDescriptor(),
+          com.google.rpc.StatusProto.getDescriptor(),
+        }, assigner);
+    internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_descriptor =
+      getDescriptor().getMessageTypes().get(0);
+    internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+        internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_descriptor,
+        new String[] { "ModelName", "ModelVersion", "Input", "SequenceId", });
+    internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_InputEntry_descriptor =
+      internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_descriptor.getNestedTypes().get(0);
+    internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_InputEntry_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+        internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_InputEntry_descriptor,
+        new String[] { "Key", "Value", });
+    internal_static_org_pytorch_serve_grpc_inference_PredictionResponse_descriptor =
+      getDescriptor().getMessageTypes().get(1);
+    internal_static_org_pytorch_serve_grpc_inference_PredictionResponse_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+        internal_static_org_pytorch_serve_grpc_inference_PredictionResponse_descriptor,
+        new String[] { "Prediction", "SequenceId", "Status", });
+    internal_static_org_pytorch_serve_grpc_inference_TorchServeHealthResponse_descriptor =
+      getDescriptor().getMessageTypes().get(2);
+    internal_static_org_pytorch_serve_grpc_inference_TorchServeHealthResponse_fieldAccessorTable = new
+      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+        internal_static_org_pytorch_serve_grpc_inference_TorchServeHealthResponse_descriptor,
+        new String[] { "Health", });
+    com.google.protobuf.EmptyProto.getDescriptor();
+    com.google.rpc.StatusProto.getDescriptor();
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}

+ 514 - 0
slibra-quartz/src/main/java/inference/InferenceAPIsServiceGrpc.java

@@ -0,0 +1,514 @@
+package inference;
+
+import static io.grpc.MethodDescriptor.generateFullMethodName;
+
+/**
+ */
+@javax.annotation.Generated(
+    value = "by gRPC proto compiler (version 1.45.1)",
+    comments = "Source: inference.proto")
+@io.grpc.stub.annotations.GrpcGenerated
+public final class InferenceAPIsServiceGrpc {
+
+  private InferenceAPIsServiceGrpc() {}
+
+  public static final String SERVICE_NAME = "org.pytorch.serve.grpc.inference.InferenceAPIsService";
+
+  // Static method descriptors that strictly reflect the proto.
+  private static volatile io.grpc.MethodDescriptor<com.google.protobuf.Empty,
+      TorchServeHealthResponse> getPingMethod;
+
+  @io.grpc.stub.annotations.RpcMethod(
+      fullMethodName = SERVICE_NAME + '/' + "Ping",
+      requestType = com.google.protobuf.Empty.class,
+      responseType = TorchServeHealthResponse.class,
+      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+  public static io.grpc.MethodDescriptor<com.google.protobuf.Empty,
+      TorchServeHealthResponse> getPingMethod() {
+    io.grpc.MethodDescriptor<com.google.protobuf.Empty, TorchServeHealthResponse> getPingMethod;
+    if ((getPingMethod = InferenceAPIsServiceGrpc.getPingMethod) == null) {
+      synchronized (InferenceAPIsServiceGrpc.class) {
+        if ((getPingMethod = InferenceAPIsServiceGrpc.getPingMethod) == null) {
+          InferenceAPIsServiceGrpc.getPingMethod = getPingMethod =
+              io.grpc.MethodDescriptor.<com.google.protobuf.Empty, TorchServeHealthResponse>newBuilder()
+              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Ping"))
+              .setSampledToLocalTracing(true)
+              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+                  com.google.protobuf.Empty.getDefaultInstance()))
+              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+                  TorchServeHealthResponse.getDefaultInstance()))
+              .setSchemaDescriptor(new InferenceAPIsServiceMethodDescriptorSupplier("Ping"))
+              .build();
+        }
+      }
+    }
+    return getPingMethod;
+  }
+
+  private static volatile io.grpc.MethodDescriptor<PredictionsRequest,
+      PredictionResponse> getPredictionsMethod;
+
+  @io.grpc.stub.annotations.RpcMethod(
+      fullMethodName = SERVICE_NAME + '/' + "Predictions",
+      requestType = PredictionsRequest.class,
+      responseType = PredictionResponse.class,
+      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+  public static io.grpc.MethodDescriptor<PredictionsRequest,
+      PredictionResponse> getPredictionsMethod() {
+    io.grpc.MethodDescriptor<PredictionsRequest, PredictionResponse> getPredictionsMethod;
+    if ((getPredictionsMethod = InferenceAPIsServiceGrpc.getPredictionsMethod) == null) {
+      synchronized (InferenceAPIsServiceGrpc.class) {
+        if ((getPredictionsMethod = InferenceAPIsServiceGrpc.getPredictionsMethod) == null) {
+          InferenceAPIsServiceGrpc.getPredictionsMethod = getPredictionsMethod =
+              io.grpc.MethodDescriptor.<PredictionsRequest, PredictionResponse>newBuilder()
+              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Predictions"))
+              .setSampledToLocalTracing(true)
+              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+                  PredictionsRequest.getDefaultInstance()))
+              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+                  PredictionResponse.getDefaultInstance()))
+              .setSchemaDescriptor(new InferenceAPIsServiceMethodDescriptorSupplier("Predictions"))
+              .build();
+        }
+      }
+    }
+    return getPredictionsMethod;
+  }
+
+  private static volatile io.grpc.MethodDescriptor<PredictionsRequest,
+      PredictionResponse> getStreamPredictionsMethod;
+
+  @io.grpc.stub.annotations.RpcMethod(
+      fullMethodName = SERVICE_NAME + '/' + "StreamPredictions",
+      requestType = PredictionsRequest.class,
+      responseType = PredictionResponse.class,
+      methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
+  public static io.grpc.MethodDescriptor<PredictionsRequest,
+      PredictionResponse> getStreamPredictionsMethod() {
+    io.grpc.MethodDescriptor<PredictionsRequest, PredictionResponse> getStreamPredictionsMethod;
+    if ((getStreamPredictionsMethod = InferenceAPIsServiceGrpc.getStreamPredictionsMethod) == null) {
+      synchronized (InferenceAPIsServiceGrpc.class) {
+        if ((getStreamPredictionsMethod = InferenceAPIsServiceGrpc.getStreamPredictionsMethod) == null) {
+          InferenceAPIsServiceGrpc.getStreamPredictionsMethod = getStreamPredictionsMethod =
+              io.grpc.MethodDescriptor.<PredictionsRequest, PredictionResponse>newBuilder()
+              .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
+              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamPredictions"))
+              .setSampledToLocalTracing(true)
+              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+                  PredictionsRequest.getDefaultInstance()))
+              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+                  PredictionResponse.getDefaultInstance()))
+              .setSchemaDescriptor(new InferenceAPIsServiceMethodDescriptorSupplier("StreamPredictions"))
+              .build();
+        }
+      }
+    }
+    return getStreamPredictionsMethod;
+  }
+
+  private static volatile io.grpc.MethodDescriptor<PredictionsRequest,
+      PredictionResponse> getStreamPredictions2Method;
+
+  @io.grpc.stub.annotations.RpcMethod(
+      fullMethodName = SERVICE_NAME + '/' + "StreamPredictions2",
+      requestType = PredictionsRequest.class,
+      responseType = PredictionResponse.class,
+      methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+  public static io.grpc.MethodDescriptor<PredictionsRequest,
+      PredictionResponse> getStreamPredictions2Method() {
+    io.grpc.MethodDescriptor<PredictionsRequest, PredictionResponse> getStreamPredictions2Method;
+    if ((getStreamPredictions2Method = InferenceAPIsServiceGrpc.getStreamPredictions2Method) == null) {
+      synchronized (InferenceAPIsServiceGrpc.class) {
+        if ((getStreamPredictions2Method = InferenceAPIsServiceGrpc.getStreamPredictions2Method) == null) {
+          InferenceAPIsServiceGrpc.getStreamPredictions2Method = getStreamPredictions2Method =
+              io.grpc.MethodDescriptor.<PredictionsRequest, PredictionResponse>newBuilder()
+              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamPredictions2"))
+              .setSampledToLocalTracing(true)
+              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+                  PredictionsRequest.getDefaultInstance()))
+              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+                  PredictionResponse.getDefaultInstance()))
+              .setSchemaDescriptor(new InferenceAPIsServiceMethodDescriptorSupplier("StreamPredictions2"))
+              .build();
+        }
+      }
+    }
+    return getStreamPredictions2Method;
+  }
+
+  /**
+   * Creates a new async stub that supports all call types for the service
+   */
+  public static InferenceAPIsServiceStub newStub(io.grpc.Channel channel) {
+    io.grpc.stub.AbstractStub.StubFactory<InferenceAPIsServiceStub> factory =
+      new io.grpc.stub.AbstractStub.StubFactory<InferenceAPIsServiceStub>() {
+        @Override
+        public InferenceAPIsServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+          return new InferenceAPIsServiceStub(channel, callOptions);
+        }
+      };
+    return InferenceAPIsServiceStub.newStub(factory, channel);
+  }
+
+  /**
+   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
+   */
+  public static InferenceAPIsServiceBlockingStub newBlockingStub(
+      io.grpc.Channel channel) {
+    io.grpc.stub.AbstractStub.StubFactory<InferenceAPIsServiceBlockingStub> factory =
+      new io.grpc.stub.AbstractStub.StubFactory<InferenceAPIsServiceBlockingStub>() {
+        @Override
+        public InferenceAPIsServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+          return new InferenceAPIsServiceBlockingStub(channel, callOptions);
+        }
+      };
+    return InferenceAPIsServiceBlockingStub.newStub(factory, channel);
+  }
+
+  /**
+   * Creates a new ListenableFuture-style stub that supports unary calls on the service
+   */
+  public static InferenceAPIsServiceFutureStub newFutureStub(
+      io.grpc.Channel channel) {
+    io.grpc.stub.AbstractStub.StubFactory<InferenceAPIsServiceFutureStub> factory =
+      new io.grpc.stub.AbstractStub.StubFactory<InferenceAPIsServiceFutureStub>() {
+        @Override
+        public InferenceAPIsServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+          return new InferenceAPIsServiceFutureStub(channel, callOptions);
+        }
+      };
+    return InferenceAPIsServiceFutureStub.newStub(factory, channel);
+  }
+
+  /**
+   */
+  public static abstract class InferenceAPIsServiceImplBase implements io.grpc.BindableService {
+
+    /**
+     * <pre>
+     * Check health status of the TorchServe server.
+     * </pre>
+     */
+    public void ping(com.google.protobuf.Empty request,
+        io.grpc.stub.StreamObserver<TorchServeHealthResponse> responseObserver) {
+      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getPingMethod(), responseObserver);
+    }
+
+    /**
+     * <pre>
+     * Predictions entry point to get inference using default model version.
+     * </pre>
+     */
+    public void predictions(PredictionsRequest request,
+                            io.grpc.stub.StreamObserver<PredictionResponse> responseObserver) {
+      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getPredictionsMethod(), responseObserver);
+    }
+
+    /**
+     * <pre>
+     * Streaming response for an inference request.
+     * </pre>
+     */
+    public void streamPredictions(PredictionsRequest request,
+                                  io.grpc.stub.StreamObserver<PredictionResponse> responseObserver) {
+      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getStreamPredictionsMethod(), responseObserver);
+    }
+
+    /**
+     * <pre>
+     * Bi-direction streaming inference and response.
+     * </pre>
+     */
+    public io.grpc.stub.StreamObserver<PredictionsRequest> streamPredictions2(
+        io.grpc.stub.StreamObserver<PredictionResponse> responseObserver) {
+      return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getStreamPredictions2Method(), responseObserver);
+    }
+
+    @Override public final io.grpc.ServerServiceDefinition bindService() {
+      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
+          .addMethod(
+            getPingMethod(),
+            io.grpc.stub.ServerCalls.asyncUnaryCall(
+              new MethodHandlers<
+                com.google.protobuf.Empty,
+                TorchServeHealthResponse>(
+                  this, METHODID_PING)))
+          .addMethod(
+            getPredictionsMethod(),
+            io.grpc.stub.ServerCalls.asyncUnaryCall(
+              new MethodHandlers<
+                PredictionsRequest,
+                PredictionResponse>(
+                  this, METHODID_PREDICTIONS)))
+          .addMethod(
+            getStreamPredictionsMethod(),
+            io.grpc.stub.ServerCalls.asyncServerStreamingCall(
+              new MethodHandlers<
+                PredictionsRequest,
+                PredictionResponse>(
+                  this, METHODID_STREAM_PREDICTIONS)))
+          .addMethod(
+            getStreamPredictions2Method(),
+            io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
+              new MethodHandlers<
+                PredictionsRequest,
+                PredictionResponse>(
+                  this, METHODID_STREAM_PREDICTIONS2)))
+          .build();
+    }
+  }
+
+  /**
+   */
+  public static final class InferenceAPIsServiceStub extends io.grpc.stub.AbstractAsyncStub<InferenceAPIsServiceStub> {
+    private InferenceAPIsServiceStub(
+        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+      super(channel, callOptions);
+    }
+
+    @Override
+    protected InferenceAPIsServiceStub build(
+        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+      return new InferenceAPIsServiceStub(channel, callOptions);
+    }
+
+    /**
+     * <pre>
+     * Check health status of the TorchServe server.
+     * </pre>
+     */
+    public void ping(com.google.protobuf.Empty request,
+        io.grpc.stub.StreamObserver<TorchServeHealthResponse> responseObserver) {
+      io.grpc.stub.ClientCalls.asyncUnaryCall(
+          getChannel().newCall(getPingMethod(), getCallOptions()), request, responseObserver);
+    }
+
+    /**
+     * <pre>
+     * Predictions entry point to get inference using default model version.
+     * </pre>
+     */
+    public void predictions(PredictionsRequest request,
+                            io.grpc.stub.StreamObserver<PredictionResponse> responseObserver) {
+      io.grpc.stub.ClientCalls.asyncUnaryCall(
+          getChannel().newCall(getPredictionsMethod(), getCallOptions()), request, responseObserver);
+    }
+
+    /**
+     * <pre>
+     * Streaming response for an inference request.
+     * </pre>
+     */
+    public void streamPredictions(PredictionsRequest request,
+                                  io.grpc.stub.StreamObserver<PredictionResponse> responseObserver) {
+      io.grpc.stub.ClientCalls.asyncServerStreamingCall(
+          getChannel().newCall(getStreamPredictionsMethod(), getCallOptions()), request, responseObserver);
+    }
+
+    /**
+     * <pre>
+     * Bi-direction streaming inference and response.
+     * </pre>
+     */
+    public io.grpc.stub.StreamObserver<PredictionsRequest> streamPredictions2(
+        io.grpc.stub.StreamObserver<PredictionResponse> responseObserver) {
+      return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
+          getChannel().newCall(getStreamPredictions2Method(), getCallOptions()), responseObserver);
+    }
+  }
+
+  /**
+   */
+  public static final class InferenceAPIsServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<InferenceAPIsServiceBlockingStub> {
+    private InferenceAPIsServiceBlockingStub(
+        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+      super(channel, callOptions);
+    }
+
+    @Override
+    protected InferenceAPIsServiceBlockingStub build(
+        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+      return new InferenceAPIsServiceBlockingStub(channel, callOptions);
+    }
+
+    /**
+     * <pre>
+     * Check health status of the TorchServe server.
+     * </pre>
+     */
+    public TorchServeHealthResponse ping(com.google.protobuf.Empty request) {
+      return io.grpc.stub.ClientCalls.blockingUnaryCall(
+          getChannel(), getPingMethod(), getCallOptions(), request);
+    }
+
+    /**
+     * <pre>
+     * Predictions entry point to get inference using default model version.
+     * </pre>
+     */
+    public PredictionResponse predictions(PredictionsRequest request) {
+      return io.grpc.stub.ClientCalls.blockingUnaryCall(
+          getChannel(), getPredictionsMethod(), getCallOptions(), request);
+    }
+
+    /**
+     * <pre>
+     * Streaming response for an inference request.
+     * </pre>
+     */
+    public java.util.Iterator<PredictionResponse> streamPredictions(
+        PredictionsRequest request) {
+      return io.grpc.stub.ClientCalls.blockingServerStreamingCall(
+          getChannel(), getStreamPredictionsMethod(), getCallOptions(), request);
+    }
+  }
+
+  /**
+   */
+  public static final class InferenceAPIsServiceFutureStub extends io.grpc.stub.AbstractFutureStub<InferenceAPIsServiceFutureStub> {
+    private InferenceAPIsServiceFutureStub(
+        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+      super(channel, callOptions);
+    }
+
+    @Override
+    protected InferenceAPIsServiceFutureStub build(
+        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+      return new InferenceAPIsServiceFutureStub(channel, callOptions);
+    }
+
+    /**
+     * <pre>
+     * Check health status of the TorchServe server.
+     * </pre>
+     */
+    public com.google.common.util.concurrent.ListenableFuture<TorchServeHealthResponse> ping(
+        com.google.protobuf.Empty request) {
+      return io.grpc.stub.ClientCalls.futureUnaryCall(
+          getChannel().newCall(getPingMethod(), getCallOptions()), request);
+    }
+
+    /**
+     * <pre>
+     * Predictions entry point to get inference using default model version.
+     * </pre>
+     */
+    public com.google.common.util.concurrent.ListenableFuture<PredictionResponse> predictions(
+        PredictionsRequest request) {
+      return io.grpc.stub.ClientCalls.futureUnaryCall(
+          getChannel().newCall(getPredictionsMethod(), getCallOptions()), request);
+    }
+  }
+
+  private static final int METHODID_PING = 0;
+  private static final int METHODID_PREDICTIONS = 1;
+  private static final int METHODID_STREAM_PREDICTIONS = 2;
+  private static final int METHODID_STREAM_PREDICTIONS2 = 3;
+
+  private static final class MethodHandlers<Req, Resp> implements
+      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
+      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
+      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
+      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
+    private final InferenceAPIsServiceImplBase serviceImpl;
+    private final int methodId;
+
+    MethodHandlers(InferenceAPIsServiceImplBase serviceImpl, int methodId) {
+      this.serviceImpl = serviceImpl;
+      this.methodId = methodId;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
+      switch (methodId) {
+        case METHODID_PING:
+          serviceImpl.ping((com.google.protobuf.Empty) request,
+              (io.grpc.stub.StreamObserver<TorchServeHealthResponse>) responseObserver);
+          break;
+        case METHODID_PREDICTIONS:
+          serviceImpl.predictions((PredictionsRequest) request,
+              (io.grpc.stub.StreamObserver<PredictionResponse>) responseObserver);
+          break;
+        case METHODID_STREAM_PREDICTIONS:
+          serviceImpl.streamPredictions((PredictionsRequest) request,
+              (io.grpc.stub.StreamObserver<PredictionResponse>) responseObserver);
+          break;
+        default:
+          throw new AssertionError();
+      }
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public io.grpc.stub.StreamObserver<Req> invoke(
+        io.grpc.stub.StreamObserver<Resp> responseObserver) {
+      switch (methodId) {
+        case METHODID_STREAM_PREDICTIONS2:
+          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamPredictions2(
+              (io.grpc.stub.StreamObserver<PredictionResponse>) responseObserver);
+        default:
+          throw new AssertionError();
+      }
+    }
+  }
+
+  private static abstract class InferenceAPIsServiceBaseDescriptorSupplier
+      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
+    InferenceAPIsServiceBaseDescriptorSupplier() {}
+
+    @Override
+    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
+      return Inference.getDescriptor();
+    }
+
+    @Override
+    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
+      return getFileDescriptor().findServiceByName("InferenceAPIsService");
+    }
+  }
+
+  private static final class InferenceAPIsServiceFileDescriptorSupplier
+      extends InferenceAPIsServiceBaseDescriptorSupplier {
+    InferenceAPIsServiceFileDescriptorSupplier() {}
+  }
+
+  private static final class InferenceAPIsServiceMethodDescriptorSupplier
+      extends InferenceAPIsServiceBaseDescriptorSupplier
+      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
+    private final String methodName;
+
+    InferenceAPIsServiceMethodDescriptorSupplier(String methodName) {
+      this.methodName = methodName;
+    }
+
+    @Override
+    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
+      return getServiceDescriptor().findMethodByName(methodName);
+    }
+  }
+
+  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
+
+  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
+    io.grpc.ServiceDescriptor result = serviceDescriptor;
+    if (result == null) {
+      synchronized (InferenceAPIsServiceGrpc.class) {
+        result = serviceDescriptor;
+        if (result == null) {
+          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
+              .setSchemaDescriptor(new InferenceAPIsServiceFileDescriptorSupplier())
+              .addMethod(getPingMethod())
+              .addMethod(getPredictionsMethod())
+              .addMethod(getStreamPredictionsMethod())
+              .addMethod(getStreamPredictions2Method())
+              .build();
+        }
+      }
+    }
+    return result;
+  }
+}

+ 850 - 0
slibra-quartz/src/main/java/inference/PredictionResponse.java

@@ -0,0 +1,850 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: inference.proto
+
+package inference;
+
+/**
+ * Protobuf type {@code org.pytorch.serve.grpc.inference.PredictionResponse}
+ */
+public  final class PredictionResponse extends
+    com.google.protobuf.GeneratedMessageV3 implements
+    // @@protoc_insertion_point(message_implements:org.pytorch.serve.grpc.inference.PredictionResponse)
+        PredictionResponseOrBuilder {
+private static final long serialVersionUID = 0L;
+  // Use PredictionResponse.newBuilder() to construct.
+  private PredictionResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
+    super(builder);
+  }
+  private PredictionResponse() {
+    prediction_ = com.google.protobuf.ByteString.EMPTY;
+    sequenceId_ = "";
+  }
+
+  @Override
+  public final com.google.protobuf.UnknownFieldSet
+  getUnknownFields() {
+    return this.unknownFields;
+  }
+  private PredictionResponse(
+      com.google.protobuf.CodedInputStream input,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    this();
+    if (extensionRegistry == null) {
+      throw new NullPointerException();
+    }
+    int mutable_bitField0_ = 0;
+    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+        com.google.protobuf.UnknownFieldSet.newBuilder();
+    try {
+      boolean done = false;
+      while (!done) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            done = true;
+            break;
+          default: {
+            if (!parseUnknownFieldProto3(
+                input, unknownFields, extensionRegistry, tag)) {
+              done = true;
+            }
+            break;
+          }
+          case 10: {
+
+            prediction_ = input.readBytes();
+            break;
+          }
+          case 18: {
+            String s = input.readStringRequireUtf8();
+
+            sequenceId_ = s;
+            break;
+          }
+          case 26: {
+            com.google.rpc.Status.Builder subBuilder = null;
+            if (status_ != null) {
+              subBuilder = status_.toBuilder();
+            }
+            status_ = input.readMessage(com.google.rpc.Status.parser(), extensionRegistry);
+            if (subBuilder != null) {
+              subBuilder.mergeFrom(status_);
+              status_ = subBuilder.buildPartial();
+            }
+
+            break;
+          }
+        }
+      }
+    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+      throw e.setUnfinishedMessage(this);
+    } catch (java.io.IOException e) {
+      throw new com.google.protobuf.InvalidProtocolBufferException(
+          e).setUnfinishedMessage(this);
+    } finally {
+      this.unknownFields = unknownFields.build();
+      makeExtensionsImmutable();
+    }
+  }
+  public static final com.google.protobuf.Descriptors.Descriptor
+      getDescriptor() {
+    return Inference.internal_static_org_pytorch_serve_grpc_inference_PredictionResponse_descriptor;
+  }
+
+  protected FieldAccessorTable
+      internalGetFieldAccessorTable() {
+    return Inference.internal_static_org_pytorch_serve_grpc_inference_PredictionResponse_fieldAccessorTable
+        .ensureFieldAccessorsInitialized(
+            PredictionResponse.class, Builder.class);
+  }
+
+  public static final int PREDICTION_FIELD_NUMBER = 1;
+  private com.google.protobuf.ByteString prediction_;
+  /**
+   * <pre>
+   * Response content for prediction
+   * </pre>
+   *
+   * <code>bytes prediction = 1;</code>
+   */
+  public com.google.protobuf.ByteString getPrediction() {
+    return prediction_;
+  }
+
+  public static final int SEQUENCE_ID_FIELD_NUMBER = 2;
+  private volatile Object sequenceId_;
+  /**
+   * <pre>
+   * SequenceId is required for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>string sequence_id = 2;</code>
+   */
+  public String getSequenceId() {
+    Object ref = sequenceId_;
+    if (ref instanceof String) {
+      return (String) ref;
+    } else {
+      com.google.protobuf.ByteString bs = 
+          (com.google.protobuf.ByteString) ref;
+      String s = bs.toStringUtf8();
+      sequenceId_ = s;
+      return s;
+    }
+  }
+  /**
+   * <pre>
+   * SequenceId is required for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>string sequence_id = 2;</code>
+   */
+  public com.google.protobuf.ByteString
+      getSequenceIdBytes() {
+    Object ref = sequenceId_;
+    if (ref instanceof String) {
+      com.google.protobuf.ByteString b = 
+          com.google.protobuf.ByteString.copyFromUtf8(
+              (String) ref);
+      sequenceId_ = b;
+      return b;
+    } else {
+      return (com.google.protobuf.ByteString) ref;
+    }
+  }
+
+  public static final int STATUS_FIELD_NUMBER = 3;
+  private com.google.rpc.Status status_;
+  /**
+   * <pre>
+   * Error information for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>.google.rpc.Status status = 3;</code>
+   */
+  public boolean hasStatus() {
+    return status_ != null;
+  }
+  /**
+   * <pre>
+   * Error information for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>.google.rpc.Status status = 3;</code>
+   */
+  public com.google.rpc.Status getStatus() {
+    return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_;
+  }
+  /**
+   * <pre>
+   * Error information for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>.google.rpc.Status status = 3;</code>
+   */
+  public com.google.rpc.StatusOrBuilder getStatusOrBuilder() {
+    return getStatus();
+  }
+
+  private byte memoizedIsInitialized = -1;
+  public final boolean isInitialized() {
+    byte isInitialized = memoizedIsInitialized;
+    if (isInitialized == 1) return true;
+    if (isInitialized == 0) return false;
+
+    memoizedIsInitialized = 1;
+    return true;
+  }
+
+  public void writeTo(com.google.protobuf.CodedOutputStream output)
+                      throws java.io.IOException {
+    if (!prediction_.isEmpty()) {
+      output.writeBytes(1, prediction_);
+    }
+    if (!getSequenceIdBytes().isEmpty()) {
+      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, sequenceId_);
+    }
+    if (status_ != null) {
+      output.writeMessage(3, getStatus());
+    }
+    unknownFields.writeTo(output);
+  }
+
+  public int getSerializedSize() {
+    int size = memoizedSize;
+    if (size != -1) return size;
+
+    size = 0;
+    if (!prediction_.isEmpty()) {
+      size += com.google.protobuf.CodedOutputStream
+        .computeBytesSize(1, prediction_);
+    }
+    if (!getSequenceIdBytes().isEmpty()) {
+      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, sequenceId_);
+    }
+    if (status_ != null) {
+      size += com.google.protobuf.CodedOutputStream
+        .computeMessageSize(3, getStatus());
+    }
+    size += unknownFields.getSerializedSize();
+    memoizedSize = size;
+    return size;
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    if (obj == this) {
+     return true;
+    }
+    if (!(obj instanceof PredictionResponse)) {
+      return super.equals(obj);
+    }
+    PredictionResponse other = (PredictionResponse) obj;
+
+    boolean result = true;
+    result = result && getPrediction()
+        .equals(other.getPrediction());
+    result = result && getSequenceId()
+        .equals(other.getSequenceId());
+    result = result && (hasStatus() == other.hasStatus());
+    if (hasStatus()) {
+      result = result && getStatus()
+          .equals(other.getStatus());
+    }
+    result = result && unknownFields.equals(other.unknownFields);
+    return result;
+  }
+
+  @Override
+  public int hashCode() {
+    if (memoizedHashCode != 0) {
+      return memoizedHashCode;
+    }
+    int hash = 41;
+    hash = (19 * hash) + getDescriptor().hashCode();
+    hash = (37 * hash) + PREDICTION_FIELD_NUMBER;
+    hash = (53 * hash) + getPrediction().hashCode();
+    hash = (37 * hash) + SEQUENCE_ID_FIELD_NUMBER;
+    hash = (53 * hash) + getSequenceId().hashCode();
+    if (hasStatus()) {
+      hash = (37 * hash) + STATUS_FIELD_NUMBER;
+      hash = (53 * hash) + getStatus().hashCode();
+    }
+    hash = (29 * hash) + unknownFields.hashCode();
+    memoizedHashCode = hash;
+    return hash;
+  }
+
+  public static PredictionResponse parseFrom(
+      java.nio.ByteBuffer data)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data);
+  }
+  public static PredictionResponse parseFrom(
+      java.nio.ByteBuffer data,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data, extensionRegistry);
+  }
+  public static PredictionResponse parseFrom(
+      com.google.protobuf.ByteString data)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data);
+  }
+  public static PredictionResponse parseFrom(
+      com.google.protobuf.ByteString data,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data, extensionRegistry);
+  }
+  public static PredictionResponse parseFrom(byte[] data)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data);
+  }
+  public static PredictionResponse parseFrom(
+      byte[] data,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data, extensionRegistry);
+  }
+  public static PredictionResponse parseFrom(java.io.InputStream input)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseWithIOException(PARSER, input);
+  }
+  public static PredictionResponse parseFrom(
+      java.io.InputStream input,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseWithIOException(PARSER, input, extensionRegistry);
+  }
+  public static PredictionResponse parseDelimitedFrom(java.io.InputStream input)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseDelimitedWithIOException(PARSER, input);
+  }
+  public static PredictionResponse parseDelimitedFrom(
+      java.io.InputStream input,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+  }
+  public static PredictionResponse parseFrom(
+      com.google.protobuf.CodedInputStream input)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseWithIOException(PARSER, input);
+  }
+  public static PredictionResponse parseFrom(
+      com.google.protobuf.CodedInputStream input,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseWithIOException(PARSER, input, extensionRegistry);
+  }
+
+  public Builder newBuilderForType() { return newBuilder(); }
+  public static Builder newBuilder() {
+    return DEFAULT_INSTANCE.toBuilder();
+  }
+  public static Builder newBuilder(PredictionResponse prototype) {
+    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+  }
+  public Builder toBuilder() {
+    return this == DEFAULT_INSTANCE
+        ? new Builder() : new Builder().mergeFrom(this);
+  }
+
+  @Override
+  protected Builder newBuilderForType(
+      BuilderParent parent) {
+    Builder builder = new Builder(parent);
+    return builder;
+  }
+  /**
+   * Protobuf type {@code org.pytorch.serve.grpc.inference.PredictionResponse}
+   */
+  public static final class Builder extends
+      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
+      // @@protoc_insertion_point(builder_implements:org.pytorch.serve.grpc.inference.PredictionResponse)
+      PredictionResponseOrBuilder {
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return Inference.internal_static_org_pytorch_serve_grpc_inference_PredictionResponse_descriptor;
+    }
+
+    protected FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return Inference.internal_static_org_pytorch_serve_grpc_inference_PredictionResponse_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              PredictionResponse.class, Builder.class);
+    }
+
+    // Construct using org.pytorch.serve.grpc.inference.PredictionResponse.newBuilder()
+    private Builder() {
+      maybeForceBuilderInitialization();
+    }
+
+    private Builder(
+        BuilderParent parent) {
+      super(parent);
+      maybeForceBuilderInitialization();
+    }
+    private void maybeForceBuilderInitialization() {
+      if (com.google.protobuf.GeneratedMessageV3
+              .alwaysUseFieldBuilders) {
+      }
+    }
+    public Builder clear() {
+      super.clear();
+      prediction_ = com.google.protobuf.ByteString.EMPTY;
+
+      sequenceId_ = "";
+
+      if (statusBuilder_ == null) {
+        status_ = null;
+      } else {
+        status_ = null;
+        statusBuilder_ = null;
+      }
+      return this;
+    }
+
+    public com.google.protobuf.Descriptors.Descriptor
+        getDescriptorForType() {
+      return Inference.internal_static_org_pytorch_serve_grpc_inference_PredictionResponse_descriptor;
+    }
+
+    public PredictionResponse getDefaultInstanceForType() {
+      return PredictionResponse.getDefaultInstance();
+    }
+
+    public PredictionResponse build() {
+      PredictionResponse result = buildPartial();
+      if (!result.isInitialized()) {
+        throw newUninitializedMessageException(result);
+      }
+      return result;
+    }
+
+    public PredictionResponse buildPartial() {
+      PredictionResponse result = new PredictionResponse(this);
+      result.prediction_ = prediction_;
+      result.sequenceId_ = sequenceId_;
+      if (statusBuilder_ == null) {
+        result.status_ = status_;
+      } else {
+        result.status_ = statusBuilder_.build();
+      }
+      onBuilt();
+      return result;
+    }
+
+    public Builder clone() {
+      return (Builder) super.clone();
+    }
+    public Builder setField(
+        com.google.protobuf.Descriptors.FieldDescriptor field,
+        Object value) {
+      return (Builder) super.setField(field, value);
+    }
+    public Builder clearField(
+        com.google.protobuf.Descriptors.FieldDescriptor field) {
+      return (Builder) super.clearField(field);
+    }
+    public Builder clearOneof(
+        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+      return (Builder) super.clearOneof(oneof);
+    }
+    public Builder setRepeatedField(
+        com.google.protobuf.Descriptors.FieldDescriptor field,
+        int index, Object value) {
+      return (Builder) super.setRepeatedField(field, index, value);
+    }
+    public Builder addRepeatedField(
+        com.google.protobuf.Descriptors.FieldDescriptor field,
+        Object value) {
+      return (Builder) super.addRepeatedField(field, value);
+    }
+    public Builder mergeFrom(com.google.protobuf.Message other) {
+      if (other instanceof PredictionResponse) {
+        return mergeFrom((PredictionResponse)other);
+      } else {
+        super.mergeFrom(other);
+        return this;
+      }
+    }
+
+    public Builder mergeFrom(PredictionResponse other) {
+      if (other == PredictionResponse.getDefaultInstance()) return this;
+      if (other.getPrediction() != com.google.protobuf.ByteString.EMPTY) {
+        setPrediction(other.getPrediction());
+      }
+      if (!other.getSequenceId().isEmpty()) {
+        sequenceId_ = other.sequenceId_;
+        onChanged();
+      }
+      if (other.hasStatus()) {
+        mergeStatus(other.getStatus());
+      }
+      this.mergeUnknownFields(other.unknownFields);
+      onChanged();
+      return this;
+    }
+
+    public final boolean isInitialized() {
+      return true;
+    }
+
+    public Builder mergeFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      PredictionResponse parsedMessage = null;
+      try {
+        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        parsedMessage = (PredictionResponse) e.getUnfinishedMessage();
+        throw e.unwrapIOException();
+      } finally {
+        if (parsedMessage != null) {
+          mergeFrom(parsedMessage);
+        }
+      }
+      return this;
+    }
+
+    private com.google.protobuf.ByteString prediction_ = com.google.protobuf.ByteString.EMPTY;
+    /**
+     * <pre>
+     * Response content for prediction
+     * </pre>
+     *
+     * <code>bytes prediction = 1;</code>
+     */
+    public com.google.protobuf.ByteString getPrediction() {
+      return prediction_;
+    }
+    /**
+     * <pre>
+     * Response content for prediction
+     * </pre>
+     *
+     * <code>bytes prediction = 1;</code>
+     */
+    public Builder setPrediction(com.google.protobuf.ByteString value) {
+      if (value == null) {
+    throw new NullPointerException();
+  }
+  
+      prediction_ = value;
+      onChanged();
+      return this;
+    }
+    /**
+     * <pre>
+     * Response content for prediction
+     * </pre>
+     *
+     * <code>bytes prediction = 1;</code>
+     */
+    public Builder clearPrediction() {
+      
+      prediction_ = getDefaultInstance().getPrediction();
+      onChanged();
+      return this;
+    }
+
+    private Object sequenceId_ = "";
+    /**
+     * <pre>
+     * SequenceId is required for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>string sequence_id = 2;</code>
+     */
+    public String getSequenceId() {
+      Object ref = sequenceId_;
+      if (!(ref instanceof String)) {
+        com.google.protobuf.ByteString bs =
+            (com.google.protobuf.ByteString) ref;
+        String s = bs.toStringUtf8();
+        sequenceId_ = s;
+        return s;
+      } else {
+        return (String) ref;
+      }
+    }
+    /**
+     * <pre>
+     * SequenceId is required for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>string sequence_id = 2;</code>
+     */
+    public com.google.protobuf.ByteString
+        getSequenceIdBytes() {
+      Object ref = sequenceId_;
+      if (ref instanceof String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (String) ref);
+        sequenceId_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+    /**
+     * <pre>
+     * SequenceId is required for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>string sequence_id = 2;</code>
+     */
+    public Builder setSequenceId(
+        String value) {
+      if (value == null) {
+    throw new NullPointerException();
+  }
+  
+      sequenceId_ = value;
+      onChanged();
+      return this;
+    }
+    /**
+     * <pre>
+     * SequenceId is required for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>string sequence_id = 2;</code>
+     */
+    public Builder clearSequenceId() {
+      
+      sequenceId_ = getDefaultInstance().getSequenceId();
+      onChanged();
+      return this;
+    }
+    /**
+     * <pre>
+     * SequenceId is required for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>string sequence_id = 2;</code>
+     */
+    public Builder setSequenceIdBytes(
+        com.google.protobuf.ByteString value) {
+      if (value == null) {
+    throw new NullPointerException();
+  }
+  checkByteStringIsUtf8(value);
+      
+      sequenceId_ = value;
+      onChanged();
+      return this;
+    }
+
+    private com.google.rpc.Status status_ = null;
+    private com.google.protobuf.SingleFieldBuilderV3<
+        com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> statusBuilder_;
+    /**
+     * <pre>
+     * Error information for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>.google.rpc.Status status = 3;</code>
+     */
+    public boolean hasStatus() {
+      return statusBuilder_ != null || status_ != null;
+    }
+    /**
+     * <pre>
+     * Error information for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>.google.rpc.Status status = 3;</code>
+     */
+    public com.google.rpc.Status getStatus() {
+      if (statusBuilder_ == null) {
+        return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_;
+      } else {
+        return statusBuilder_.getMessage();
+      }
+    }
+    /**
+     * <pre>
+     * Error information for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>.google.rpc.Status status = 3;</code>
+     */
+    public Builder setStatus(com.google.rpc.Status value) {
+      if (statusBuilder_ == null) {
+        if (value == null) {
+          throw new NullPointerException();
+        }
+        status_ = value;
+        onChanged();
+      } else {
+        statusBuilder_.setMessage(value);
+      }
+
+      return this;
+    }
+    /**
+     * <pre>
+     * Error information for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>.google.rpc.Status status = 3;</code>
+     */
+    public Builder setStatus(
+        com.google.rpc.Status.Builder builderForValue) {
+      if (statusBuilder_ == null) {
+        status_ = builderForValue.build();
+        onChanged();
+      } else {
+        statusBuilder_.setMessage(builderForValue.build());
+      }
+
+      return this;
+    }
+    /**
+     * <pre>
+     * Error information for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>.google.rpc.Status status = 3;</code>
+     */
+    public Builder mergeStatus(com.google.rpc.Status value) {
+      if (statusBuilder_ == null) {
+        if (status_ != null) {
+          status_ =
+            com.google.rpc.Status.newBuilder(status_).mergeFrom(value).buildPartial();
+        } else {
+          status_ = value;
+        }
+        onChanged();
+      } else {
+        statusBuilder_.mergeFrom(value);
+      }
+
+      return this;
+    }
+    /**
+     * <pre>
+     * Error information for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>.google.rpc.Status status = 3;</code>
+     */
+    public Builder clearStatus() {
+      if (statusBuilder_ == null) {
+        status_ = null;
+        onChanged();
+      } else {
+        status_ = null;
+        statusBuilder_ = null;
+      }
+
+      return this;
+    }
+    /**
+     * <pre>
+     * Error information for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>.google.rpc.Status status = 3;</code>
+     */
+    public com.google.rpc.Status.Builder getStatusBuilder() {
+      
+      onChanged();
+      return getStatusFieldBuilder().getBuilder();
+    }
+    /**
+     * <pre>
+     * Error information for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>.google.rpc.Status status = 3;</code>
+     */
+    public com.google.rpc.StatusOrBuilder getStatusOrBuilder() {
+      if (statusBuilder_ != null) {
+        return statusBuilder_.getMessageOrBuilder();
+      } else {
+        return status_ == null ?
+            com.google.rpc.Status.getDefaultInstance() : status_;
+      }
+    }
+    /**
+     * <pre>
+     * Error information for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>.google.rpc.Status status = 3;</code>
+     */
+    private com.google.protobuf.SingleFieldBuilderV3<
+        com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> 
+        getStatusFieldBuilder() {
+      if (statusBuilder_ == null) {
+        statusBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
+            com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder>(
+                getStatus(),
+                getParentForChildren(),
+                isClean());
+        status_ = null;
+      }
+      return statusBuilder_;
+    }
+    public final Builder setUnknownFields(
+        final com.google.protobuf.UnknownFieldSet unknownFields) {
+      return super.setUnknownFieldsProto3(unknownFields);
+    }
+
+    public final Builder mergeUnknownFields(
+        final com.google.protobuf.UnknownFieldSet unknownFields) {
+      return super.mergeUnknownFields(unknownFields);
+    }
+
+
+    // @@protoc_insertion_point(builder_scope:org.pytorch.serve.grpc.inference.PredictionResponse)
+  }
+
+  // @@protoc_insertion_point(class_scope:org.pytorch.serve.grpc.inference.PredictionResponse)
+  private static final PredictionResponse DEFAULT_INSTANCE;
+  static {
+    DEFAULT_INSTANCE = new PredictionResponse();
+  }
+
+  public static PredictionResponse getDefaultInstance() {
+    return DEFAULT_INSTANCE;
+  }
+
+  private static final com.google.protobuf.Parser<PredictionResponse>
+      PARSER = new com.google.protobuf.AbstractParser<PredictionResponse>() {
+    public PredictionResponse parsePartialFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return new PredictionResponse(input, extensionRegistry);
+    }
+  };
+
+  public static com.google.protobuf.Parser<PredictionResponse> parser() {
+    return PARSER;
+  }
+
+  @Override
+  public com.google.protobuf.Parser<PredictionResponse> getParserForType() {
+    return PARSER;
+  }
+
+  public PredictionResponse getDefaultInstanceForType() {
+    return DEFAULT_INSTANCE;
+  }
+
+}
+

+ 61 - 0
slibra-quartz/src/main/java/inference/PredictionResponseOrBuilder.java

@@ -0,0 +1,61 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: inference.proto
+
+package inference;
+
+public interface PredictionResponseOrBuilder extends
+    // @@protoc_insertion_point(interface_extends:org.pytorch.serve.grpc.inference.PredictionResponse)
+    com.google.protobuf.MessageOrBuilder {
+
+  /**
+   * <pre>
+   * Response content for prediction
+   * </pre>
+   *
+   * <code>bytes prediction = 1;</code>
+   */
+  com.google.protobuf.ByteString getPrediction();
+
+  /**
+   * <pre>
+   * SequenceId is required for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>string sequence_id = 2;</code>
+   */
+  String getSequenceId();
+  /**
+   * <pre>
+   * SequenceId is required for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>string sequence_id = 2;</code>
+   */
+  com.google.protobuf.ByteString
+      getSequenceIdBytes();
+
+  /**
+   * <pre>
+   * Error information for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>.google.rpc.Status status = 3;</code>
+   */
+  boolean hasStatus();
+  /**
+   * <pre>
+   * Error information for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>.google.rpc.Status status = 3;</code>
+   */
+  com.google.rpc.Status getStatus();
+  /**
+   * <pre>
+   * Error information for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>.google.rpc.Status status = 3;</code>
+   */
+  com.google.rpc.StatusOrBuilder getStatusOrBuilder();
+}

+ 1175 - 0
slibra-quartz/src/main/java/inference/PredictionsRequest.java

@@ -0,0 +1,1175 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: inference.proto
+
+package inference;
+
+/**
+ * Protobuf type {@code org.pytorch.serve.grpc.inference.PredictionsRequest}
+ */
+public  final class PredictionsRequest extends
+    com.google.protobuf.GeneratedMessageV3 implements
+    // @@protoc_insertion_point(message_implements:org.pytorch.serve.grpc.inference.PredictionsRequest)
+        PredictionsRequestOrBuilder {
+private static final long serialVersionUID = 0L;
+  // Use PredictionsRequest.newBuilder() to construct.
+  private PredictionsRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
+    super(builder);
+  }
+  private PredictionsRequest() {
+    modelName_ = "";
+    modelVersion_ = "";
+    sequenceId_ = "";
+  }
+
+  @Override
+  public final com.google.protobuf.UnknownFieldSet
+  getUnknownFields() {
+    return this.unknownFields;
+  }
+  private PredictionsRequest(
+      com.google.protobuf.CodedInputStream input,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    this();
+    if (extensionRegistry == null) {
+      throw new NullPointerException();
+    }
+    int mutable_bitField0_ = 0;
+    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+        com.google.protobuf.UnknownFieldSet.newBuilder();
+    try {
+      boolean done = false;
+      while (!done) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            done = true;
+            break;
+          default: {
+            if (!parseUnknownFieldProto3(
+                input, unknownFields, extensionRegistry, tag)) {
+              done = true;
+            }
+            break;
+          }
+          case 10: {
+            String s = input.readStringRequireUtf8();
+
+            modelName_ = s;
+            break;
+          }
+          case 18: {
+            String s = input.readStringRequireUtf8();
+
+            modelVersion_ = s;
+            break;
+          }
+          case 26: {
+            if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
+              input_ = com.google.protobuf.MapField.newMapField(
+                  InputDefaultEntryHolder.defaultEntry);
+              mutable_bitField0_ |= 0x00000004;
+            }
+            com.google.protobuf.MapEntry<String, com.google.protobuf.ByteString>
+            input__ = input.readMessage(
+                InputDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
+            input_.getMutableMap().put(
+                input__.getKey(), input__.getValue());
+            break;
+          }
+          case 34: {
+            String s = input.readStringRequireUtf8();
+
+            sequenceId_ = s;
+            break;
+          }
+        }
+      }
+    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+      throw e.setUnfinishedMessage(this);
+    } catch (java.io.IOException e) {
+      throw new com.google.protobuf.InvalidProtocolBufferException(
+          e).setUnfinishedMessage(this);
+    } finally {
+      this.unknownFields = unknownFields.build();
+      makeExtensionsImmutable();
+    }
+  }
+  public static final com.google.protobuf.Descriptors.Descriptor
+      getDescriptor() {
+    return Inference.internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_descriptor;
+  }
+
+  @SuppressWarnings({"rawtypes"})
+  protected com.google.protobuf.MapField internalGetMapField(
+      int number) {
+    switch (number) {
+      case 3:
+        return internalGetInput();
+      default:
+        throw new RuntimeException(
+            "Invalid map field number: " + number);
+    }
+  }
+  protected FieldAccessorTable
+      internalGetFieldAccessorTable() {
+    return Inference.internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_fieldAccessorTable
+        .ensureFieldAccessorsInitialized(
+            PredictionsRequest.class, Builder.class);
+  }
+
+  private int bitField0_;
+  public static final int MODEL_NAME_FIELD_NUMBER = 1;
+  private volatile Object modelName_;
+  /**
+   * <pre>
+   * Name of model.
+   * </pre>
+   *
+   * <code>string model_name = 1;</code>
+   */
+  public String getModelName() {
+    Object ref = modelName_;
+    if (ref instanceof String) {
+      return (String) ref;
+    } else {
+      com.google.protobuf.ByteString bs = 
+          (com.google.protobuf.ByteString) ref;
+      String s = bs.toStringUtf8();
+      modelName_ = s;
+      return s;
+    }
+  }
+  /**
+   * <pre>
+   * Name of model.
+   * </pre>
+   *
+   * <code>string model_name = 1;</code>
+   */
+  public com.google.protobuf.ByteString
+      getModelNameBytes() {
+    Object ref = modelName_;
+    if (ref instanceof String) {
+      com.google.protobuf.ByteString b = 
+          com.google.protobuf.ByteString.copyFromUtf8(
+              (String) ref);
+      modelName_ = b;
+      return b;
+    } else {
+      return (com.google.protobuf.ByteString) ref;
+    }
+  }
+
+  public static final int MODEL_VERSION_FIELD_NUMBER = 2;
+  private volatile Object modelVersion_;
+  /**
+   * <pre>
+   * Version of model to run prediction on.
+   * </pre>
+   *
+   * <code>string model_version = 2;</code>
+   */
+  public String getModelVersion() {
+    Object ref = modelVersion_;
+    if (ref instanceof String) {
+      return (String) ref;
+    } else {
+      com.google.protobuf.ByteString bs = 
+          (com.google.protobuf.ByteString) ref;
+      String s = bs.toStringUtf8();
+      modelVersion_ = s;
+      return s;
+    }
+  }
+  /**
+   * <pre>
+   * Version of model to run prediction on.
+   * </pre>
+   *
+   * <code>string model_version = 2;</code>
+   */
+  public com.google.protobuf.ByteString
+      getModelVersionBytes() {
+    Object ref = modelVersion_;
+    if (ref instanceof String) {
+      com.google.protobuf.ByteString b = 
+          com.google.protobuf.ByteString.copyFromUtf8(
+              (String) ref);
+      modelVersion_ = b;
+      return b;
+    } else {
+      return (com.google.protobuf.ByteString) ref;
+    }
+  }
+
+  public static final int INPUT_FIELD_NUMBER = 3;
+  private static final class InputDefaultEntryHolder {
+    static final com.google.protobuf.MapEntry<
+        String, com.google.protobuf.ByteString> defaultEntry =
+            com.google.protobuf.MapEntry
+            .<String, com.google.protobuf.ByteString>newDefaultInstance(
+                Inference.internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_InputEntry_descriptor,
+                com.google.protobuf.WireFormat.FieldType.STRING,
+                "",
+                com.google.protobuf.WireFormat.FieldType.BYTES,
+                com.google.protobuf.ByteString.EMPTY);
+  }
+  private com.google.protobuf.MapField<
+      String, com.google.protobuf.ByteString> input_;
+  private com.google.protobuf.MapField<String, com.google.protobuf.ByteString>
+  internalGetInput() {
+    if (input_ == null) {
+      return com.google.protobuf.MapField.emptyMapField(
+          InputDefaultEntryHolder.defaultEntry);
+    }
+    return input_;
+  }
+
+  public int getInputCount() {
+    return internalGetInput().getMap().size();
+  }
+  /**
+   * <pre>
+   * Input data for model prediction
+   * </pre>
+   *
+   * <code>map&lt;string, bytes&gt; input = 3;</code>
+   */
+
+  public boolean containsInput(
+      String key) {
+    if (key == null) { throw new NullPointerException(); }
+    return internalGetInput().getMap().containsKey(key);
+  }
+  /**
+   * Use {@link #getInputMap()} instead.
+   */
+  @Deprecated
+  public java.util.Map<String, com.google.protobuf.ByteString> getInput() {
+    return getInputMap();
+  }
+  /**
+   * <pre>
+   * Input data for model prediction
+   * </pre>
+   *
+   * <code>map&lt;string, bytes&gt; input = 3;</code>
+   */
+
+  public java.util.Map<String, com.google.protobuf.ByteString> getInputMap() {
+    return internalGetInput().getMap();
+  }
+  /**
+   * <pre>
+   * Input data for model prediction
+   * </pre>
+   *
+   * <code>map&lt;string, bytes&gt; input = 3;</code>
+   */
+
+  public com.google.protobuf.ByteString getInputOrDefault(
+      String key,
+      com.google.protobuf.ByteString defaultValue) {
+    if (key == null) { throw new NullPointerException(); }
+    java.util.Map<String, com.google.protobuf.ByteString> map =
+        internalGetInput().getMap();
+    return map.containsKey(key) ? map.get(key) : defaultValue;
+  }
+  /**
+   * <pre>
+   * Input data for model prediction
+   * </pre>
+   *
+   * <code>map&lt;string, bytes&gt; input = 3;</code>
+   */
+
+  public com.google.protobuf.ByteString getInputOrThrow(
+      String key) {
+    if (key == null) { throw new NullPointerException(); }
+    java.util.Map<String, com.google.protobuf.ByteString> map =
+        internalGetInput().getMap();
+    if (!map.containsKey(key)) {
+      throw new IllegalArgumentException();
+    }
+    return map.get(key);
+  }
+
+  public static final int SEQUENCE_ID_FIELD_NUMBER = 4;
+  private volatile Object sequenceId_;
+  /**
+   * <pre>
+   * SequenceId is required for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>string sequence_id = 4;</code>
+   */
+  public String getSequenceId() {
+    Object ref = sequenceId_;
+    if (ref instanceof String) {
+      return (String) ref;
+    } else {
+      com.google.protobuf.ByteString bs = 
+          (com.google.protobuf.ByteString) ref;
+      String s = bs.toStringUtf8();
+      sequenceId_ = s;
+      return s;
+    }
+  }
+  /**
+   * <pre>
+   * SequenceId is required for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>string sequence_id = 4;</code>
+   */
+  public com.google.protobuf.ByteString
+      getSequenceIdBytes() {
+    Object ref = sequenceId_;
+    if (ref instanceof String) {
+      com.google.protobuf.ByteString b = 
+          com.google.protobuf.ByteString.copyFromUtf8(
+              (String) ref);
+      sequenceId_ = b;
+      return b;
+    } else {
+      return (com.google.protobuf.ByteString) ref;
+    }
+  }
+
+  private byte memoizedIsInitialized = -1;
+  public final boolean isInitialized() {
+    byte isInitialized = memoizedIsInitialized;
+    if (isInitialized == 1) return true;
+    if (isInitialized == 0) return false;
+
+    memoizedIsInitialized = 1;
+    return true;
+  }
+
+  public void writeTo(com.google.protobuf.CodedOutputStream output)
+                      throws java.io.IOException {
+    if (!getModelNameBytes().isEmpty()) {
+      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, modelName_);
+    }
+    if (!getModelVersionBytes().isEmpty()) {
+      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, modelVersion_);
+    }
+    com.google.protobuf.GeneratedMessageV3
+      .serializeStringMapTo(
+        output,
+        internalGetInput(),
+        InputDefaultEntryHolder.defaultEntry,
+        3);
+    if (!getSequenceIdBytes().isEmpty()) {
+      com.google.protobuf.GeneratedMessageV3.writeString(output, 4, sequenceId_);
+    }
+    unknownFields.writeTo(output);
+  }
+
+  public int getSerializedSize() {
+    int size = memoizedSize;
+    if (size != -1) return size;
+
+    size = 0;
+    if (!getModelNameBytes().isEmpty()) {
+      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, modelName_);
+    }
+    if (!getModelVersionBytes().isEmpty()) {
+      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, modelVersion_);
+    }
+    for (java.util.Map.Entry<String, com.google.protobuf.ByteString> entry
+         : internalGetInput().getMap().entrySet()) {
+      com.google.protobuf.MapEntry<String, com.google.protobuf.ByteString>
+      input__ = InputDefaultEntryHolder.defaultEntry.newBuilderForType()
+          .setKey(entry.getKey())
+          .setValue(entry.getValue())
+          .build();
+      size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(3, input__);
+    }
+    if (!getSequenceIdBytes().isEmpty()) {
+      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, sequenceId_);
+    }
+    size += unknownFields.getSerializedSize();
+    memoizedSize = size;
+    return size;
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    if (obj == this) {
+     return true;
+    }
+    if (!(obj instanceof PredictionsRequest)) {
+      return super.equals(obj);
+    }
+    PredictionsRequest other = (PredictionsRequest) obj;
+
+    boolean result = true;
+    result = result && getModelName()
+        .equals(other.getModelName());
+    result = result && getModelVersion()
+        .equals(other.getModelVersion());
+    result = result && internalGetInput().equals(
+        other.internalGetInput());
+    result = result && getSequenceId()
+        .equals(other.getSequenceId());
+    result = result && unknownFields.equals(other.unknownFields);
+    return result;
+  }
+
+  @Override
+  public int hashCode() {
+    if (memoizedHashCode != 0) {
+      return memoizedHashCode;
+    }
+    int hash = 41;
+    hash = (19 * hash) + getDescriptor().hashCode();
+    hash = (37 * hash) + MODEL_NAME_FIELD_NUMBER;
+    hash = (53 * hash) + getModelName().hashCode();
+    hash = (37 * hash) + MODEL_VERSION_FIELD_NUMBER;
+    hash = (53 * hash) + getModelVersion().hashCode();
+    if (!internalGetInput().getMap().isEmpty()) {
+      hash = (37 * hash) + INPUT_FIELD_NUMBER;
+      hash = (53 * hash) + internalGetInput().hashCode();
+    }
+    hash = (37 * hash) + SEQUENCE_ID_FIELD_NUMBER;
+    hash = (53 * hash) + getSequenceId().hashCode();
+    hash = (29 * hash) + unknownFields.hashCode();
+    memoizedHashCode = hash;
+    return hash;
+  }
+
+  public static PredictionsRequest parseFrom(
+      java.nio.ByteBuffer data)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data);
+  }
+  public static PredictionsRequest parseFrom(
+      java.nio.ByteBuffer data,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data, extensionRegistry);
+  }
+  public static PredictionsRequest parseFrom(
+      com.google.protobuf.ByteString data)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data);
+  }
+  public static PredictionsRequest parseFrom(
+      com.google.protobuf.ByteString data,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data, extensionRegistry);
+  }
+  public static PredictionsRequest parseFrom(byte[] data)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data);
+  }
+  public static PredictionsRequest parseFrom(
+      byte[] data,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data, extensionRegistry);
+  }
+  public static PredictionsRequest parseFrom(java.io.InputStream input)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseWithIOException(PARSER, input);
+  }
+  public static PredictionsRequest parseFrom(
+      java.io.InputStream input,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseWithIOException(PARSER, input, extensionRegistry);
+  }
+  public static PredictionsRequest parseDelimitedFrom(java.io.InputStream input)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseDelimitedWithIOException(PARSER, input);
+  }
+  public static PredictionsRequest parseDelimitedFrom(
+      java.io.InputStream input,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+  }
+  public static PredictionsRequest parseFrom(
+      com.google.protobuf.CodedInputStream input)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseWithIOException(PARSER, input);
+  }
+  public static PredictionsRequest parseFrom(
+      com.google.protobuf.CodedInputStream input,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseWithIOException(PARSER, input, extensionRegistry);
+  }
+
+  public Builder newBuilderForType() { return newBuilder(); }
+  public static Builder newBuilder() {
+    return DEFAULT_INSTANCE.toBuilder();
+  }
+  public static Builder newBuilder(PredictionsRequest prototype) {
+    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+  }
+  public Builder toBuilder() {
+    return this == DEFAULT_INSTANCE
+        ? new Builder() : new Builder().mergeFrom(this);
+  }
+
+  @Override
+  protected Builder newBuilderForType(
+      BuilderParent parent) {
+    Builder builder = new Builder(parent);
+    return builder;
+  }
+  /**
+   * Protobuf type {@code org.pytorch.serve.grpc.inference.PredictionsRequest}
+   */
+  public static final class Builder extends
+      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
+      // @@protoc_insertion_point(builder_implements:org.pytorch.serve.grpc.inference.PredictionsRequest)
+      PredictionsRequestOrBuilder {
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return Inference.internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_descriptor;
+    }
+
+    @SuppressWarnings({"rawtypes"})
+    protected com.google.protobuf.MapField internalGetMapField(
+        int number) {
+      switch (number) {
+        case 3:
+          return internalGetInput();
+        default:
+          throw new RuntimeException(
+              "Invalid map field number: " + number);
+      }
+    }
+    @SuppressWarnings({"rawtypes"})
+    protected com.google.protobuf.MapField internalGetMutableMapField(
+        int number) {
+      switch (number) {
+        case 3:
+          return internalGetMutableInput();
+        default:
+          throw new RuntimeException(
+              "Invalid map field number: " + number);
+      }
+    }
+    protected FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return Inference.internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              PredictionsRequest.class, Builder.class);
+    }
+
+    // Construct using org.pytorch.serve.grpc.inference.PredictionsRequest.newBuilder()
+    private Builder() {
+      maybeForceBuilderInitialization();
+    }
+
+    private Builder(
+        BuilderParent parent) {
+      super(parent);
+      maybeForceBuilderInitialization();
+    }
+    private void maybeForceBuilderInitialization() {
+      if (com.google.protobuf.GeneratedMessageV3
+              .alwaysUseFieldBuilders) {
+      }
+    }
+    public Builder clear() {
+      super.clear();
+      modelName_ = "";
+
+      modelVersion_ = "";
+
+      internalGetMutableInput().clear();
+      sequenceId_ = "";
+
+      return this;
+    }
+
+    public com.google.protobuf.Descriptors.Descriptor
+        getDescriptorForType() {
+      return Inference.internal_static_org_pytorch_serve_grpc_inference_PredictionsRequest_descriptor;
+    }
+
+    public PredictionsRequest getDefaultInstanceForType() {
+      return PredictionsRequest.getDefaultInstance();
+    }
+
+    public PredictionsRequest build() {
+      PredictionsRequest result = buildPartial();
+      if (!result.isInitialized()) {
+        throw newUninitializedMessageException(result);
+      }
+      return result;
+    }
+
+    public PredictionsRequest buildPartial() {
+      PredictionsRequest result = new PredictionsRequest(this);
+      int from_bitField0_ = bitField0_;
+      int to_bitField0_ = 0;
+      result.modelName_ = modelName_;
+      result.modelVersion_ = modelVersion_;
+      result.input_ = internalGetInput();
+      result.input_.makeImmutable();
+      result.sequenceId_ = sequenceId_;
+      result.bitField0_ = to_bitField0_;
+      onBuilt();
+      return result;
+    }
+
+    public Builder clone() {
+      return (Builder) super.clone();
+    }
+    public Builder setField(
+        com.google.protobuf.Descriptors.FieldDescriptor field,
+        Object value) {
+      return (Builder) super.setField(field, value);
+    }
+    public Builder clearField(
+        com.google.protobuf.Descriptors.FieldDescriptor field) {
+      return (Builder) super.clearField(field);
+    }
+    public Builder clearOneof(
+        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+      return (Builder) super.clearOneof(oneof);
+    }
+    public Builder setRepeatedField(
+        com.google.protobuf.Descriptors.FieldDescriptor field,
+        int index, Object value) {
+      return (Builder) super.setRepeatedField(field, index, value);
+    }
+    public Builder addRepeatedField(
+        com.google.protobuf.Descriptors.FieldDescriptor field,
+        Object value) {
+      return (Builder) super.addRepeatedField(field, value);
+    }
+    public Builder mergeFrom(com.google.protobuf.Message other) {
+      if (other instanceof PredictionsRequest) {
+        return mergeFrom((PredictionsRequest)other);
+      } else {
+        super.mergeFrom(other);
+        return this;
+      }
+    }
+
+    public Builder mergeFrom(PredictionsRequest other) {
+      if (other == PredictionsRequest.getDefaultInstance()) return this;
+      if (!other.getModelName().isEmpty()) {
+        modelName_ = other.modelName_;
+        onChanged();
+      }
+      if (!other.getModelVersion().isEmpty()) {
+        modelVersion_ = other.modelVersion_;
+        onChanged();
+      }
+      internalGetMutableInput().mergeFrom(
+          other.internalGetInput());
+      if (!other.getSequenceId().isEmpty()) {
+        sequenceId_ = other.sequenceId_;
+        onChanged();
+      }
+      this.mergeUnknownFields(other.unknownFields);
+      onChanged();
+      return this;
+    }
+
+    public final boolean isInitialized() {
+      return true;
+    }
+
+    public Builder mergeFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      PredictionsRequest parsedMessage = null;
+      try {
+        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        parsedMessage = (PredictionsRequest) e.getUnfinishedMessage();
+        throw e.unwrapIOException();
+      } finally {
+        if (parsedMessage != null) {
+          mergeFrom(parsedMessage);
+        }
+      }
+      return this;
+    }
+    private int bitField0_;
+
+    private Object modelName_ = "";
+    /**
+     * <pre>
+     * Name of model.
+     * </pre>
+     *
+     * <code>string model_name = 1;</code>
+     */
+    public String getModelName() {
+      Object ref = modelName_;
+      if (!(ref instanceof String)) {
+        com.google.protobuf.ByteString bs =
+            (com.google.protobuf.ByteString) ref;
+        String s = bs.toStringUtf8();
+        modelName_ = s;
+        return s;
+      } else {
+        return (String) ref;
+      }
+    }
+    /**
+     * <pre>
+     * Name of model.
+     * </pre>
+     *
+     * <code>string model_name = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getModelNameBytes() {
+      Object ref = modelName_;
+      if (ref instanceof String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (String) ref);
+        modelName_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+    /**
+     * <pre>
+     * Name of model.
+     * </pre>
+     *
+     * <code>string model_name = 1;</code>
+     */
+    public Builder setModelName(
+        String value) {
+      if (value == null) {
+    throw new NullPointerException();
+  }
+  
+      modelName_ = value;
+      onChanged();
+      return this;
+    }
+    /**
+     * <pre>
+     * Name of model.
+     * </pre>
+     *
+     * <code>string model_name = 1;</code>
+     */
+    public Builder clearModelName() {
+      
+      modelName_ = getDefaultInstance().getModelName();
+      onChanged();
+      return this;
+    }
+    /**
+     * <pre>
+     * Name of model.
+     * </pre>
+     *
+     * <code>string model_name = 1;</code>
+     */
+    public Builder setModelNameBytes(
+        com.google.protobuf.ByteString value) {
+      if (value == null) {
+    throw new NullPointerException();
+  }
+  checkByteStringIsUtf8(value);
+      
+      modelName_ = value;
+      onChanged();
+      return this;
+    }
+
+    private Object modelVersion_ = "";
+    /**
+     * <pre>
+     * Version of model to run prediction on.
+     * </pre>
+     *
+     * <code>string model_version = 2;</code>
+     */
+    public String getModelVersion() {
+      Object ref = modelVersion_;
+      if (!(ref instanceof String)) {
+        com.google.protobuf.ByteString bs =
+            (com.google.protobuf.ByteString) ref;
+        String s = bs.toStringUtf8();
+        modelVersion_ = s;
+        return s;
+      } else {
+        return (String) ref;
+      }
+    }
+    /**
+     * <pre>
+     * Version of model to run prediction on.
+     * </pre>
+     *
+     * <code>string model_version = 2;</code>
+     */
+    public com.google.protobuf.ByteString
+        getModelVersionBytes() {
+      Object ref = modelVersion_;
+      if (ref instanceof String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (String) ref);
+        modelVersion_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+    /**
+     * <pre>
+     * Version of model to run prediction on.
+     * </pre>
+     *
+     * <code>string model_version = 2;</code>
+     */
+    public Builder setModelVersion(
+        String value) {
+      if (value == null) {
+    throw new NullPointerException();
+  }
+  
+      modelVersion_ = value;
+      onChanged();
+      return this;
+    }
+    /**
+     * <pre>
+     * Version of model to run prediction on.
+     * </pre>
+     *
+     * <code>string model_version = 2;</code>
+     */
+    public Builder clearModelVersion() {
+      
+      modelVersion_ = getDefaultInstance().getModelVersion();
+      onChanged();
+      return this;
+    }
+    /**
+     * <pre>
+     * Version of model to run prediction on.
+     * </pre>
+     *
+     * <code>string model_version = 2;</code>
+     */
+    public Builder setModelVersionBytes(
+        com.google.protobuf.ByteString value) {
+      if (value == null) {
+    throw new NullPointerException();
+  }
+  checkByteStringIsUtf8(value);
+      
+      modelVersion_ = value;
+      onChanged();
+      return this;
+    }
+
+    private com.google.protobuf.MapField<
+        String, com.google.protobuf.ByteString> input_;
+    private com.google.protobuf.MapField<String, com.google.protobuf.ByteString>
+    internalGetInput() {
+      if (input_ == null) {
+        return com.google.protobuf.MapField.emptyMapField(
+            InputDefaultEntryHolder.defaultEntry);
+      }
+      return input_;
+    }
+    private com.google.protobuf.MapField<String, com.google.protobuf.ByteString>
+    internalGetMutableInput() {
+      onChanged();;
+      if (input_ == null) {
+        input_ = com.google.protobuf.MapField.newMapField(
+            InputDefaultEntryHolder.defaultEntry);
+      }
+      if (!input_.isMutable()) {
+        input_ = input_.copy();
+      }
+      return input_;
+    }
+
+    public int getInputCount() {
+      return internalGetInput().getMap().size();
+    }
+    /**
+     * <pre>
+     * Input data for model prediction
+     * </pre>
+     *
+     * <code>map&lt;string, bytes&gt; input = 3;</code>
+     */
+
+    public boolean containsInput(
+        String key) {
+      if (key == null) { throw new NullPointerException(); }
+      return internalGetInput().getMap().containsKey(key);
+    }
+    /**
+     * Use {@link #getInputMap()} instead.
+     */
+    @Deprecated
+    public java.util.Map<String, com.google.protobuf.ByteString> getInput() {
+      return getInputMap();
+    }
+    /**
+     * <pre>
+     * Input data for model prediction
+     * </pre>
+     *
+     * <code>map&lt;string, bytes&gt; input = 3;</code>
+     */
+
+    public java.util.Map<String, com.google.protobuf.ByteString> getInputMap() {
+      return internalGetInput().getMap();
+    }
+    /**
+     * <pre>
+     * Input data for model prediction
+     * </pre>
+     *
+     * <code>map&lt;string, bytes&gt; input = 3;</code>
+     */
+
+    public com.google.protobuf.ByteString getInputOrDefault(
+        String key,
+        com.google.protobuf.ByteString defaultValue) {
+      if (key == null) { throw new NullPointerException(); }
+      java.util.Map<String, com.google.protobuf.ByteString> map =
+          internalGetInput().getMap();
+      return map.containsKey(key) ? map.get(key) : defaultValue;
+    }
+    /**
+     * <pre>
+     * Input data for model prediction
+     * </pre>
+     *
+     * <code>map&lt;string, bytes&gt; input = 3;</code>
+     */
+
+    public com.google.protobuf.ByteString getInputOrThrow(
+        String key) {
+      if (key == null) { throw new NullPointerException(); }
+      java.util.Map<String, com.google.protobuf.ByteString> map =
+          internalGetInput().getMap();
+      if (!map.containsKey(key)) {
+        throw new IllegalArgumentException();
+      }
+      return map.get(key);
+    }
+
+    public Builder clearInput() {
+      internalGetMutableInput().getMutableMap()
+          .clear();
+      return this;
+    }
+    /**
+     * <pre>
+     * Input data for model prediction
+     * </pre>
+     *
+     * <code>map&lt;string, bytes&gt; input = 3;</code>
+     */
+
+    public Builder removeInput(
+        String key) {
+      if (key == null) { throw new NullPointerException(); }
+      internalGetMutableInput().getMutableMap()
+          .remove(key);
+      return this;
+    }
+    /**
+     * Use alternate mutation accessors instead.
+     */
+    @Deprecated
+    public java.util.Map<String, com.google.protobuf.ByteString>
+    getMutableInput() {
+      return internalGetMutableInput().getMutableMap();
+    }
+    /**
+     * <pre>
+     * Input data for model prediction
+     * </pre>
+     *
+     * <code>map&lt;string, bytes&gt; input = 3;</code>
+     */
+    public Builder putInput(
+        String key,
+        com.google.protobuf.ByteString value) {
+      if (key == null) { throw new NullPointerException(); }
+      if (value == null) { throw new NullPointerException(); }
+      internalGetMutableInput().getMutableMap()
+          .put(key, value);
+      return this;
+    }
+    /**
+     * <pre>
+     * Input data for model prediction
+     * </pre>
+     *
+     * <code>map&lt;string, bytes&gt; input = 3;</code>
+     */
+
+    public Builder putAllInput(
+        java.util.Map<String, com.google.protobuf.ByteString> values) {
+      internalGetMutableInput().getMutableMap()
+          .putAll(values);
+      return this;
+    }
+
+    private Object sequenceId_ = "";
+    /**
+     * <pre>
+     * SequenceId is required for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>string sequence_id = 4;</code>
+     */
+    public String getSequenceId() {
+      Object ref = sequenceId_;
+      if (!(ref instanceof String)) {
+        com.google.protobuf.ByteString bs =
+            (com.google.protobuf.ByteString) ref;
+        String s = bs.toStringUtf8();
+        sequenceId_ = s;
+        return s;
+      } else {
+        return (String) ref;
+      }
+    }
+    /**
+     * <pre>
+     * SequenceId is required for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>string sequence_id = 4;</code>
+     */
+    public com.google.protobuf.ByteString
+        getSequenceIdBytes() {
+      Object ref = sequenceId_;
+      if (ref instanceof String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (String) ref);
+        sequenceId_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+    /**
+     * <pre>
+     * SequenceId is required for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>string sequence_id = 4;</code>
+     */
+    public Builder setSequenceId(
+        String value) {
+      if (value == null) {
+    throw new NullPointerException();
+  }
+  
+      sequenceId_ = value;
+      onChanged();
+      return this;
+    }
+    /**
+     * <pre>
+     * SequenceId is required for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>string sequence_id = 4;</code>
+     */
+    public Builder clearSequenceId() {
+      
+      sequenceId_ = getDefaultInstance().getSequenceId();
+      onChanged();
+      return this;
+    }
+    /**
+     * <pre>
+     * SequenceId is required for StreamPredictions2 API.
+     * </pre>
+     *
+     * <code>string sequence_id = 4;</code>
+     */
+    public Builder setSequenceIdBytes(
+        com.google.protobuf.ByteString value) {
+      if (value == null) {
+    throw new NullPointerException();
+  }
+  checkByteStringIsUtf8(value);
+      
+      sequenceId_ = value;
+      onChanged();
+      return this;
+    }
+    public final Builder setUnknownFields(
+        final com.google.protobuf.UnknownFieldSet unknownFields) {
+      return super.setUnknownFieldsProto3(unknownFields);
+    }
+
+    public final Builder mergeUnknownFields(
+        final com.google.protobuf.UnknownFieldSet unknownFields) {
+      return super.mergeUnknownFields(unknownFields);
+    }
+
+
+    // @@protoc_insertion_point(builder_scope:org.pytorch.serve.grpc.inference.PredictionsRequest)
+  }
+
+  // @@protoc_insertion_point(class_scope:org.pytorch.serve.grpc.inference.PredictionsRequest)
+  private static final PredictionsRequest DEFAULT_INSTANCE;
+  static {
+    DEFAULT_INSTANCE = new PredictionsRequest();
+  }
+
+  public static PredictionsRequest getDefaultInstance() {
+    return DEFAULT_INSTANCE;
+  }
+
+  private static final com.google.protobuf.Parser<PredictionsRequest>
+      PARSER = new com.google.protobuf.AbstractParser<PredictionsRequest>() {
+    public PredictionsRequest parsePartialFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return new PredictionsRequest(input, extensionRegistry);
+    }
+  };
+
+  public static com.google.protobuf.Parser<PredictionsRequest> parser() {
+    return PARSER;
+  }
+
+  @Override
+  public com.google.protobuf.Parser<PredictionsRequest> getParserForType() {
+    return PARSER;
+  }
+
+  public PredictionsRequest getDefaultInstanceForType() {
+    return DEFAULT_INSTANCE;
+  }
+
+}
+

+ 117 - 0
slibra-quartz/src/main/java/inference/PredictionsRequestOrBuilder.java

@@ -0,0 +1,117 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: inference.proto
+
+package inference;
+
+public interface PredictionsRequestOrBuilder extends
+    // @@protoc_insertion_point(interface_extends:org.pytorch.serve.grpc.inference.PredictionsRequest)
+    com.google.protobuf.MessageOrBuilder {
+
+  /**
+   * <pre>
+   * Name of model.
+   * </pre>
+   *
+   * <code>string model_name = 1;</code>
+   */
+  String getModelName();
+  /**
+   * <pre>
+   * Name of model.
+   * </pre>
+   *
+   * <code>string model_name = 1;</code>
+   */
+  com.google.protobuf.ByteString
+      getModelNameBytes();
+
+  /**
+   * <pre>
+   * Version of model to run prediction on.
+   * </pre>
+   *
+   * <code>string model_version = 2;</code>
+   */
+  String getModelVersion();
+  /**
+   * <pre>
+   * Version of model to run prediction on.
+   * </pre>
+   *
+   * <code>string model_version = 2;</code>
+   */
+  com.google.protobuf.ByteString
+      getModelVersionBytes();
+
+  /**
+   * <pre>
+   * Input data for model prediction
+   * </pre>
+   *
+   * <code>map&lt;string, bytes&gt; input = 3;</code>
+   */
+  int getInputCount();
+  /**
+   * <pre>
+   * Input data for model prediction
+   * </pre>
+   *
+   * <code>map&lt;string, bytes&gt; input = 3;</code>
+   */
+  boolean containsInput(
+      String key);
+  /**
+   * Use {@link #getInputMap()} instead.
+   */
+  @Deprecated
+  java.util.Map<String, com.google.protobuf.ByteString>
+  getInput();
+  /**
+   * <pre>
+   * Input data for model prediction
+   * </pre>
+   *
+   * <code>map&lt;string, bytes&gt; input = 3;</code>
+   */
+  java.util.Map<String, com.google.protobuf.ByteString>
+  getInputMap();
+  /**
+   * <pre>
+   * Input data for model prediction
+   * </pre>
+   *
+   * <code>map&lt;string, bytes&gt; input = 3;</code>
+   */
+
+  com.google.protobuf.ByteString getInputOrDefault(
+      String key,
+      com.google.protobuf.ByteString defaultValue);
+  /**
+   * <pre>
+   * Input data for model prediction
+   * </pre>
+   *
+   * <code>map&lt;string, bytes&gt; input = 3;</code>
+   */
+
+  com.google.protobuf.ByteString getInputOrThrow(
+      String key);
+
+  /**
+   * <pre>
+   * SequenceId is required for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>string sequence_id = 4;</code>
+   */
+  String getSequenceId();
+  /**
+   * <pre>
+   * SequenceId is required for StreamPredictions2 API.
+   * </pre>
+   *
+   * <code>string sequence_id = 4;</code>
+   */
+  com.google.protobuf.ByteString
+      getSequenceIdBytes();
+}

+ 70 - 0
slibra-quartz/src/main/java/inference/Test.java

@@ -0,0 +1,70 @@
+package inference;
+
+import com.google.protobuf.ByteString;
+import com.google.protobuf.InvalidProtocolBufferException;
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
+import java.util.Iterator;
+
+public class Test {
+
+    public static void main(String[] args) throws InvalidProtocolBufferException, UnsupportedEncodingException {
+        ManagedChannel channel = ManagedChannelBuilder.forAddress("10.0.0.24", 17070)
+                .usePlaintext()
+                .build();
+        InferenceAPIsServiceGrpc.InferenceAPIsServiceBlockingStub stub = InferenceAPIsServiceGrpc.newBlockingStub(channel);
+
+//        TorchServeHealthResponse response = inferenceAPIsServiceBlockingStub.ping(Empty.getDefaultInstance());
+//        Iterator<PredictionResponse> response = inferenceAPIsServiceBlockingStub.streamPredictions(PredictionsRequest.getDefaultInstance());
+        String dataJson = "{\"bot_id\":\"721\",\"exp_id\":\"721\",\"session_id\":\"C20231025153549AC11FC2905668524\",\"prompt\":\"你是一个客服\",\"history_dia\":[\"您好!|||\",\"喂您好,我是您的客服顾问,我姓刘,工号是96466,那今天给您来电话,主要就是想跟您说一下,您之前领取了一份免费的保障,这份保障是完全免费的,我这边也是带您去看一下您的保障内容和理赔服务都有哪些。嗯就耽误您几分钟时间给您做个讲解好吧?\",\"不接电话。\",\"喂您好,我是您的客服顾问,我姓刘,工号是96466,那今天给您来电话,主要就是想跟您说一下,您之前领取了一份免费的保障,这份保障是完全免费的,我这边也是带您去看一下您的保障内容和理赔服务都有哪些。嗯就耽误您几分钟时间给您做个讲解好吧?\",\"好,不需要。\",\"啊是这样,我这边是水滴保的,就是您之前在水滴领取过一个免费的赠险吗?我这边就是带您去我们的微信公众号上查看一下这个保单,然后告诉您日后怎么去理赔。\",\"不好,就把电话给打了。我喝完。\",\"啊,您现在啊是这样的,咱们的保障呢已经生效了,要么是咱免费领的,要么是咱付过钱了的。如果出险,要花很多的钱的话,咱是可以理赔报销的。现在咱们花几分钟时间带您了解一下具体的内容和操作流程,您看好吧。\",\"嗯。查询。\",\"哦,那您现在手机是在通话页面还是打开微信了?\",\"你你说你说我现在听听。\"],\"generate_args\":{\"max_new_tokens\":1024,\"max_length\":4096,\"num_beams\":1,\"do_sample\":true,\"top_p\":0.7,\"temperature\":0.95},\"extra\":{\"TP_in\":100,\"andan_in_name\":110}}";
+//        dataJson = "{\"bot_id\":\"b00001\",\"exp_id\":\"721\",\"norm\":\"进水总氮\",\"session_id\":\"C20231025153549AC11FC2905668524\",\"generate_args\":{\"max_new_tokens\":1024,\"max_length\":4096,\"num_beams\":1,\"do_sample\":true,\"top_p\":0.7,\"temperature\":0.95},\"extra\":{}}";
+        System.out.println(dataJson);
+        PredictionsRequest request = PredictionsRequest.newBuilder()
+                .setModelName("slibra_bot")
+                .putInput("method", ByteString.copyFrom("infer_stream", "utf-8"))//推理
+//                .putInput("method", ByteString.copyFrom("decision_stream", "utf-8"))//决策
+                .putInput("data", ByteString.copyFrom(dataJson, "utf-8"))
+                .buildPartial();
+        Iterator<PredictionResponse> response = stub.streamPredictions(request);
+        while (response.hasNext()){
+            String responseStr = response.next().getPrediction().toStringUtf8();
+//            System.out.println(unicodeToChinese(responseStr.substring(16, responseStr.length()-1)) + "---" + responseStr);
+            System.out.println(responseStr);
+        }
+        channel.shutdown();
+    }
+
+
+    /*public static void main(String[] args) {
+        String encoded = "\\345\\216\\214\\346\\260\\247\\346\\261\\240\\347\\241\\235\\351\\205\\270\\347\\233\\220\\346\\260\\256\\346\\230\\257\\345\\220\\246\\345\\244\\247\\344\\272";
+        String decoded = decodeOctalToUtf8(encoded);
+        System.out.println(decoded);
+    }*/
+
+
+    public static String decodeOctalToUtf8(String encoded) {
+        // 移除反斜杠
+        String octalSequence = encoded.replaceAll("\\\\", "");
+
+        // 检查长度是否是3的倍数
+        if (octalSequence.length() % 3 != 0) {
+            throw new IllegalArgumentException("Encoded string length is not a multiple of 3");
+        }
+
+        byte[] bytes = new byte[octalSequence.length() / 3];
+        for (int i = 0, j = 0; i < octalSequence.length(); i += 3, j++) {
+            // 提取每三个字符的八进制数
+            String octal = octalSequence.substring(i, i + 3);
+            // 将八进制数转换为字节
+            bytes[j] = (byte) Integer.parseInt(octal, 8);
+        }
+        // 将字节序列转换为UTF-8编码的字符串
+        return new String(bytes, StandardCharsets.UTF_8);
+    }
+
+
+
+}

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 20 - 0
slibra-quartz/src/main/java/inference/TestJC.java


+ 544 - 0
slibra-quartz/src/main/java/inference/TorchServeHealthResponse.java

@@ -0,0 +1,544 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: inference.proto
+
+package inference;
+
+/**
+ * Protobuf type {@code org.pytorch.serve.grpc.inference.TorchServeHealthResponse}
+ */
+public  final class TorchServeHealthResponse extends
+    com.google.protobuf.GeneratedMessageV3 implements
+    // @@protoc_insertion_point(message_implements:org.pytorch.serve.grpc.inference.TorchServeHealthResponse)
+        TorchServeHealthResponseOrBuilder {
+private static final long serialVersionUID = 0L;
+  // Use TorchServeHealthResponse.newBuilder() to construct.
+  private TorchServeHealthResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
+    super(builder);
+  }
+  private TorchServeHealthResponse() {
+    health_ = "";
+  }
+
+  @Override
+  public final com.google.protobuf.UnknownFieldSet
+  getUnknownFields() {
+    return this.unknownFields;
+  }
+  private TorchServeHealthResponse(
+      com.google.protobuf.CodedInputStream input,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    this();
+    if (extensionRegistry == null) {
+      throw new NullPointerException();
+    }
+    int mutable_bitField0_ = 0;
+    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+        com.google.protobuf.UnknownFieldSet.newBuilder();
+    try {
+      boolean done = false;
+      while (!done) {
+        int tag = input.readTag();
+        switch (tag) {
+          case 0:
+            done = true;
+            break;
+          default: {
+            if (!parseUnknownFieldProto3(
+                input, unknownFields, extensionRegistry, tag)) {
+              done = true;
+            }
+            break;
+          }
+          case 10: {
+            String s = input.readStringRequireUtf8();
+
+            health_ = s;
+            break;
+          }
+        }
+      }
+    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+      throw e.setUnfinishedMessage(this);
+    } catch (java.io.IOException e) {
+      throw new com.google.protobuf.InvalidProtocolBufferException(
+          e).setUnfinishedMessage(this);
+    } finally {
+      this.unknownFields = unknownFields.build();
+      makeExtensionsImmutable();
+    }
+  }
+  public static final com.google.protobuf.Descriptors.Descriptor
+      getDescriptor() {
+    return Inference.internal_static_org_pytorch_serve_grpc_inference_TorchServeHealthResponse_descriptor;
+  }
+
+  protected FieldAccessorTable
+      internalGetFieldAccessorTable() {
+    return Inference.internal_static_org_pytorch_serve_grpc_inference_TorchServeHealthResponse_fieldAccessorTable
+        .ensureFieldAccessorsInitialized(
+            TorchServeHealthResponse.class, Builder.class);
+  }
+
+  public static final int HEALTH_FIELD_NUMBER = 1;
+  private volatile Object health_;
+  /**
+   * <pre>
+   * TorchServe health
+   * </pre>
+   *
+   * <code>string health = 1;</code>
+   */
+  public String getHealth() {
+    Object ref = health_;
+    if (ref instanceof String) {
+      return (String) ref;
+    } else {
+      com.google.protobuf.ByteString bs = 
+          (com.google.protobuf.ByteString) ref;
+      String s = bs.toStringUtf8();
+      health_ = s;
+      return s;
+    }
+  }
+  /**
+   * <pre>
+   * TorchServe health
+   * </pre>
+   *
+   * <code>string health = 1;</code>
+   */
+  public com.google.protobuf.ByteString
+      getHealthBytes() {
+    Object ref = health_;
+    if (ref instanceof String) {
+      com.google.protobuf.ByteString b = 
+          com.google.protobuf.ByteString.copyFromUtf8(
+              (String) ref);
+      health_ = b;
+      return b;
+    } else {
+      return (com.google.protobuf.ByteString) ref;
+    }
+  }
+
+  private byte memoizedIsInitialized = -1;
+  public final boolean isInitialized() {
+    byte isInitialized = memoizedIsInitialized;
+    if (isInitialized == 1) return true;
+    if (isInitialized == 0) return false;
+
+    memoizedIsInitialized = 1;
+    return true;
+  }
+
+  public void writeTo(com.google.protobuf.CodedOutputStream output)
+                      throws java.io.IOException {
+    if (!getHealthBytes().isEmpty()) {
+      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, health_);
+    }
+    unknownFields.writeTo(output);
+  }
+
+  public int getSerializedSize() {
+    int size = memoizedSize;
+    if (size != -1) return size;
+
+    size = 0;
+    if (!getHealthBytes().isEmpty()) {
+      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, health_);
+    }
+    size += unknownFields.getSerializedSize();
+    memoizedSize = size;
+    return size;
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    if (obj == this) {
+     return true;
+    }
+    if (!(obj instanceof TorchServeHealthResponse)) {
+      return super.equals(obj);
+    }
+    TorchServeHealthResponse other = (TorchServeHealthResponse) obj;
+
+    boolean result = true;
+    result = result && getHealth()
+        .equals(other.getHealth());
+    result = result && unknownFields.equals(other.unknownFields);
+    return result;
+  }
+
+  @Override
+  public int hashCode() {
+    if (memoizedHashCode != 0) {
+      return memoizedHashCode;
+    }
+    int hash = 41;
+    hash = (19 * hash) + getDescriptor().hashCode();
+    hash = (37 * hash) + HEALTH_FIELD_NUMBER;
+    hash = (53 * hash) + getHealth().hashCode();
+    hash = (29 * hash) + unknownFields.hashCode();
+    memoizedHashCode = hash;
+    return hash;
+  }
+
+  public static TorchServeHealthResponse parseFrom(
+      java.nio.ByteBuffer data)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data);
+  }
+  public static TorchServeHealthResponse parseFrom(
+      java.nio.ByteBuffer data,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data, extensionRegistry);
+  }
+  public static TorchServeHealthResponse parseFrom(
+      com.google.protobuf.ByteString data)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data);
+  }
+  public static TorchServeHealthResponse parseFrom(
+      com.google.protobuf.ByteString data,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data, extensionRegistry);
+  }
+  public static TorchServeHealthResponse parseFrom(byte[] data)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data);
+  }
+  public static TorchServeHealthResponse parseFrom(
+      byte[] data,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws com.google.protobuf.InvalidProtocolBufferException {
+    return PARSER.parseFrom(data, extensionRegistry);
+  }
+  public static TorchServeHealthResponse parseFrom(java.io.InputStream input)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseWithIOException(PARSER, input);
+  }
+  public static TorchServeHealthResponse parseFrom(
+      java.io.InputStream input,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseWithIOException(PARSER, input, extensionRegistry);
+  }
+  public static TorchServeHealthResponse parseDelimitedFrom(java.io.InputStream input)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseDelimitedWithIOException(PARSER, input);
+  }
+  public static TorchServeHealthResponse parseDelimitedFrom(
+      java.io.InputStream input,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+  }
+  public static TorchServeHealthResponse parseFrom(
+      com.google.protobuf.CodedInputStream input)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseWithIOException(PARSER, input);
+  }
+  public static TorchServeHealthResponse parseFrom(
+      com.google.protobuf.CodedInputStream input,
+      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+      throws java.io.IOException {
+    return com.google.protobuf.GeneratedMessageV3
+        .parseWithIOException(PARSER, input, extensionRegistry);
+  }
+
+  public Builder newBuilderForType() { return newBuilder(); }
+  public static Builder newBuilder() {
+    return DEFAULT_INSTANCE.toBuilder();
+  }
+  public static Builder newBuilder(TorchServeHealthResponse prototype) {
+    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+  }
+  public Builder toBuilder() {
+    return this == DEFAULT_INSTANCE
+        ? new Builder() : new Builder().mergeFrom(this);
+  }
+
+  @Override
+  protected Builder newBuilderForType(
+      BuilderParent parent) {
+    Builder builder = new Builder(parent);
+    return builder;
+  }
+  /**
+   * Protobuf type {@code org.pytorch.serve.grpc.inference.TorchServeHealthResponse}
+   */
+  public static final class Builder extends
+      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
+      // @@protoc_insertion_point(builder_implements:org.pytorch.serve.grpc.inference.TorchServeHealthResponse)
+      TorchServeHealthResponseOrBuilder {
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return Inference.internal_static_org_pytorch_serve_grpc_inference_TorchServeHealthResponse_descriptor;
+    }
+
+    protected FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return Inference.internal_static_org_pytorch_serve_grpc_inference_TorchServeHealthResponse_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              TorchServeHealthResponse.class, Builder.class);
+    }
+
+    // Construct using org.pytorch.serve.grpc.inference.TorchServeHealthResponse.newBuilder()
+    private Builder() {
+      maybeForceBuilderInitialization();
+    }
+
+    private Builder(
+        BuilderParent parent) {
+      super(parent);
+      maybeForceBuilderInitialization();
+    }
+    private void maybeForceBuilderInitialization() {
+      if (com.google.protobuf.GeneratedMessageV3
+              .alwaysUseFieldBuilders) {
+      }
+    }
+    public Builder clear() {
+      super.clear();
+      health_ = "";
+
+      return this;
+    }
+
+    public com.google.protobuf.Descriptors.Descriptor
+        getDescriptorForType() {
+      return Inference.internal_static_org_pytorch_serve_grpc_inference_TorchServeHealthResponse_descriptor;
+    }
+
+    public TorchServeHealthResponse getDefaultInstanceForType() {
+      return TorchServeHealthResponse.getDefaultInstance();
+    }
+
+    public TorchServeHealthResponse build() {
+      TorchServeHealthResponse result = buildPartial();
+      if (!result.isInitialized()) {
+        throw newUninitializedMessageException(result);
+      }
+      return result;
+    }
+
+    public TorchServeHealthResponse buildPartial() {
+      TorchServeHealthResponse result = new TorchServeHealthResponse(this);
+      result.health_ = health_;
+      onBuilt();
+      return result;
+    }
+
+    public Builder clone() {
+      return (Builder) super.clone();
+    }
+    public Builder setField(
+        com.google.protobuf.Descriptors.FieldDescriptor field,
+        Object value) {
+      return (Builder) super.setField(field, value);
+    }
+    public Builder clearField(
+        com.google.protobuf.Descriptors.FieldDescriptor field) {
+      return (Builder) super.clearField(field);
+    }
+    public Builder clearOneof(
+        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+      return (Builder) super.clearOneof(oneof);
+    }
+    public Builder setRepeatedField(
+        com.google.protobuf.Descriptors.FieldDescriptor field,
+        int index, Object value) {
+      return (Builder) super.setRepeatedField(field, index, value);
+    }
+    public Builder addRepeatedField(
+        com.google.protobuf.Descriptors.FieldDescriptor field,
+        Object value) {
+      return (Builder) super.addRepeatedField(field, value);
+    }
+    public Builder mergeFrom(com.google.protobuf.Message other) {
+      if (other instanceof TorchServeHealthResponse) {
+        return mergeFrom((TorchServeHealthResponse)other);
+      } else {
+        super.mergeFrom(other);
+        return this;
+      }
+    }
+
+    public Builder mergeFrom(TorchServeHealthResponse other) {
+      if (other == TorchServeHealthResponse.getDefaultInstance()) return this;
+      if (!other.getHealth().isEmpty()) {
+        health_ = other.health_;
+        onChanged();
+      }
+      this.mergeUnknownFields(other.unknownFields);
+      onChanged();
+      return this;
+    }
+
+    public final boolean isInitialized() {
+      return true;
+    }
+
+    public Builder mergeFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      TorchServeHealthResponse parsedMessage = null;
+      try {
+        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        parsedMessage = (TorchServeHealthResponse) e.getUnfinishedMessage();
+        throw e.unwrapIOException();
+      } finally {
+        if (parsedMessage != null) {
+          mergeFrom(parsedMessage);
+        }
+      }
+      return this;
+    }
+
+    private Object health_ = "";
+    /**
+     * <pre>
+     * TorchServe health
+     * </pre>
+     *
+     * <code>string health = 1;</code>
+     */
+    public String getHealth() {
+      Object ref = health_;
+      if (!(ref instanceof String)) {
+        com.google.protobuf.ByteString bs =
+            (com.google.protobuf.ByteString) ref;
+        String s = bs.toStringUtf8();
+        health_ = s;
+        return s;
+      } else {
+        return (String) ref;
+      }
+    }
+    /**
+     * <pre>
+     * TorchServe health
+     * </pre>
+     *
+     * <code>string health = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getHealthBytes() {
+      Object ref = health_;
+      if (ref instanceof String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (String) ref);
+        health_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+    /**
+     * <pre>
+     * TorchServe health
+     * </pre>
+     *
+     * <code>string health = 1;</code>
+     */
+    public Builder setHealth(
+        String value) {
+      if (value == null) {
+    throw new NullPointerException();
+  }
+  
+      health_ = value;
+      onChanged();
+      return this;
+    }
+    /**
+     * <pre>
+     * TorchServe health
+     * </pre>
+     *
+     * <code>string health = 1;</code>
+     */
+    public Builder clearHealth() {
+      
+      health_ = getDefaultInstance().getHealth();
+      onChanged();
+      return this;
+    }
+    /**
+     * <pre>
+     * TorchServe health
+     * </pre>
+     *
+     * <code>string health = 1;</code>
+     */
+    public Builder setHealthBytes(
+        com.google.protobuf.ByteString value) {
+      if (value == null) {
+    throw new NullPointerException();
+  }
+  checkByteStringIsUtf8(value);
+      
+      health_ = value;
+      onChanged();
+      return this;
+    }
+    public final Builder setUnknownFields(
+        final com.google.protobuf.UnknownFieldSet unknownFields) {
+      return super.setUnknownFieldsProto3(unknownFields);
+    }
+
+    public final Builder mergeUnknownFields(
+        final com.google.protobuf.UnknownFieldSet unknownFields) {
+      return super.mergeUnknownFields(unknownFields);
+    }
+
+
+    // @@protoc_insertion_point(builder_scope:org.pytorch.serve.grpc.inference.TorchServeHealthResponse)
+  }
+
+  // @@protoc_insertion_point(class_scope:org.pytorch.serve.grpc.inference.TorchServeHealthResponse)
+  private static final TorchServeHealthResponse DEFAULT_INSTANCE;
+  static {
+    DEFAULT_INSTANCE = new TorchServeHealthResponse();
+  }
+
+  public static TorchServeHealthResponse getDefaultInstance() {
+    return DEFAULT_INSTANCE;
+  }
+
+  private static final com.google.protobuf.Parser<TorchServeHealthResponse>
+      PARSER = new com.google.protobuf.AbstractParser<TorchServeHealthResponse>() {
+    public TorchServeHealthResponse parsePartialFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return new TorchServeHealthResponse(input, extensionRegistry);
+    }
+  };
+
+  public static com.google.protobuf.Parser<TorchServeHealthResponse> parser() {
+    return PARSER;
+  }
+
+  @Override
+  public com.google.protobuf.Parser<TorchServeHealthResponse> getParserForType() {
+    return PARSER;
+  }
+
+  public TorchServeHealthResponse getDefaultInstanceForType() {
+    return DEFAULT_INSTANCE;
+  }
+
+}
+

+ 27 - 0
slibra-quartz/src/main/java/inference/TorchServeHealthResponseOrBuilder.java

@@ -0,0 +1,27 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: inference.proto
+
+package inference;
+
+public interface TorchServeHealthResponseOrBuilder extends
+    // @@protoc_insertion_point(interface_extends:org.pytorch.serve.grpc.inference.TorchServeHealthResponse)
+    com.google.protobuf.MessageOrBuilder {
+
+  /**
+   * <pre>
+   * TorchServe health
+   * </pre>
+   *
+   * <code>string health = 1;</code>
+   */
+  String getHealth();
+  /**
+   * <pre>
+   * TorchServe health
+   * </pre>
+   *
+   * <code>string health = 1;</code>
+   */
+  com.google.protobuf.ByteString
+      getHealthBytes();
+}

+ 5 - 5
slibra-system/src/main/java/com/slibra/business/domain/TXinyiChatRecord.java

@@ -35,8 +35,8 @@ public class TXinyiChatRecord extends BaseEntity
     private Integer type;
 
     /** 隶属哪个模块(0专家问答 1智能工单 2智能体助手) */
-    @Excel(name = "隶属哪个模块", readConverterExp = "0=专家问答,1=智能工单,2=智能体助手")
-    private String module;
+    @Excel(name = "隶属哪个模块", readConverterExp = "0=专家问答,1=智能工单,2=智能体助手,3.告警")
+    private Integer module;
 
     /** 用户ID */
     @Excel(name = "用户ID")
@@ -64,15 +64,15 @@ public class TXinyiChatRecord extends BaseEntity
 
     /** 是否使用搜索增强(0否 1是) */
     @Excel(name = "是否使用搜索增强", readConverterExp = "0=否,1=是")
-    private String isStrong;
+    private Integer isStrong;
 
     /** 回复是否满意(0否 1是) */
     @Excel(name = "回复是否满意", readConverterExp = "0=否,1=是")
-    private String isSatisfied;
+    private Integer isSatisfied;
 
     /** 是否中断问答(0否 1是) */
     @Excel(name = "是否中断问答", readConverterExp = "0=否,1=是")
-    private String isShutdown;
+    private Integer isShutdown;
 
     /** 删除标志(0代表存在 2代表删除) */
     private Long delFlag;

+ 1 - 1
slibra-system/src/main/java/com/slibra/business/domain/TXinyiWarningRecord.java

@@ -72,7 +72,7 @@ public class TXinyiWarningRecord extends BaseEntity
 
     /** 是否转为了应急(0否  1是) */
     @Excel(name = "是否转为了应急", readConverterExp = "0=否,1=是")
-    private String isEmergency;
+    private Integer isEmergency;
 
     /** 关闭报警时间 */
     @JsonFormat(pattern = "yyyy-MM-dd")

+ 3 - 0
slibra-system/src/main/java/com/slibra/business/mapper/TXinyiIndustryMapper.java

@@ -1,6 +1,7 @@
 package com.slibra.business.mapper;
 
 import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
 
 import com.slibra.business.domain.TXinyiIndustry;
@@ -71,4 +72,6 @@ public interface TXinyiIndustryMapper
     String getLastHour();
 
     String getLastMinute();
+
+    List<HashMap<String, Object>> selectLast10RecordsForDecision();
 }

+ 6 - 6
slibra-system/src/main/resources/mapper/business/TXinyiChatRecordMapper.xml

@@ -44,9 +44,9 @@
             <if test="answer != null  and answer != ''"> and answer = #{answer}</if>
             <if test="warningId != null  and warningId != ''"> and warning_id = #{warningId}</if>
             <if test="counts != null "> and counts = #{counts}</if>
-            <if test="isStrong != null  and isStrong != ''"> and is_strong = #{isStrong}</if>
-            <if test="isSatisfied != null  and isSatisfied != ''"> and is_satisfied = #{isSatisfied}</if>
-            <if test="isShutdown != null  and isShutdown != ''"> and is_shutdown = #{isShutdown}</if>
+            <if test="isStrong != null "> and is_strong = #{isStrong}</if>
+            <if test="isSatisfied != null "> and is_satisfied = #{isSatisfied}</if>
+            <if test="isShutdown != null "> and is_shutdown = #{isShutdown}</if>
             <if test="revision != null "> and revision = #{revision}</if>
         </where>
         and del_flag = 0 order by id desc
@@ -65,9 +65,9 @@
             <if test="answer != null  and answer != ''"> and answer = #{answer}</if>
             <if test="warningId != null  and warningId != ''"> and warning_id = #{warningId}</if>
             <if test="counts != null "> and counts = #{counts}</if>
-            <if test="isStrong != null  and isStrong != ''"> and is_strong = #{isStrong}</if>
-            <if test="isSatisfied != null  and isSatisfied != ''"> and is_satisfied = #{isSatisfied}</if>
-            <if test="isShutdown != null  and isShutdown != ''"> and is_shutdown = #{isShutdown}</if>
+            <if test="isStrong != null "> and is_strong = #{isStrong}</if>
+            <if test="isSatisfied != null "> and is_satisfied = #{isSatisfied}</if>
+            <if test="isShutdown != null "> and is_shutdown = #{isShutdown}</if>
             <if test="revision != null "> and revision = #{revision}</if>
         </where>
         and del_flag = 0 order by id desc

+ 72 - 1
slibra-system/src/main/resources/mapper/business/TXinyiIndustryMapper.xml

@@ -330,7 +330,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </delete>
 
-
+    <!-- 下面是新增的 -->
     <select id="getUniqueTXinyiIndustry" resultMap="TXinyiIndustryResult">
         <include refid="selectTXinyiIndustryVo"/>
         where TEST_TIME = #{testTime}
@@ -354,4 +354,75 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="getLastMinute" resultType="string">
         SELECT TEST_TIME FROM t_xinyi_industry  ORDER BY id DESC LIMIT 1
     </select>
+
+    <select id="selectLast10RecordsForDecision" resultType="hashmap">
+        SELECT
+            a.ID ID,
+            a.TEST_DATE TEST_DATE,
+            a.TEST_HOUR TEST_HOUR,
+            a.JS_COD COD_in,
+            b.JSCOD_SJZ COD_in_name,
+            a.CS_COD COD_off,
+            b.CSCOD_BZZ COD_off_name,
+            b.CSCOD_GKZ COD_off_con,
+            a.JS_TP TP_in,
+            b.JSZL_SJZ TP_in_name,
+            a.CS_TP TP_off,
+            b.CSZL_BZZ TP_off_name,
+            b.CSZL_GKZ TP_off_con,
+            a.JS_TN TN_in,
+            b.JSZD_SJZ TN_in_name,
+            a.CS_TN TN_off,
+            b.CSZZ_BZZ TN_off_name,
+            b.CSZZ_GKZ TN_off_con,
+            a.JS_NH3 andan_in,
+            b.JSAD_SJZ andan_in_name,
+            a.CS_NH3 andan_off,
+            b.CSAD_BZZ  andan_off_name,
+            b.CSAD_GKZ andan_off_con,
+            a.JS_SS SS_in,
+            b.JSSS_SJZ SS_in_name,
+            a.CS_SS SS_off,
+            b.CSSS_BZZ SS_off_name,
+            b.CSSS_GKZ  SS_off_con,
+            a.JS_TDS TDS_in,
+            b.JDTDS_GKZ TDS_in_name,
+            c.JS_SW T,
+            a.JS_PH pH,
+            a.JS_SLQ Q_in,
+            b.JSSL_SJZ Q_in_name,
+            '' continuity,
+            '' check_rise,
+            '' time_tips,
+            '' cs_continuity,
+            c.WNTJZS_ALL SVI,
+            b.WNTJZS_GKZ SVI_con,
+            c.WNCJB_ALL SV,
+            b.WNCJB_GKZ SV_con,
+            c.HFXWNND_ALL MLVSS,
+            a.HYC_WNND_ALL MLSS,
+            '' MLVSS_wentai,
+            '' MLSS_wentai,
+            c.YYC_RJY_ALL DO_ana,
+            a.HYC_RJY_ALL DO_O,
+            c.QYC_RJY_ALL DO_que,
+            '' DO_que_wentai,
+            '' DO_ana_wentai,
+            '' DO_O_wentai,
+            c.JS_BOD5 BOD_in,
+            c.JS_BOD5/a.JS_TP c,
+            c.JS_BOD5/a.JS_TN b,
+            '' BTP_wending,
+            '' JS_TN_wentai,
+            a.CL_P04_YCZ CL_P04_YCZ,
+            (a.JS_TP - a.CL_P04_YCZ)/a.JS_TP TP_LV,
+            '' TP_LV_continuity
+        FROM
+            t_xinyi_industry a
+                LEFT JOIN t_xinyi_norm_config b on 1 = 1
+                LEFT JOIN t_xinyi_daily c on a.TEST_DATE = c.TEST_DATE
+        WHERE 1 = 1
+        ORDER BY a.ID DESC
+            LIMIT 10
+    </select>
 </mapper>

+ 1 - 1
slibra-system/src/main/resources/mapper/business/TXinyiWarningRecordMapper.xml

@@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="forecastVal != null "> and forecast_val = #{forecastVal}</if>
             <if test="level != null  and level != ''"> and level = #{level}</if>
             <if test="status != null "> and status = #{status}</if>
-            <if test="isEmergency != null  and isEmergency != ''"> and is_emergency = #{isEmergency}</if>
+            <if test="isEmergency != null "> and is_emergency = #{isEmergency}</if>
             <if test="offTime != null "> and off_time = #{offTime}</if>
             <if test="operator != null  and operator != ''"> and operator = #{operator}</if>
             <if test="review != null  and review != ''"> and review = #{review}</if>

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно