Skip to content

Commit

Permalink
[codegen] update serverless to latest spec
Browse files Browse the repository at this point in the history
  • Loading branch information
l-trotta committed Aug 28, 2024
1 parent a9b3923 commit 0186134
Show file tree
Hide file tree
Showing 320 changed files with 35,344 additions and 2,385 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ public class KnnQuery extends QueryBase implements QueryVariant {
@Nullable
private final Integer numCandidates;

@Nullable
private final Integer k;

private final List<Query> filter;

@Nullable
Expand All @@ -86,6 +89,7 @@ private KnnQuery(Builder builder) {
this.queryVector = ApiTypeHelper.unmodifiable(builder.queryVector);
this.queryVectorBuilder = builder.queryVectorBuilder;
this.numCandidates = builder.numCandidates;
this.k = builder.k;
this.filter = ApiTypeHelper.unmodifiable(builder.filter);
this.similarity = builder.similarity;

Expand Down Expand Up @@ -142,6 +146,16 @@ public final Integer numCandidates() {
return this.numCandidates;
}

/**
* The final number of nearest neighbors to return as top hits
* <p>
* API name: {@code k}
*/
@Nullable
public final Integer k() {
return this.k;
}

/**
* Filters for the kNN search query
* <p>
Expand Down Expand Up @@ -186,6 +200,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("num_candidates");
generator.write(this.numCandidates);

}
if (this.k != null) {
generator.writeKey("k");
generator.write(this.k);

}
if (ApiTypeHelper.isDefined(this.filter)) {
generator.writeKey("filter");
Expand Down Expand Up @@ -223,6 +242,9 @@ public static class Builder extends QueryBase.AbstractBuilder<Builder> implement
@Nullable
private Integer numCandidates;

@Nullable
private Integer k;

@Nullable
private List<Query> filter;

Expand Down Expand Up @@ -295,6 +317,16 @@ public final Builder numCandidates(@Nullable Integer value) {
return this;
}

/**
* The final number of nearest neighbors to return as top hits
* <p>
* API name: {@code k}
*/
public final Builder k(@Nullable Integer value) {
this.k = value;
return this;
}

/**
* Filters for the kNN search query
* <p>
Expand Down Expand Up @@ -373,6 +405,7 @@ protected static void setupKnnQueryDeserializer(ObjectDeserializer<KnnQuery.Buil
"query_vector");
op.add(Builder::queryVectorBuilder, QueryVectorBuilder._DESERIALIZER, "query_vector_builder");
op.add(Builder::numCandidates, JsonpDeserializer.integerDeserializer(), "num_candidates");
op.add(Builder::k, JsonpDeserializer.integerDeserializer(), "k");
op.add(Builder::filter, JsonpDeserializer.arrayDeserializer(Query._DESERIALIZER), "filter");
op.add(Builder::similarity, JsonpDeserializer.floatDeserializer(), "similarity");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ public class RrfRank extends RankBase implements RankVariant, JsonpSerializable
private final Long rankConstant;

@Nullable
private final Long windowSize;
private final Long rankWindowSize;

// ---------------------------------------------------------------------------------------------

private RrfRank(Builder builder) {

this.rankConstant = builder.rankConstant;
this.windowSize = builder.windowSize;
this.rankWindowSize = builder.rankWindowSize;

}

Expand Down Expand Up @@ -98,11 +98,11 @@ public final Long rankConstant() {
/**
* Size of the individual result sets per query
* <p>
* API name: {@code window_size}
* API name: {@code rank_window_size}
*/
@Nullable
public final Long windowSize() {
return this.windowSize;
public final Long rankWindowSize() {
return this.rankWindowSize;
}

/**
Expand All @@ -121,9 +121,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.write(this.rankConstant);

}
if (this.windowSize != null) {
generator.writeKey("window_size");
generator.write(this.windowSize);
if (this.rankWindowSize != null) {
generator.writeKey("rank_window_size");
generator.write(this.rankWindowSize);

}

Expand All @@ -145,7 +145,7 @@ public static class Builder extends RankBase.AbstractBuilder<Builder> implements
private Long rankConstant;

@Nullable
private Long windowSize;
private Long rankWindowSize;

/**
* How much influence documents in individual result sets per query have over
Expand All @@ -161,10 +161,10 @@ public final Builder rankConstant(@Nullable Long value) {
/**
* Size of the individual result sets per query
* <p>
* API name: {@code window_size}
* API name: {@code rank_window_size}
*/
public final Builder windowSize(@Nullable Long value) {
this.windowSize = value;
public final Builder rankWindowSize(@Nullable Long value) {
this.rankWindowSize = value;
return this;
}

Expand Down Expand Up @@ -197,7 +197,7 @@ public RrfRank build() {
protected static void setupRrfRankDeserializer(ObjectDeserializer<RrfRank.Builder> op) {

op.add(Builder::rankConstant, JsonpDeserializer.longDeserializer(), "rank_constant");
op.add(Builder::windowSize, JsonpDeserializer.longDeserializer(), "window_size");
op.add(Builder::rankWindowSize, JsonpDeserializer.longDeserializer(), "rank_window_size");

}

Expand Down
Loading

0 comments on commit 0186134

Please sign in to comment.