Skip to content

Commit a0d454d

Browse files
authored
[8.x] Add specification for query rules retriever (#3090)
1 parent 05e18f2 commit a0d454d

File tree

3 files changed

+215
-5
lines changed

3 files changed

+215
-5
lines changed

output/schema/schema.json

Lines changed: 168 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/typescript/types.ts

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/_types/Retriever.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
*/
1919

2020
import { FieldCollapse } from '@global/search/_types/FieldCollapse'
21+
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
2122
import { QueryVector, QueryVectorBuilder } from '@_types/Knn'
2223
import { float, integer } from '@_types/Numeric'
2324
import { Sort, SortResults } from '@_types/sort'
25+
import { Id } from './common'
2426
import { QueryContainer } from './query_dsl/abstractions'
2527

2628
/**
@@ -33,6 +35,10 @@ export class RetrieverContainer {
3335
knn?: KnnRetriever
3436
/** A retriever that produces top documents from reciprocal rank fusion (RRF). */
3537
rrf?: RRFRetriever
38+
/** A retriever that reranks the top documents based on a reranking model using the InferenceAPI */
39+
text_similarity_reranker?: TextSimilarityReranker
40+
/** A retriever that replaces the functionality of a rule query. */
41+
rule?: RuleRetriever
3642
}
3743

3844
export class RetrieverBase {
@@ -78,3 +84,27 @@ export class RRFRetriever extends RetrieverBase {
7884
/** This value determines the size of the individual result sets per query. */
7985
rank_window_size?: integer
8086
}
87+
88+
export class TextSimilarityReranker extends RetrieverBase {
89+
/** The nested retriever which will produce the first-level results, that will later be used for reranking. */
90+
retriever: RetrieverContainer
91+
/** This value determines how many documents we will consider from the nested retriever. */
92+
rank_window_size?: integer
93+
/** Unique identifier of the inference endpoint created using the inference API. */
94+
inference_id?: string
95+
/** The text snippet used as the basis for similarity comparison */
96+
inference_text?: string
97+
/** The document field to be used for text similarity comparisons. This field should contain the text that will be evaluated against the inference_text */
98+
field?: string
99+
}
100+
101+
export class RuleRetriever extends RetrieverBase {
102+
/** The ruleset IDs containing the rules this retriever is evaluating against. */
103+
ruleset_ids: Id[]
104+
/** The match criteria that will determine if a rule in the provided rulesets should be applied. */
105+
match_criteria: UserDefinedValue
106+
/** The retriever whose results rules should be applied to. */
107+
retriever: RetrieverContainer
108+
/** This value determines the size of the individual result set. */
109+
rank_window_size?: integer
110+
}

0 commit comments

Comments
 (0)