Skip to content

Commit

Permalink
Add Elasticsearch specification for query rules retriever
Browse files Browse the repository at this point in the history
  • Loading branch information
kderusso committed Oct 24, 2024
1 parent 88226e1 commit 2488478
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 5 deletions.
85 changes: 80 additions & 5 deletions output/schema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions output/typescript/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions specification/_types/Retriever.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { QueryVector, QueryVectorBuilder } from '@_types/Knn'
import { float, integer } from '@_types/Numeric'
import { Sort, SortResults } from '@_types/sort'
import { QueryContainer } from './query_dsl/abstractions'
import { Id } from './common'
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'

/**
* @variants container
Expand All @@ -33,6 +35,8 @@ export class RetrieverContainer {
knn?: KnnRetriever
/** A retriever that produces top documents from reciprocal rank fusion (RRF). */
rrf?: RRFRetriever
/** A retriever that replaces the functionality of a rule query. */
rule?: RuleRetriever
}

export class RetrieverBase {
Expand Down Expand Up @@ -78,3 +82,14 @@ export class RRFRetriever extends RetrieverBase {
/** This value determines the size of the individual result sets per query. */
rank_window_size?: integer
}

export class RuleRetriever extends RetrieverBase {
/** The ruleset IDs containing the rules this retriever is evaluating against. */
ruleset_ids: Id[]
/** The match criteria that will determine if a rule in the provided rulesets should be applied. */
match_criteria: UserDefinedValue
/** The retriever whose results rules should be applied to. */
retriever: RetrieverContainer
/** This value determines the size of the individual result set. */
rank_window_size?: integer
}

0 comments on commit 2488478

Please sign in to comment.