Skip to content

Commit 9bbc868

Browse files
committed
pretty
1 parent 84536c3 commit 9bbc868

File tree

1 file changed

+98
-98
lines changed

1 file changed

+98
-98
lines changed

specification/_types/Retriever.ts

Lines changed: 98 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -16,147 +16,147 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
import { QueryVector, QueryVectorBuilder, RescoreVector } from '@_types/Knn'
20-
import { float, integer } from '@_types/Numeric'
21-
import { Sort, SortResults } from '@_types/sort'
2219
import { FieldCollapse } from '@global/search/_types/FieldCollapse'
2320
import { Rescore } from '@global/search/_types/rescoring'
2421
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
25-
import {Id, IndexName} from './common'
22+
import { QueryVector, QueryVectorBuilder, RescoreVector } from '@_types/Knn'
23+
import { float, integer } from '@_types/Numeric'
24+
import { Sort, SortResults } from '@_types/sort'
25+
import { Id, IndexName } from './common'
2626
import { QueryContainer } from './query_dsl/abstractions'
2727

2828
/**
2929
* @variants container
3030
*/
3131
export class RetrieverContainer {
32-
/** A retriever that replaces the functionality of a traditional query. */
33-
standard?: StandardRetriever
34-
/** A retriever that replaces the functionality of a knn search. */
35-
knn?: KnnRetriever
36-
/** A retriever that produces top documents from reciprocal rank fusion (RRF). */
37-
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
42-
/** A retriever that re-scores only the results produced by its child retriever. */
43-
rescorer?: RescorerRetriever
44-
/** A retriever that supports the combination of different retrievers through a weighted linear combination. */
45-
linear?: LinearRetriever
46-
/**
47-
* A pinned retriever applies pinned documents to the underlying retriever.
48-
* This retriever will rewrite to a PinnedQueryBuilder.
49-
*/
50-
pinned?: PinnedRetriever
32+
/** A retriever that replaces the functionality of a traditional query. */
33+
standard?: StandardRetriever
34+
/** A retriever that replaces the functionality of a knn search. */
35+
knn?: KnnRetriever
36+
/** A retriever that produces top documents from reciprocal rank fusion (RRF). */
37+
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
42+
/** A retriever that re-scores only the results produced by its child retriever. */
43+
rescorer?: RescorerRetriever
44+
/** A retriever that supports the combination of different retrievers through a weighted linear combination. */
45+
linear?: LinearRetriever
46+
/**
47+
* A pinned retriever applies pinned documents to the underlying retriever.
48+
* This retriever will rewrite to a PinnedQueryBuilder.
49+
*/
50+
pinned?: PinnedRetriever
5151
}
5252

5353
export class RetrieverBase {
54-
/** Query to filter the documents that can match. */
55-
filter?: QueryContainer | QueryContainer[]
56-
/** Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. */
57-
min_score?: float
58-
/** Retriever name. */
59-
_name?: string
54+
/** Query to filter the documents that can match. */
55+
filter?: QueryContainer | QueryContainer[]
56+
/** Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. */
57+
min_score?: float
58+
/** Retriever name. */
59+
_name?: string
6060
}
6161

6262
export class RescorerRetriever extends RetrieverBase {
63-
/** Inner retriever. */
64-
retriever: RetrieverContainer
65-
rescore: Rescore | Rescore[]
63+
/** Inner retriever. */
64+
retriever: RetrieverContainer
65+
rescore: Rescore | Rescore[]
6666
}
6767

6868
export class LinearRetriever extends RetrieverBase {
69-
/** Inner retrievers. */
70-
retrievers?: InnerRetriever[]
71-
rank_window_size: integer
69+
/** Inner retrievers. */
70+
retrievers?: InnerRetriever[]
71+
rank_window_size: integer
7272
}
7373

7474
export class PinnedRetriever extends RetrieverBase {
75-
/** Inner retriever. */
76-
retriever: RetrieverContainer
77-
ids?: string[]
78-
docs?: SpecifiedDocument[]
79-
rank_window_size: integer
75+
/** Inner retriever. */
76+
retriever: RetrieverContainer
77+
ids?: string[]
78+
docs?: SpecifiedDocument[]
79+
rank_window_size: integer
8080
}
8181

8282
export class InnerRetriever {
83-
retriever: RetrieverContainer
84-
weight: float
85-
normalizer: ScoreNormalizer
83+
retriever: RetrieverContainer
84+
weight: float
85+
normalizer: ScoreNormalizer
8686
}
8787

8888
export enum ScoreNormalizer {
89-
none,
90-
minmax
89+
none,
90+
minmax
9191
}
9292

