Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public record PQ(
@SerializedName("centroids") Integer centroids,
@SerializedName("segments") Integer segments,
@SerializedName("encoder_type") EncoderType encoderType,
@SerializedName("encoder_distribusion") EncoderDistribution encoderDistribution,
@SerializedName("encoder_distribution") EncoderDistribution encoderDistribution,
@SerializedName("training_limit") Integer trainingLimit,
@SerializedName("bit_compression") Boolean bitCompression) implements Quantization {

Expand All @@ -24,15 +24,15 @@ public enum EncoderType {
}

public enum EncoderDistribution {
@SerializedName("log-normal")
NORMAL,
@SerializedName("normal")
NORMAL,
@SerializedName("log-normal")
LOG_NORMAL;
}

@Override
public Quantization.Kind _kind() {
return Quantization.Kind.RQ;
return Quantization.Kind.PQ;
}

@Override
Expand Down
71 changes: 71 additions & 0 deletions src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import io.weaviate.client6.v1.api.collections.data.BatchReference;
import io.weaviate.client6.v1.api.collections.data.Reference;
import io.weaviate.client6.v1.api.collections.data.ReferenceAddManyResponse;
import io.weaviate.client6.v1.api.collections.quantizers.PQ;
import io.weaviate.client6.v1.api.collections.rerankers.CohereReranker;
import io.weaviate.client6.v1.api.collections.vectorindex.Distance;
import io.weaviate.client6.v1.api.collections.vectorindex.Flat;
Expand Down Expand Up @@ -147,6 +148,76 @@ public static Object[][] testCases() {
}
""",
},
{
VectorConfig.class,
SelfProvidedVectorizer.of(none -> none
.quantization(Quantization.pq(pq -> pq
.centroids(8)
.encoderDistribution(PQ.EncoderDistribution.NORMAL)
.encoderType(PQ.EncoderType.TILE)
.segments(16)
.trainingLimit(1024)
.bitCompression(true)))),
"""
{
"vectorIndexType": "hnsw",
"vectorizer": {"none": {}},
"vectorIndexConfig": {
"pq": {
"enabled": true,
"centroids": 8,
"encoder_distribution": "normal",
"encoder_type": "tile",
"segments": 16,
"training_limit": 1024,
"bit_compression": true
}
}
}
""",
},
{
VectorConfig.class,
SelfProvidedVectorizer.of(none -> none
.quantization(Quantization.sq(sq -> sq
.rescoreLimit(10)
.trainingLimit(1024)
.cache(true)))),
"""
{
"vectorIndexType": "hnsw",
"vectorizer": {"none": {}},
"vectorIndexConfig": {
"sq": {
"enabled": true,
"rescore_limit": 10,
"training_limit": 1024,
"cache": true
}
}
}
""",
},
{
VectorConfig.class,
SelfProvidedVectorizer.of(none -> none
.quantization(Quantization.rq(rq -> rq
.rescoreLimit(10)
.bits(8)))),
"""
{
"vectorIndexType": "hnsw",
"vectorizer": {"none": {}},
"vectorIndexConfig": {
"rq": {
"enabled": true,
"rescore_limit": 10,
"bits": 8
}
}
}
""",
},
{
VectorConfig.class,
SelfProvidedVectorizer.of(none -> none
Expand Down