@google-cloud/discoveryengine 2.4.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +334 -416
- package/build/protos/google/cloud/discoveryengine/v1/search_service.proto +152 -0
- package/build/protos/google/cloud/discoveryengine/v1alpha/search_service.proto +128 -4
- package/build/protos/google/cloud/discoveryengine/v1beta/search_service.proto +128 -4
- package/build/protos/protos.d.ts +829 -518
- package/build/protos/protos.js +2459 -1694
- package/build/protos/protos.json +539 -194
- package/build/src/v1/identity_mapping_store_service_client.js +5 -5
- package/build/src/v1/search_service_client.d.ts +558 -0
- package/build/src/v1/search_service_client.js +372 -0
- package/build/src/v1alpha/search_service_client.d.ts +210 -12
- package/build/src/v1alpha/search_service_client.js +140 -8
- package/build/src/v1beta/search_service_client.d.ts +420 -24
- package/build/src/v1beta/search_service_client.js +280 -16
- package/package.json +1 -1
@@ -293,8 +293,14 @@ export declare class SearchServiceClient {
|
|
293
293
|
* The ranking expression controls the customized ranking on retrieval
|
294
294
|
* documents. This overrides
|
295
295
|
* {@link protos.google.cloud.discoveryengine.v1alpha.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
|
296
|
-
* The
|
297
|
-
*
|
296
|
+
* The syntax and supported features depend on the
|
297
|
+
* `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
298
|
+
* provided, it defaults to `RANK_BY_EMBEDDING`.
|
299
|
+
*
|
300
|
+
* If
|
301
|
+
* {@link protos.google.cloud.discoveryengine.v1alpha.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
302
|
+
* is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
303
|
+
* function or multiple functions that are joined by "+".
|
298
304
|
*
|
299
305
|
* * ranking_expression = function, { " + ", function };
|
300
306
|
*
|
@@ -309,13 +315,73 @@ export declare class SearchServiceClient {
|
|
309
315
|
* between query and document.
|
310
316
|
* * `embedding_field_path`: the document embedding field
|
311
317
|
* used with query embedding vector.
|
312
|
-
* * `dotProduct`: embedding function between embedding_field_path and
|
313
|
-
* embedding vector.
|
318
|
+
* * `dotProduct`: embedding function between `embedding_field_path` and
|
319
|
+
* query embedding vector.
|
314
320
|
*
|
315
321
|
* Example ranking expression:
|
316
322
|
*
|
317
323
|
* If document has an embedding field doc_embedding, the ranking expression
|
318
324
|
* could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
325
|
+
*
|
326
|
+
* If
|
327
|
+
* {@link protos.google.cloud.discoveryengine.v1alpha.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
328
|
+
* is set to `RANK_BY_FORMULA`, the following expression types (and
|
329
|
+
* combinations of those chained using + or
|
330
|
+
* * operators) are supported:
|
331
|
+
*
|
332
|
+
* * `double`
|
333
|
+
* * `signal`
|
334
|
+
* * `log(signal)`
|
335
|
+
* * `exp(signal)`
|
336
|
+
* * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
337
|
+
* argument being a denominator constant.
|
338
|
+
* * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
339
|
+
* * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
340
|
+
* signal2 | double, else returns signal1.
|
341
|
+
*
|
342
|
+
* Here are a few examples of ranking formulas that use the supported
|
343
|
+
* ranking expression types:
|
344
|
+
*
|
345
|
+
* - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
346
|
+
* -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
347
|
+
* `semantic_smilarity_score` adjustment.
|
348
|
+
* - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
349
|
+
* is_nan(keyword_similarity_score)` -- rank by the exponent of
|
350
|
+
* `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
351
|
+
* add constant 0.3 adjustment to the final score if
|
352
|
+
* `semantic_similarity_score` is NaN.
|
353
|
+
* - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
354
|
+
* rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
355
|
+
* of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
356
|
+
* of `semantic_smilarity_score`.
|
357
|
+
*
|
358
|
+
* The following signals are supported:
|
359
|
+
*
|
360
|
+
* * `semantic_similarity_score`: semantic similarity adjustment that is
|
361
|
+
* calculated using the embeddings generated by a proprietary Google model.
|
362
|
+
* This score determines how semantically similar a search query is to a
|
363
|
+
* document.
|
364
|
+
* * `keyword_similarity_score`: keyword match adjustment uses the Best
|
365
|
+
* Match 25 (BM25) ranking function. This score is calculated using a
|
366
|
+
* probabilistic model to estimate the probability that a document is
|
367
|
+
* relevant to a given query.
|
368
|
+
* * `relevance_score`: semantic relevance adjustment that uses a
|
369
|
+
* proprietary Google model to determine the meaning and intent behind a
|
370
|
+
* user's query in context with the content in the documents.
|
371
|
+
* * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
372
|
+
* predicted Click-through rate (pCTR) to gauge the relevance and
|
373
|
+
* attractiveness of a search result from a user's perspective. A higher
|
374
|
+
* pCTR suggests that the result is more likely to satisfy the user's query
|
375
|
+
* and intent, making it a valuable signal for ranking.
|
376
|
+
* * `freshness_rank`: freshness adjustment as a rank
|
377
|
+
* * `document_age`: The time in hours elapsed since the document was last
|
378
|
+
* updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
379
|
+
* * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
380
|
+
* Google model to determine the keyword-based overlap between the query and
|
381
|
+
* the document.
|
382
|
+
* * `base_rank`: the default rank of the result
|
383
|
+
* @param {google.cloud.discoveryengine.v1alpha.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
|
384
|
+
* The backend to use for the ranking expression evaluation.
|
319
385
|
* @param {boolean} request.safeSearch
|
320
386
|
* Whether to turn on safe search. This is only supported for
|
321
387
|
* website search.
|
@@ -574,8 +640,14 @@ export declare class SearchServiceClient {
|
|
574
640
|
* The ranking expression controls the customized ranking on retrieval
|
575
641
|
* documents. This overrides
|
576
642
|
* {@link protos.google.cloud.discoveryengine.v1alpha.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
|
577
|
-
* The
|
578
|
-
*
|
643
|
+
* The syntax and supported features depend on the
|
644
|
+
* `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
645
|
+
* provided, it defaults to `RANK_BY_EMBEDDING`.
|
646
|
+
*
|
647
|
+
* If
|
648
|
+
* {@link protos.google.cloud.discoveryengine.v1alpha.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
649
|
+
* is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
650
|
+
* function or multiple functions that are joined by "+".
|
579
651
|
*
|
580
652
|
* * ranking_expression = function, { " + ", function };
|
581
653
|
*
|
@@ -590,13 +662,73 @@ export declare class SearchServiceClient {
|
|
590
662
|
* between query and document.
|
591
663
|
* * `embedding_field_path`: the document embedding field
|
592
664
|
* used with query embedding vector.
|
593
|
-
* * `dotProduct`: embedding function between embedding_field_path and
|
594
|
-
* embedding vector.
|
665
|
+
* * `dotProduct`: embedding function between `embedding_field_path` and
|
666
|
+
* query embedding vector.
|
595
667
|
*
|
596
668
|
* Example ranking expression:
|
597
669
|
*
|
598
670
|
* If document has an embedding field doc_embedding, the ranking expression
|
599
671
|
* could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
672
|
+
*
|
673
|
+
* If
|
674
|
+
* {@link protos.google.cloud.discoveryengine.v1alpha.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
675
|
+
* is set to `RANK_BY_FORMULA`, the following expression types (and
|
676
|
+
* combinations of those chained using + or
|
677
|
+
* * operators) are supported:
|
678
|
+
*
|
679
|
+
* * `double`
|
680
|
+
* * `signal`
|
681
|
+
* * `log(signal)`
|
682
|
+
* * `exp(signal)`
|
683
|
+
* * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
684
|
+
* argument being a denominator constant.
|
685
|
+
* * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
686
|
+
* * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
687
|
+
* signal2 | double, else returns signal1.
|
688
|
+
*
|
689
|
+
* Here are a few examples of ranking formulas that use the supported
|
690
|
+
* ranking expression types:
|
691
|
+
*
|
692
|
+
* - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
693
|
+
* -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
694
|
+
* `semantic_smilarity_score` adjustment.
|
695
|
+
* - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
696
|
+
* is_nan(keyword_similarity_score)` -- rank by the exponent of
|
697
|
+
* `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
698
|
+
* add constant 0.3 adjustment to the final score if
|
699
|
+
* `semantic_similarity_score` is NaN.
|
700
|
+
* - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
701
|
+
* rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
702
|
+
* of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
703
|
+
* of `semantic_smilarity_score`.
|
704
|
+
*
|
705
|
+
* The following signals are supported:
|
706
|
+
*
|
707
|
+
* * `semantic_similarity_score`: semantic similarity adjustment that is
|
708
|
+
* calculated using the embeddings generated by a proprietary Google model.
|
709
|
+
* This score determines how semantically similar a search query is to a
|
710
|
+
* document.
|
711
|
+
* * `keyword_similarity_score`: keyword match adjustment uses the Best
|
712
|
+
* Match 25 (BM25) ranking function. This score is calculated using a
|
713
|
+
* probabilistic model to estimate the probability that a document is
|
714
|
+
* relevant to a given query.
|
715
|
+
* * `relevance_score`: semantic relevance adjustment that uses a
|
716
|
+
* proprietary Google model to determine the meaning and intent behind a
|
717
|
+
* user's query in context with the content in the documents.
|
718
|
+
* * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
719
|
+
* predicted Click-through rate (pCTR) to gauge the relevance and
|
720
|
+
* attractiveness of a search result from a user's perspective. A higher
|
721
|
+
* pCTR suggests that the result is more likely to satisfy the user's query
|
722
|
+
* and intent, making it a valuable signal for ranking.
|
723
|
+
* * `freshness_rank`: freshness adjustment as a rank
|
724
|
+
* * `document_age`: The time in hours elapsed since the document was last
|
725
|
+
* updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
726
|
+
* * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
727
|
+
* Google model to determine the keyword-based overlap between the query and
|
728
|
+
* the document.
|
729
|
+
* * `base_rank`: the default rank of the result
|
730
|
+
* @param {google.cloud.discoveryengine.v1alpha.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
|
731
|
+
* The backend to use for the ranking expression evaluation.
|
600
732
|
* @param {boolean} request.safeSearch
|
601
733
|
* Whether to turn on safe search. This is only supported for
|
602
734
|
* website search.
|
@@ -850,8 +982,14 @@ export declare class SearchServiceClient {
|
|
850
982
|
* The ranking expression controls the customized ranking on retrieval
|
851
983
|
* documents. This overrides
|
852
984
|
* {@link protos.google.cloud.discoveryengine.v1alpha.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
|
853
|
-
* The
|
854
|
-
*
|
985
|
+
* The syntax and supported features depend on the
|
986
|
+
* `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
987
|
+
* provided, it defaults to `RANK_BY_EMBEDDING`.
|
988
|
+
*
|
989
|
+
* If
|
990
|
+
* {@link protos.google.cloud.discoveryengine.v1alpha.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
991
|
+
* is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
992
|
+
* function or multiple functions that are joined by "+".
|
855
993
|
*
|
856
994
|
* * ranking_expression = function, { " + ", function };
|
857
995
|
*
|
@@ -866,13 +1004,73 @@ export declare class SearchServiceClient {
|
|
866
1004
|
* between query and document.
|
867
1005
|
* * `embedding_field_path`: the document embedding field
|
868
1006
|
* used with query embedding vector.
|
869
|
-
* * `dotProduct`: embedding function between embedding_field_path and
|
870
|
-
* embedding vector.
|
1007
|
+
* * `dotProduct`: embedding function between `embedding_field_path` and
|
1008
|
+
* query embedding vector.
|
871
1009
|
*
|
872
1010
|
* Example ranking expression:
|
873
1011
|
*
|
874
1012
|
* If document has an embedding field doc_embedding, the ranking expression
|
875
1013
|
* could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
1014
|
+
*
|
1015
|
+
* If
|
1016
|
+
* {@link protos.google.cloud.discoveryengine.v1alpha.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
1017
|
+
* is set to `RANK_BY_FORMULA`, the following expression types (and
|
1018
|
+
* combinations of those chained using + or
|
1019
|
+
* * operators) are supported:
|
1020
|
+
*
|
1021
|
+
* * `double`
|
1022
|
+
* * `signal`
|
1023
|
+
* * `log(signal)`
|
1024
|
+
* * `exp(signal)`
|
1025
|
+
* * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
1026
|
+
* argument being a denominator constant.
|
1027
|
+
* * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
1028
|
+
* * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
1029
|
+
* signal2 | double, else returns signal1.
|
1030
|
+
*
|
1031
|
+
* Here are a few examples of ranking formulas that use the supported
|
1032
|
+
* ranking expression types:
|
1033
|
+
*
|
1034
|
+
* - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
1035
|
+
* -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
1036
|
+
* `semantic_smilarity_score` adjustment.
|
1037
|
+
* - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
1038
|
+
* is_nan(keyword_similarity_score)` -- rank by the exponent of
|
1039
|
+
* `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
1040
|
+
* add constant 0.3 adjustment to the final score if
|
1041
|
+
* `semantic_similarity_score` is NaN.
|
1042
|
+
* - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
1043
|
+
* rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
1044
|
+
* of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
1045
|
+
* of `semantic_smilarity_score`.
|
1046
|
+
*
|
1047
|
+
* The following signals are supported:
|
1048
|
+
*
|
1049
|
+
* * `semantic_similarity_score`: semantic similarity adjustment that is
|
1050
|
+
* calculated using the embeddings generated by a proprietary Google model.
|
1051
|
+
* This score determines how semantically similar a search query is to a
|
1052
|
+
* document.
|
1053
|
+
* * `keyword_similarity_score`: keyword match adjustment uses the Best
|
1054
|
+
* Match 25 (BM25) ranking function. This score is calculated using a
|
1055
|
+
* probabilistic model to estimate the probability that a document is
|
1056
|
+
* relevant to a given query.
|
1057
|
+
* * `relevance_score`: semantic relevance adjustment that uses a
|
1058
|
+
* proprietary Google model to determine the meaning and intent behind a
|
1059
|
+
* user's query in context with the content in the documents.
|
1060
|
+
* * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
1061
|
+
* predicted Click-through rate (pCTR) to gauge the relevance and
|
1062
|
+
* attractiveness of a search result from a user's perspective. A higher
|
1063
|
+
* pCTR suggests that the result is more likely to satisfy the user's query
|
1064
|
+
* and intent, making it a valuable signal for ranking.
|
1065
|
+
* * `freshness_rank`: freshness adjustment as a rank
|
1066
|
+
* * `document_age`: The time in hours elapsed since the document was last
|
1067
|
+
* updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
1068
|
+
* * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
1069
|
+
* Google model to determine the keyword-based overlap between the query and
|
1070
|
+
* the document.
|
1071
|
+
* * `base_rank`: the default rank of the result
|
1072
|
+
* @param {google.cloud.discoveryengine.v1alpha.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
|
1073
|
+
* The backend to use for the ranking expression evaluation.
|
876
1074
|
* @param {boolean} request.safeSearch
|
877
1075
|
* Whether to turn on safe search. This is only supported for
|
878
1076
|
* website search.
|
@@ -526,8 +526,14 @@ class SearchServiceClient {
|
|
526
526
|
* The ranking expression controls the customized ranking on retrieval
|
527
527
|
* documents. This overrides
|
528
528
|
* {@link protos.google.cloud.discoveryengine.v1alpha.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
|
529
|
-
* The
|
530
|
-
*
|
529
|
+
* The syntax and supported features depend on the
|
530
|
+
* `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
531
|
+
* provided, it defaults to `RANK_BY_EMBEDDING`.
|
532
|
+
*
|
533
|
+
* If
|
534
|
+
* {@link protos.google.cloud.discoveryengine.v1alpha.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
535
|
+
* is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
536
|
+
* function or multiple functions that are joined by "+".
|
531
537
|
*
|
532
538
|
* * ranking_expression = function, { " + ", function };
|
533
539
|
*
|
@@ -542,13 +548,73 @@ class SearchServiceClient {
|
|
542
548
|
* between query and document.
|
543
549
|
* * `embedding_field_path`: the document embedding field
|
544
550
|
* used with query embedding vector.
|
545
|
-
* * `dotProduct`: embedding function between embedding_field_path and
|
546
|
-
* embedding vector.
|
551
|
+
* * `dotProduct`: embedding function between `embedding_field_path` and
|
552
|
+
* query embedding vector.
|
547
553
|
*
|
548
554
|
* Example ranking expression:
|
549
555
|
*
|
550
556
|
* If document has an embedding field doc_embedding, the ranking expression
|
551
557
|
* could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
558
|
+
*
|
559
|
+
* If
|
560
|
+
* {@link protos.google.cloud.discoveryengine.v1alpha.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
561
|
+
* is set to `RANK_BY_FORMULA`, the following expression types (and
|
562
|
+
* combinations of those chained using + or
|
563
|
+
* * operators) are supported:
|
564
|
+
*
|
565
|
+
* * `double`
|
566
|
+
* * `signal`
|
567
|
+
* * `log(signal)`
|
568
|
+
* * `exp(signal)`
|
569
|
+
* * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
570
|
+
* argument being a denominator constant.
|
571
|
+
* * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
572
|
+
* * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
573
|
+
* signal2 | double, else returns signal1.
|
574
|
+
*
|
575
|
+
* Here are a few examples of ranking formulas that use the supported
|
576
|
+
* ranking expression types:
|
577
|
+
*
|
578
|
+
* - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
579
|
+
* -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
580
|
+
* `semantic_smilarity_score` adjustment.
|
581
|
+
* - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
582
|
+
* is_nan(keyword_similarity_score)` -- rank by the exponent of
|
583
|
+
* `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
584
|
+
* add constant 0.3 adjustment to the final score if
|
585
|
+
* `semantic_similarity_score` is NaN.
|
586
|
+
* - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
587
|
+
* rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
588
|
+
* of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
589
|
+
* of `semantic_smilarity_score`.
|
590
|
+
*
|
591
|
+
* The following signals are supported:
|
592
|
+
*
|
593
|
+
* * `semantic_similarity_score`: semantic similarity adjustment that is
|
594
|
+
* calculated using the embeddings generated by a proprietary Google model.
|
595
|
+
* This score determines how semantically similar a search query is to a
|
596
|
+
* document.
|
597
|
+
* * `keyword_similarity_score`: keyword match adjustment uses the Best
|
598
|
+
* Match 25 (BM25) ranking function. This score is calculated using a
|
599
|
+
* probabilistic model to estimate the probability that a document is
|
600
|
+
* relevant to a given query.
|
601
|
+
* * `relevance_score`: semantic relevance adjustment that uses a
|
602
|
+
* proprietary Google model to determine the meaning and intent behind a
|
603
|
+
* user's query in context with the content in the documents.
|
604
|
+
* * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
605
|
+
* predicted Click-through rate (pCTR) to gauge the relevance and
|
606
|
+
* attractiveness of a search result from a user's perspective. A higher
|
607
|
+
* pCTR suggests that the result is more likely to satisfy the user's query
|
608
|
+
* and intent, making it a valuable signal for ranking.
|
609
|
+
* * `freshness_rank`: freshness adjustment as a rank
|
610
|
+
* * `document_age`: The time in hours elapsed since the document was last
|
611
|
+
* updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
612
|
+
* * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
613
|
+
* Google model to determine the keyword-based overlap between the query and
|
614
|
+
* the document.
|
615
|
+
* * `base_rank`: the default rank of the result
|
616
|
+
* @param {google.cloud.discoveryengine.v1alpha.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
|
617
|
+
* The backend to use for the ranking expression evaluation.
|
552
618
|
* @param {boolean} request.safeSearch
|
553
619
|
* Whether to turn on safe search. This is only supported for
|
554
620
|
* website search.
|
@@ -815,8 +881,14 @@ class SearchServiceClient {
|
|
815
881
|
* The ranking expression controls the customized ranking on retrieval
|
816
882
|
* documents. This overrides
|
817
883
|
* {@link protos.google.cloud.discoveryengine.v1alpha.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
|
818
|
-
* The
|
819
|
-
*
|
884
|
+
* The syntax and supported features depend on the
|
885
|
+
* `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
886
|
+
* provided, it defaults to `RANK_BY_EMBEDDING`.
|
887
|
+
*
|
888
|
+
* If
|
889
|
+
* {@link protos.google.cloud.discoveryengine.v1alpha.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
890
|
+
* is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
891
|
+
* function or multiple functions that are joined by "+".
|
820
892
|
*
|
821
893
|
* * ranking_expression = function, { " + ", function };
|
822
894
|
*
|
@@ -831,13 +903,73 @@ class SearchServiceClient {
|
|
831
903
|
* between query and document.
|
832
904
|
* * `embedding_field_path`: the document embedding field
|
833
905
|
* used with query embedding vector.
|
834
|
-
* * `dotProduct`: embedding function between embedding_field_path and
|
835
|
-
* embedding vector.
|
906
|
+
* * `dotProduct`: embedding function between `embedding_field_path` and
|
907
|
+
* query embedding vector.
|
836
908
|
*
|
837
909
|
* Example ranking expression:
|
838
910
|
*
|
839
911
|
* If document has an embedding field doc_embedding, the ranking expression
|
840
912
|
* could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
913
|
+
*
|
914
|
+
* If
|
915
|
+
* {@link protos.google.cloud.discoveryengine.v1alpha.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
916
|
+
* is set to `RANK_BY_FORMULA`, the following expression types (and
|
917
|
+
* combinations of those chained using + or
|
918
|
+
* * operators) are supported:
|
919
|
+
*
|
920
|
+
* * `double`
|
921
|
+
* * `signal`
|
922
|
+
* * `log(signal)`
|
923
|
+
* * `exp(signal)`
|
924
|
+
* * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
925
|
+
* argument being a denominator constant.
|
926
|
+
* * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
927
|
+
* * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
928
|
+
* signal2 | double, else returns signal1.
|
929
|
+
*
|
930
|
+
* Here are a few examples of ranking formulas that use the supported
|
931
|
+
* ranking expression types:
|
932
|
+
*
|
933
|
+
* - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
934
|
+
* -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
935
|
+
* `semantic_smilarity_score` adjustment.
|
936
|
+
* - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
937
|
+
* is_nan(keyword_similarity_score)` -- rank by the exponent of
|
938
|
+
* `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
939
|
+
* add constant 0.3 adjustment to the final score if
|
940
|
+
* `semantic_similarity_score` is NaN.
|
941
|
+
* - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
942
|
+
* rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
943
|
+
* of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
944
|
+
* of `semantic_smilarity_score`.
|
945
|
+
*
|
946
|
+
* The following signals are supported:
|
947
|
+
*
|
948
|
+
* * `semantic_similarity_score`: semantic similarity adjustment that is
|
949
|
+
* calculated using the embeddings generated by a proprietary Google model.
|
950
|
+
* This score determines how semantically similar a search query is to a
|
951
|
+
* document.
|
952
|
+
* * `keyword_similarity_score`: keyword match adjustment uses the Best
|
953
|
+
* Match 25 (BM25) ranking function. This score is calculated using a
|
954
|
+
* probabilistic model to estimate the probability that a document is
|
955
|
+
* relevant to a given query.
|
956
|
+
* * `relevance_score`: semantic relevance adjustment that uses a
|
957
|
+
* proprietary Google model to determine the meaning and intent behind a
|
958
|
+
* user's query in context with the content in the documents.
|
959
|
+
* * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
960
|
+
* predicted Click-through rate (pCTR) to gauge the relevance and
|
961
|
+
* attractiveness of a search result from a user's perspective. A higher
|
962
|
+
* pCTR suggests that the result is more likely to satisfy the user's query
|
963
|
+
* and intent, making it a valuable signal for ranking.
|
964
|
+
* * `freshness_rank`: freshness adjustment as a rank
|
965
|
+
* * `document_age`: The time in hours elapsed since the document was last
|
966
|
+
* updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
967
|
+
* * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
968
|
+
* Google model to determine the keyword-based overlap between the query and
|
969
|
+
* the document.
|
970
|
+
* * `base_rank`: the default rank of the result
|
971
|
+
* @param {google.cloud.discoveryengine.v1alpha.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
|
972
|
+
* The backend to use for the ranking expression evaluation.
|
841
973
|
* @param {boolean} request.safeSearch
|
842
974
|
* Whether to turn on safe search. This is only supported for
|
843
975
|
* website search.
|