| | |
| | | |
| | | public static final String TABLE_CHAT_SIMILAR = "chat_similar"; |
| | | |
| | | // private static final int VECTOR_DIMENSION = 768; |
| | | private static final int VECTOR_DIMENSION = 512; |
| | | |
| | | public MilvusEngine(String ip, int port){ |
| | | DefaultOperateService service = new DefaultOperateService(); |
| | | service.connect(ip, port); |
| | |
| | | chatSimilarTable.setCollectionName(TABLE_CHAT_SIMILAR); |
| | | chatSimilarTable.setDescription("聊天提取工单摘要历史数据"); |
| | | chatSimilarTable.setShardsNum(1); |
| | | chatSimilarTable.setDimension(768); // 这个是根据使用向量模型维度定的 |
| | | // chatSimilarTable.setDimension(768); // 这个是根据使用向量模型维度定的 |
| | | chatSimilarTable.setDimension(VECTOR_DIMENSION); // 这个是根据使用向量模型维度定的 |
| | | |
| | | // 设置字段 |
| | | FieldType id = FieldType.newBuilder() |
| | |
| | | FieldType answer = FieldType.newBuilder() |
| | | .withName("answer").withPrimaryKey(false).withMaxLength(255).withDataType(DataType.VarChar).build(); |
| | | FieldType embedding = FieldType.newBuilder() |
| | | .withName("embedding").withPrimaryKey(false).withDataType(DataType.FloatVector).withDimension(768).build(); |
| | | .withName("embedding").withPrimaryKey(false).withDataType(DataType.FloatVector).withDimension(VECTOR_DIMENSION).build(); |
| | | |
| | | List<FieldType> fieldTypeList = new ArrayList<>(8); |
| | | fieldTypeList.add(id); |
| | |
| | | |
| | | public void dropChatSimilarTable(){ |
| | | this.operateService.dropTable("chat_similar"); |
| | | this.operateService.dropIndex("chat_similar", "chat_similar_index"); |
| | | } |
| | | |
| | | public void insertTestData(){ |