9393
export class SpecifiedDocument {
94-
index?: IndexName
95-
id: Id
94+
index?: IndexName
95+
id: Id
9696
}
9797

9898
export class StandardRetriever extends RetrieverBase {
99-
/** Defines a query to retrieve a set of top documents. */
100-
query?: QueryContainer
101-
/** Defines a search after object parameter used for pagination. */
102-
search_after?: SortResults
103-
/** Maximum number of documents to collect for each shard. */
104-
terminate_after?: integer
105-
/** A sort object that that specifies the order of matching documents. */
106-
sort?: Sort
107-
/** Collapses the top documents by a specified key into a single top document per key. */
108-
collapse?: FieldCollapse
99+
/** Defines a query to retrieve a set of top documents. */
100+
query?: QueryContainer
101+
/** Defines a search after object parameter used for pagination. */
102+
search_after?: SortResults
103+
/** Maximum number of documents to collect for each shard. */
104+
terminate_after?: integer
105+
/** A sort object that that specifies the order of matching documents. */
106+
sort?: Sort
107+
/** Collapses the top documents by a specified key into a single top document per key. */
108+
collapse?: FieldCollapse
109109
}
110110

111111
export class KnnRetriever extends RetrieverBase {
112-
/** The name of the vector field to search against. */
113-
field: string
114-
/** Query vector. Must have the same number of dimensions as the vector field you are searching against. You must provide a query_vector_builder or query_vector, but not both. */
115-
query_vector?: QueryVector
116-
/** Defines a model to build a query vector. */
117-
query_vector_builder?: QueryVectorBuilder
118-
/** Number of nearest neighbors to return as top hits. */
119-
k: integer
120-
/** Number of nearest neighbor candidates to consider per shard. */
121-
num_candidates: integer
122-
/** The minimum similarity required for a document to be considered a match. */
123-
similarity?: float
124-
/** Apply oversampling and rescoring to quantized vectors
125-
* @availability stack since=8.18.0
126-
* @availability serverless
127-
*/
128-
rescore_vector?: RescoreVector
112+
/** The name of the vector field to search against. */
113+
field: string
114+
/** Query vector. Must have the same number of dimensions as the vector field you are searching against. You must provide a query_vector_builder or query_vector, but not both. */
115+
query_vector?: QueryVector
116+
/** Defines a model to build a query vector. */
117+
query_vector_builder?: QueryVectorBuilder
118+
/** Number of nearest neighbors to return as top hits. */
119+
k: integer
120+
/** Number of nearest neighbor candidates to consider per shard. */
121+
num_candidates: integer
122+
/** The minimum similarity required for a document to be considered a match. */
123+
similarity?: float
124+
/** Apply oversampling and rescoring to quantized vectors
125+
* @availability stack since=8.18.0
126+
* @availability serverless
127+
*/
128+
rescore_vector?: RescoreVector
129129
}
130130

131131
export class RRFRetriever extends RetrieverBase {
132-
/** A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. */
133-
retrievers: RetrieverContainer[]
134-
/** This value determines how much influence documents in individual result sets per query have over the final ranked result set. */
135-
rank_constant?: integer
136-
/** This value determines the size of the individual result sets per query. */
137-
rank_window_size?: integer
132+
/** A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. */
133+
retrievers: RetrieverContainer[]
134+
/** This value determines how much influence documents in individual result sets per query have over the final ranked result set. */
135+
rank_constant?: integer
136+
/** This value determines the size of the individual result sets per query. */
137+
rank_window_size?: integer
138138
}
139139

140140
export class TextSimilarityReranker extends RetrieverBase {
141-
/** The nested retriever which will produce the first-level results, that will later be used for reranking. */
142-
retriever: RetrieverContainer
143-
/** This value determines how many documents we will consider from the nested retriever. */
144-
rank_window_size?: integer
145-
/** Unique identifier of the inference endpoint created using the inference API. */
146-
inference_id?: string
147-
/** The text snippet used as the basis for similarity comparison */
148-
inference_text?: string
149-
/** The document field to be used for text similarity comparisons. This field should contain the text that will be evaluated against the inference_text */
150-
field?: string
141+
/** The nested retriever which will produce the first-level results, that will later be used for reranking. */
142+
retriever: RetrieverContainer
143+
/** This value determines how many documents we will consider from the nested retriever. */
144+
rank_window_size?: integer
145+
/** Unique identifier of the inference endpoint created using the inference API. */
146+
inference_id?: string
147+
/** The text snippet used as the basis for similarity comparison */
148+
inference_text?: string
149+
/** The document field to be used for text similarity comparisons. This field should contain the text that will be evaluated against the inference_text */
150+
field?: string
151151
}
152152

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

0 commit comments

Comments
 (0)