Skip to content

Commit c0e6ffe

Browse files
devlooped-botkzu
authored andcommitted
⬆️ Bump files with dotnet-file sync
# xai-org/xai-proto - Add hybrid/semantic/keyword retrieval modes with reranker config (#23) xai-org/xai-proto@f6d4d70
1 parent 1bf7982 commit c0e6ffe

File tree

3 files changed

+92
-9
lines changed

3 files changed

+92
-9
lines changed

.netconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@
127127
weak
128128
[file "src/GrokClient/chat.proto"]
129129
url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/chat.proto
130-
sha = 362749661fa2d340d234ad372fab920538897821
131-
etag = 0e35007f9056fd101983a35614525773ea215eec9a8fa6707c2ec4866da5b7f8
130+
sha = f6d4d709515fd666ebeb7dfcb89bd50e58c859d9
131+
etag = a3ef7183a220c08fd57b7a197090a6a8e6e89028e0477184bf73e61b4b7da6ff
132132
weak
133133
[file "src/GrokClient/deferred.proto"]
134134
url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/deferred.proto
@@ -137,8 +137,8 @@
137137
weak
138138
[file "src/GrokClient/documents.proto"]
139139
url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/documents.proto
140-
sha = 736b835b0c0dd93698664732daad49f87a2fbc6f
141-
etag = 3719cf7bc6280bc244ec25290be31fc925c95d0833f5fe282d9d0be805827ec6
140+
sha = f6d4d709515fd666ebeb7dfcb89bd50e58c859d9
141+
etag = 4a8a0f386f19acd6818a04c0729c940a4943054938800e92a8b3973ceedc06f4
142142
weak
143143
[file "src/GrokClient/embed.proto"]
144144
url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/embed.proto

src/GrokClient/chat.proto

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package xai_api;
55

66
import "google/protobuf/timestamp.proto";
77
import "deferred.proto";
8+
import "documents.proto";
89
import "image.proto";
910
import "sample.proto";
1011
import "usage.proto";
@@ -666,6 +667,20 @@ message CollectionsSearch {
666667
// Optional number of chunks to be returned for each collections search.
667668
// Defaults to 10.
668669
optional int32 limit = 2;
670+
671+
// User-defined instructions to be included in the search query. Defaults to generic search
672+
// instructions used by the collections search backend if unset.
673+
optional string instructions = 3;
674+
675+
// How to perform the document search. Defaults to hybrid retrieval when unset.
676+
oneof retrieval_mode {
677+
// Perform hybrid retrieval combining keyword and semantic search.
678+
HybridRetrieval hybrid_retrieval = 4;
679+
// Perform pure semantic retrieval using dense embeddings.
680+
SemanticRetrieval semantic_retrieval = 5;
681+
// Perform keyword-based retrieval using sparse embeddings.
682+
KeywordRetrieval keyword_retrieval = 6;
683+
}
669684
}
670685

671686
message AttachmentSearch {

src/GrokClient/documents.proto

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,68 @@ service Documents {
77
rpc Search(SearchRequest) returns (SearchResponse) {}
88
}
99

10+
// Document search using a combination of keyword and semantic search.
11+
message HybridRetrieval {
12+
// Overfetch multiplier applied to the requested search limit.
13+
// When set, fetches (limit * search_multiplier) results from each retrieval method
14+
// before reranking, then returns the top `limit` results after reranking.
15+
// Valid range is [1, 100]. Defaults to 1 when unset.
16+
optional int32 search_multiplier = 1;
17+
18+
// Which reranker to use to limit results to the desired value.
19+
oneof reranker {
20+
// Use a reranker model to perform the reranking.
21+
RerankerModel reranker_model = 2;
22+
// Use RRF to perform the reranking.
23+
ReciprocalRankFusion reciprocal_rank_fusion = 3;
24+
}
25+
}
26+
27+
// Document search using keyword matching (sparse embeddings).
28+
message KeywordRetrieval {
29+
// Optional, but always used when doing search across multiple collections.
30+
optional RerankerModel reranker = 1;
31+
}
32+
33+
// Document search using semantic similarity (dense embeddings).
34+
message SemanticRetrieval {
35+
// Optional, but always used when doing search across multiple collections.
36+
optional RerankerModel reranker = 1;
37+
}
38+
39+
// Configuration for reciprocal rank fusion (RRF) reranking.
40+
message ReciprocalRankFusion {
41+
// The RRF constant k used in the reciprocal rank fusion formula. Defaults to 60.
42+
optional int32 k = 1;
43+
44+
// Weight for embedding (dense) search results. Should be between 0 and 1. Defaults to 0.5.
45+
float embedding_weight = 3;
46+
47+
// Weight for keyword (sparse) search results. Should be between 0 and 1. Defaults to 0.5.
48+
float text_weight = 4;
49+
50+
// Deprecated: Use embedding_weight and text_weight instead.
51+
reserved 2;
52+
}
53+
54+
// Configuration for model-based reranking.
55+
message RerankerModel {
56+
// The model to use for reranking. Defaults to standard reranker model.
57+
optional string model = 1;
58+
59+
// Instructions for the reranking model. Defaults to generic reranking instructions.
60+
optional string instructions = 2;
61+
}
62+
1063
// RankingMetric is the metric to use for the search.
64+
// Deprecated: Metric now comes from what is set in the collection creation.
1165
enum RankingMetric {
1266
RANKING_METRIC_UNKNOWN = 0;
1367
RANKING_METRIC_L2_DISTANCE = 1;
1468
RANKING_METRIC_COSINE_SIMILARITY = 2;
1569
}
1670

71+
// Message that contains settings needed to do a document search.
1772
message SearchRequest {
1873
// The query to search for which will be embedded using the
1974
// same embedding model as the one used for the source to query.
@@ -22,14 +77,27 @@ message SearchRequest {
2277
DocumentsSource source = 2;
2378
// The number of chunks to return.
2479
// Will always return the top matching chunks.
25-
// Optional, defaults to 10
80+
// Optional, defaults to 10.
2681
optional int32 limit = 3;
27-
28-
// The ranking metric to use for the search. Defaults to RANK_METRIC_L2_DISTANCE.
29-
optional RankingMetric ranking_metric = 4;
30-
3182
// User-defined instructions to be included in the search query. Defaults to generic search instructions.
3283
optional string instructions = 5;
84+
85+
// How to perform the document search. Defaults to HybridRetrieval
86+
oneof retrieval_mode {
87+
HybridRetrieval hybrid_retrieval = 11;
88+
SemanticRetrieval semantic_retrieval = 12;
89+
KeywordRetrieval keyword_retrieval = 13;
90+
}
91+
92+
// Deprecated: Metric now comes from what is set during collection creation.
93+
optional RankingMetric ranking_metric = 4 [deprecated = true];
94+
95+
// Deprecated: Use retrieval_mode instead
96+
reserved 6;
97+
reserved 7;
98+
reserved 8;
99+
reserved 9;
100+
reserved 10;
33101
}
34102

35103
// SearchResponse message contains the results of a document search operation.

0 commit comments

Comments
 (0)