mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 02:46:56 +00:00
(fix)(headless)Fix hash code issue of MetricSchemaResp and DimensionSchemaResp.
This commit is contained in:
@@ -66,8 +66,8 @@ public class S2OnnxEmbeddingModel extends AbstractInProcessEmbeddingModel {
|
||||
|
||||
static OnnxBertBiEncoder loadFromFileSystem(Path pathToModel, URL vocabularyFile) {
|
||||
try {
|
||||
return new OnnxBertBiEncoder(Files.newInputStream(pathToModel), vocabularyFile.openStream(),
|
||||
PoolingMode.MEAN);
|
||||
return new OnnxBertBiEncoder(Files.newInputStream(pathToModel),
|
||||
vocabularyFile.openStream(), PoolingMode.MEAN);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -81,13 +81,13 @@ public class MilvusEmbeddingStore implements EmbeddingStore<TextSegment> {
|
||||
|
||||
// Define the field structure for the collection
|
||||
this.fieldDefinition = new FieldDefinition(ID_FIELD_NAME, TEXT_FIELD_NAME,
|
||||
METADATA_FIELD_NAME, VECTOR_FIELD_NAME);
|
||||
METADATA_FIELD_NAME, VECTOR_FIELD_NAME);
|
||||
|
||||
if (!hasCollection(this.milvusClient, this.collectionName)) {
|
||||
createCollection(this.milvusClient, this.collectionName, fieldDefinition,
|
||||
ensureNotNull(dimension, "dimension"));
|
||||
ensureNotNull(dimension, "dimension"));
|
||||
createIndex(this.milvusClient, this.collectionName, VECTOR_FIELD_NAME,
|
||||
getOrDefault(indexType, FLAT), this.metricType);
|
||||
getOrDefault(indexType, FLAT), this.metricType);
|
||||
}
|
||||
|
||||
loadCollectionInMemory(this.milvusClient, collectionName);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.tencent.supersonic.common.pojo.RecordInfo;
|
||||
import com.tencent.supersonic.common.pojo.enums.SensitiveLevelEnum;
|
||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
||||
@@ -10,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@@ -40,13 +40,13 @@ public class SchemaItem extends RecordInfo {
|
||||
return false;
|
||||
}
|
||||
SchemaItem that = (SchemaItem) o;
|
||||
return Objects.equal(id, that.id) && Objects.equal(name, that.name)
|
||||
&& Objects.equal(bizName, that.bizName) && typeEnum == that.typeEnum;
|
||||
return Objects.equals(id, that.id) && Objects.equals(name, that.name)
|
||||
&& Objects.equals(bizName, that.bizName) && typeEnum == that.typeEnum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id, name, bizName, typeEnum);
|
||||
return Objects.hash(id, name, bizName, typeEnum);
|
||||
}
|
||||
|
||||
public static List<String> getAliasList(String alias) {
|
||||
|
||||
@@ -53,4 +53,15 @@ public class DimensionResp extends SchemaItem {
|
||||
public boolean isPartitionTime() {
|
||||
return DimensionType.isPartitionTime(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,10 +10,7 @@ import lombok.ToString;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
@@ -118,4 +115,15 @@ public class MetricResp extends SchemaItem {
|
||||
public boolean isDerived() {
|
||||
return MetricType.isDerived(metricDefineType, metricDefineByMeasureParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ public class PromptHelper {
|
||||
public List<List<Text2SQLExemplar>> getFewShotExemplars(LLMReq llmReq) {
|
||||
int exemplarRecallNumber =
|
||||
Integer.parseInt(parserConfig.getParameterValue(PARSER_EXEMPLAR_RECALL_NUMBER));
|
||||
int fewShotNumber = Integer.parseInt(parserConfig.getParameterValue(PARSER_FEW_SHOT_NUMBER));
|
||||
int fewShotNumber =
|
||||
Integer.parseInt(parserConfig.getParameterValue(PARSER_FEW_SHOT_NUMBER));
|
||||
int selfConsistencyNumber =
|
||||
Integer.parseInt(parserConfig.getParameterValue(PARSER_SELF_CONSISTENCY_NUMBER));
|
||||
|
||||
@@ -103,7 +104,8 @@ public class PromptHelper {
|
||||
metricStr.append(" COMMENT '").append(metric.getDescription()).append("'");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(metric.getDefaultAgg())) {
|
||||
metricStr.append(" AGGREGATE '").append(metric.getDefaultAgg().toUpperCase()).append("'");
|
||||
metricStr.append(" AGGREGATE '").append(metric.getDefaultAgg().toUpperCase())
|
||||
.append("'");
|
||||
}
|
||||
metricStr.append(">");
|
||||
metrics.add(metricStr.toString());
|
||||
|
||||
Reference in New Issue
Block a user