Skip to content

Commit e031aaa

Browse files
authored
Make the embedder mandatory everywhere (#583)
1 parent 4ebf623 commit e031aaa

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

index_search_test.go

+4-14
Original file line numberDiff line numberDiff line change
@@ -1943,19 +1943,6 @@ func TestIndex_SearchWithVectorStore(t *testing.T) {
19431943
RetrieveVectors: true,
19441944
},
19451945
},
1946-
{
1947-
name: "empty Embedder",
1948-
UID: "indexUID",
1949-
client: sv,
1950-
query: "Pride and Prejudice",
1951-
request: SearchRequest{
1952-
Hybrid: &SearchRequestHybrid{
1953-
SemanticRatio: 0.5,
1954-
Embedder: "",
1955-
},
1956-
RetrieveVectors: true,
1957-
},
1958-
},
19591946
}
19601947

19611948
for _, tt := range tests {
@@ -2029,14 +2016,17 @@ func TestIndex_SearchSimilarDocuments(t *testing.T) {
20292016
client: sv,
20302017
request: &SimilarDocumentQuery{
20312018
Id: "123",
2019+
Embedder: "default",
20322020
},
20332021
resp: new(SimilarDocumentResult),
20342022
wantErr: false,
20352023
},
20362024
{
20372025
UID: "indexUID",
20382026
client: sv,
2039-
request: &SimilarDocumentQuery{},
2027+
request: &SimilarDocumentQuery{
2028+
Embedder: "default",
2029+
},
20402030
resp: new(SimilarDocumentResult),
20412031
wantErr: true,
20422032
},

index_settings_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3422,7 +3422,7 @@ func TestIndex_UpdateSettingsEmbedders(t *testing.T) {
34223422
"default": {
34233423
Source: "openAi",
34243424
ApiKey: "xxx",
3425-
Model: "text-embedding-ada-002",
3425+
Model: "text-embedding-3-small",
34263426
DocumentTemplate: "A movie titled '{{doc.title}}'",
34273427
},
34283428
},

types.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ type SearchRequest struct {
433433
IndexUID string `json:"indexUid,omitempty"`
434434
Query string `json:"q"`
435435
Distinct string `json:"distinct,omitempty"`
436-
Hybrid *SearchRequestHybrid `json:"hybrid,omitempty"`
436+
Hybrid *SearchRequestHybrid `json:"hybrid"`
437437
RetrieveVectors bool `json:"retrieveVectors,omitempty"`
438438
RankingScoreThreshold float64 `json:"rankingScoreThreshold,omitempty"`
439439
FederationOptions *SearchFederationOptions `json:"federationOptions,omitempty"`
@@ -446,7 +446,7 @@ type SearchFederationOptions struct {
446446

447447
type SearchRequestHybrid struct {
448448
SemanticRatio float64 `json:"semanticRatio,omitempty"`
449-
Embedder string `json:"embedder,omitempty"`
449+
Embedder string `json:"embedder"`
450450
}
451451

452452
type MultiSearchRequest struct {
@@ -517,7 +517,7 @@ type DocumentsQuery struct {
517517
// SimilarDocumentQuery is query parameters of similar documents
518518
type SimilarDocumentQuery struct {
519519
Id interface{} `json:"id,omitempty"`
520-
Embedder string `json:"embedder,omitempty"`
520+
Embedder string `json:"embedder"`
521521
AttributesToRetrieve []string `json:"attributesToRetrieve,omitempty"`
522522
Offset int64 `json:"offset,omitempty"`
523523
Limit int64 `json:"limit,omitempty"`

0 commit comments

Comments
 (0)