@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.
@@ -296,8 +296,14 @@ export declare class SearchServiceClient {
296
296
  * The ranking expression controls the customized ranking on retrieval
297
297
  * documents. This overrides
298
298
  * {@link protos.google.cloud.discoveryengine.v1beta.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
299
- * The ranking expression is a single function or multiple functions that are
300
- * joined by "+".
299
+ * The syntax and supported features depend on the
300
+ * `ranking_expression_backend` value. If `ranking_expression_backend` is not
301
+ * provided, it defaults to `RANK_BY_EMBEDDING`.
302
+ *
303
+ * If
304
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
305
+ * is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
306
+ * function or multiple functions that are joined by "+".
301
307
  *
302
308
  * * ranking_expression = function, { " + ", function };
303
309
  *
@@ -312,13 +318,73 @@ export declare class SearchServiceClient {
312
318
  * between query and document.
313
319
  * * `embedding_field_path`: the document embedding field
314
320
  * used with query embedding vector.
315
- * * `dotProduct`: embedding function between embedding_field_path and query
316
- * embedding vector.
321
+ * * `dotProduct`: embedding function between `embedding_field_path` and
322
+ * query embedding vector.
317
323
  *
318
324
  * Example ranking expression:
319
325
  *
320
326
  * If document has an embedding field doc_embedding, the ranking expression
321
327
  * could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
328
+ *
329
+ * If
330
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
331
+ * is set to `RANK_BY_FORMULA`, the following expression types (and
332
+ * combinations of those chained using + or
333
+ * * operators) are supported:
334
+ *
335
+ * * `double`
336
+ * * `signal`
337
+ * * `log(signal)`
338
+ * * `exp(signal)`
339
+ * * `rr(signal, double > 0)` -- reciprocal rank transformation with second
340
+ * argument being a denominator constant.
341
+ * * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
342
+ * * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
343
+ * signal2 | double, else returns signal1.
344
+ *
345
+ * Here are a few examples of ranking formulas that use the supported
346
+ * ranking expression types:
347
+ *
348
+ * - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
349
+ * -- mostly rank by the logarithm of `keyword_similarity_score` with slight
350
+ * `semantic_smilarity_score` adjustment.
351
+ * - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
352
+ * is_nan(keyword_similarity_score)` -- rank by the exponent of
353
+ * `semantic_similarity_score` filling the value with 0 if it's NaN, also
354
+ * add constant 0.3 adjustment to the final score if
355
+ * `semantic_similarity_score` is NaN.
356
+ * - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
357
+ * rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
358
+ * of `keyword_similarity_score` with slight adjustment of reciprocal rank
359
+ * of `semantic_smilarity_score`.
360
+ *
361
+ * The following signals are supported:
362
+ *
363
+ * * `semantic_similarity_score`: semantic similarity adjustment that is
364
+ * calculated using the embeddings generated by a proprietary Google model.
365
+ * This score determines how semantically similar a search query is to a
366
+ * document.
367
+ * * `keyword_similarity_score`: keyword match adjustment uses the Best
368
+ * Match 25 (BM25) ranking function. This score is calculated using a
369
+ * probabilistic model to estimate the probability that a document is
370
+ * relevant to a given query.
371
+ * * `relevance_score`: semantic relevance adjustment that uses a
372
+ * proprietary Google model to determine the meaning and intent behind a
373
+ * user's query in context with the content in the documents.
374
+ * * `pctr_rank`: predicted conversion rate adjustment as a rank use
375
+ * predicted Click-through rate (pCTR) to gauge the relevance and
376
+ * attractiveness of a search result from a user's perspective. A higher
377
+ * pCTR suggests that the result is more likely to satisfy the user's query
378
+ * and intent, making it a valuable signal for ranking.
379
+ * * `freshness_rank`: freshness adjustment as a rank
380
+ * * `document_age`: The time in hours elapsed since the document was last
381
+ * updated, a floating-point number (e.g., 0.25 means 15 minutes).
382
+ * * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
383
+ * Google model to determine the keyword-based overlap between the query and
384
+ * the document.
385
+ * * `base_rank`: the default rank of the result
386
+ * @param {google.cloud.discoveryengine.v1beta.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
387
+ * The backend to use for the ranking expression evaluation.
322
388
  * @param {boolean} request.safeSearch
323
389
  * Whether to turn on safe search. This is only supported for
324
390
  * website search.
@@ -587,8 +653,14 @@ export declare class SearchServiceClient {
587
653
  * The ranking expression controls the customized ranking on retrieval
588
654
  * documents. This overrides
589
655
  * {@link protos.google.cloud.discoveryengine.v1beta.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
590
- * The ranking expression is a single function or multiple functions that are
591
- * joined by "+".
656
+ * The syntax and supported features depend on the
657
+ * `ranking_expression_backend` value. If `ranking_expression_backend` is not
658
+ * provided, it defaults to `RANK_BY_EMBEDDING`.
659
+ *
660
+ * If
661
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
662
+ * is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
663
+ * function or multiple functions that are joined by "+".
592
664
  *
593
665
  * * ranking_expression = function, { " + ", function };
594
666
  *
@@ -603,13 +675,73 @@ export declare class SearchServiceClient {
603
675
  * between query and document.
604
676
  * * `embedding_field_path`: the document embedding field
605
677
  * used with query embedding vector.
606
- * * `dotProduct`: embedding function between embedding_field_path and query
607
- * embedding vector.
678
+ * * `dotProduct`: embedding function between `embedding_field_path` and
679
+ * query embedding vector.
608
680
  *
609
681
  * Example ranking expression:
610
682
  *
611
683
  * If document has an embedding field doc_embedding, the ranking expression
612
684
  * could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
685
+ *
686
+ * If
687
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
688
+ * is set to `RANK_BY_FORMULA`, the following expression types (and
689
+ * combinations of those chained using + or
690
+ * * operators) are supported:
691
+ *
692
+ * * `double`
693
+ * * `signal`
694
+ * * `log(signal)`
695
+ * * `exp(signal)`
696
+ * * `rr(signal, double > 0)` -- reciprocal rank transformation with second
697
+ * argument being a denominator constant.
698
+ * * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
699
+ * * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
700
+ * signal2 | double, else returns signal1.
701
+ *
702
+ * Here are a few examples of ranking formulas that use the supported
703
+ * ranking expression types:
704
+ *
705
+ * - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
706
+ * -- mostly rank by the logarithm of `keyword_similarity_score` with slight
707
+ * `semantic_smilarity_score` adjustment.
708
+ * - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
709
+ * is_nan(keyword_similarity_score)` -- rank by the exponent of
710
+ * `semantic_similarity_score` filling the value with 0 if it's NaN, also
711
+ * add constant 0.3 adjustment to the final score if
712
+ * `semantic_similarity_score` is NaN.
713
+ * - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
714
+ * rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
715
+ * of `keyword_similarity_score` with slight adjustment of reciprocal rank
716
+ * of `semantic_smilarity_score`.
717
+ *
718
+ * The following signals are supported:
719
+ *
720
+ * * `semantic_similarity_score`: semantic similarity adjustment that is
721
+ * calculated using the embeddings generated by a proprietary Google model.
722
+ * This score determines how semantically similar a search query is to a
723
+ * document.
724
+ * * `keyword_similarity_score`: keyword match adjustment uses the Best
725
+ * Match 25 (BM25) ranking function. This score is calculated using a
726
+ * probabilistic model to estimate the probability that a document is
727
+ * relevant to a given query.
728
+ * * `relevance_score`: semantic relevance adjustment that uses a
729
+ * proprietary Google model to determine the meaning and intent behind a
730
+ * user's query in context with the content in the documents.
731
+ * * `pctr_rank`: predicted conversion rate adjustment as a rank use
732
+ * predicted Click-through rate (pCTR) to gauge the relevance and
733
+ * attractiveness of a search result from a user's perspective. A higher
734
+ * pCTR suggests that the result is more likely to satisfy the user's query
735
+ * and intent, making it a valuable signal for ranking.
736
+ * * `freshness_rank`: freshness adjustment as a rank
737
+ * * `document_age`: The time in hours elapsed since the document was last
738
+ * updated, a floating-point number (e.g., 0.25 means 15 minutes).
739
+ * * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
740
+ * Google model to determine the keyword-based overlap between the query and
741
+ * the document.
742
+ * * `base_rank`: the default rank of the result
743
+ * @param {google.cloud.discoveryengine.v1beta.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
744
+ * The backend to use for the ranking expression evaluation.
613
745
  * @param {boolean} request.safeSearch
614
746
  * Whether to turn on safe search. This is only supported for
615
747
  * website search.
@@ -873,8 +1005,14 @@ export declare class SearchServiceClient {
873
1005
  * The ranking expression controls the customized ranking on retrieval
874
1006
  * documents. This overrides
875
1007
  * {@link protos.google.cloud.discoveryengine.v1beta.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
876
- * The ranking expression is a single function or multiple functions that are
877
- * joined by "+".
1008
+ * The syntax and supported features depend on the
1009
+ * `ranking_expression_backend` value. If `ranking_expression_backend` is not
1010
+ * provided, it defaults to `RANK_BY_EMBEDDING`.
1011
+ *
1012
+ * If
1013
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
1014
+ * is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
1015
+ * function or multiple functions that are joined by "+".
878
1016
  *
879
1017
  * * ranking_expression = function, { " + ", function };
880
1018
  *
@@ -889,13 +1027,73 @@ export declare class SearchServiceClient {
889
1027
  * between query and document.
890
1028
  * * `embedding_field_path`: the document embedding field
891
1029
  * used with query embedding vector.
892
- * * `dotProduct`: embedding function between embedding_field_path and query
893
- * embedding vector.
1030
+ * * `dotProduct`: embedding function between `embedding_field_path` and
1031
+ * query embedding vector.
894
1032
  *
895
1033
  * Example ranking expression:
896
1034
  *
897
1035
  * If document has an embedding field doc_embedding, the ranking expression
898
1036
  * could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
1037
+ *
1038
+ * If
1039
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
1040
+ * is set to `RANK_BY_FORMULA`, the following expression types (and
1041
+ * combinations of those chained using + or
1042
+ * * operators) are supported:
1043
+ *
1044
+ * * `double`
1045
+ * * `signal`
1046
+ * * `log(signal)`
1047
+ * * `exp(signal)`
1048
+ * * `rr(signal, double > 0)` -- reciprocal rank transformation with second
1049
+ * argument being a denominator constant.
1050
+ * * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
1051
+ * * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
1052
+ * signal2 | double, else returns signal1.
1053
+ *
1054
+ * Here are a few examples of ranking formulas that use the supported
1055
+ * ranking expression types:
1056
+ *
1057
+ * - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
1058
+ * -- mostly rank by the logarithm of `keyword_similarity_score` with slight
1059
+ * `semantic_smilarity_score` adjustment.
1060
+ * - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
1061
+ * is_nan(keyword_similarity_score)` -- rank by the exponent of
1062
+ * `semantic_similarity_score` filling the value with 0 if it's NaN, also
1063
+ * add constant 0.3 adjustment to the final score if
1064
+ * `semantic_similarity_score` is NaN.
1065
+ * - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
1066
+ * rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
1067
+ * of `keyword_similarity_score` with slight adjustment of reciprocal rank
1068
+ * of `semantic_smilarity_score`.
1069
+ *
1070
+ * The following signals are supported:
1071
+ *
1072
+ * * `semantic_similarity_score`: semantic similarity adjustment that is
1073
+ * calculated using the embeddings generated by a proprietary Google model.
1074
+ * This score determines how semantically similar a search query is to a
1075
+ * document.
1076
+ * * `keyword_similarity_score`: keyword match adjustment uses the Best
1077
+ * Match 25 (BM25) ranking function. This score is calculated using a
1078
+ * probabilistic model to estimate the probability that a document is
1079
+ * relevant to a given query.
1080
+ * * `relevance_score`: semantic relevance adjustment that uses a
1081
+ * proprietary Google model to determine the meaning and intent behind a
1082
+ * user's query in context with the content in the documents.
1083
+ * * `pctr_rank`: predicted conversion rate adjustment as a rank use
1084
+ * predicted Click-through rate (pCTR) to gauge the relevance and
1085
+ * attractiveness of a search result from a user's perspective. A higher
1086
+ * pCTR suggests that the result is more likely to satisfy the user's query
1087
+ * and intent, making it a valuable signal for ranking.
1088
+ * * `freshness_rank`: freshness adjustment as a rank
1089
+ * * `document_age`: The time in hours elapsed since the document was last
1090
+ * updated, a floating-point number (e.g., 0.25 means 15 minutes).
1091
+ * * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
1092
+ * Google model to determine the keyword-based overlap between the query and
1093
+ * the document.
1094
+ * * `base_rank`: the default rank of the result
1095
+ * @param {google.cloud.discoveryengine.v1beta.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
1096
+ * The backend to use for the ranking expression evaluation.
899
1097
  * @param {boolean} request.safeSearch
900
1098
  * Whether to turn on safe search. This is only supported for
901
1099
  * website search.
@@ -1171,8 +1369,14 @@ export declare class SearchServiceClient {
1171
1369
  * The ranking expression controls the customized ranking on retrieval
1172
1370
  * documents. This overrides
1173
1371
  * {@link protos.google.cloud.discoveryengine.v1beta.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
1174
- * The ranking expression is a single function or multiple functions that are
1175
- * joined by "+".
1372
+ * The syntax and supported features depend on the
1373
+ * `ranking_expression_backend` value. If `ranking_expression_backend` is not
1374
+ * provided, it defaults to `RANK_BY_EMBEDDING`.
1375
+ *
1376
+ * If
1377
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
1378
+ * is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
1379
+ * function or multiple functions that are joined by "+".
1176
1380
  *
1177
1381
  * * ranking_expression = function, { " + ", function };
1178
1382
  *
@@ -1187,13 +1391,73 @@ export declare class SearchServiceClient {
1187
1391
  * between query and document.
1188
1392
  * * `embedding_field_path`: the document embedding field
1189
1393
  * used with query embedding vector.
1190
- * * `dotProduct`: embedding function between embedding_field_path and query
1191
- * embedding vector.
1394
+ * * `dotProduct`: embedding function between `embedding_field_path` and
1395
+ * query embedding vector.
1192
1396
  *
1193
1397
  * Example ranking expression:
1194
1398
  *
1195
1399
  * If document has an embedding field doc_embedding, the ranking expression
1196
1400
  * could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
1401
+ *
1402
+ * If
1403
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
1404
+ * is set to `RANK_BY_FORMULA`, the following expression types (and
1405
+ * combinations of those chained using + or
1406
+ * * operators) are supported:
1407
+ *
1408
+ * * `double`
1409
+ * * `signal`
1410
+ * * `log(signal)`
1411
+ * * `exp(signal)`
1412
+ * * `rr(signal, double > 0)` -- reciprocal rank transformation with second
1413
+ * argument being a denominator constant.
1414
+ * * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
1415
+ * * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
1416
+ * signal2 | double, else returns signal1.
1417
+ *
1418
+ * Here are a few examples of ranking formulas that use the supported
1419
+ * ranking expression types:
1420
+ *
1421
+ * - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
1422
+ * -- mostly rank by the logarithm of `keyword_similarity_score` with slight
1423
+ * `semantic_smilarity_score` adjustment.
1424
+ * - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
1425
+ * is_nan(keyword_similarity_score)` -- rank by the exponent of
1426
+ * `semantic_similarity_score` filling the value with 0 if it's NaN, also
1427
+ * add constant 0.3 adjustment to the final score if
1428
+ * `semantic_similarity_score` is NaN.
1429
+ * - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
1430
+ * rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
1431
+ * of `keyword_similarity_score` with slight adjustment of reciprocal rank
1432
+ * of `semantic_smilarity_score`.
1433
+ *
1434
+ * The following signals are supported:
1435
+ *
1436
+ * * `semantic_similarity_score`: semantic similarity adjustment that is
1437
+ * calculated using the embeddings generated by a proprietary Google model.
1438
+ * This score determines how semantically similar a search query is to a
1439
+ * document.
1440
+ * * `keyword_similarity_score`: keyword match adjustment uses the Best
1441
+ * Match 25 (BM25) ranking function. This score is calculated using a
1442
+ * probabilistic model to estimate the probability that a document is
1443
+ * relevant to a given query.
1444
+ * * `relevance_score`: semantic relevance adjustment that uses a
1445
+ * proprietary Google model to determine the meaning and intent behind a
1446
+ * user's query in context with the content in the documents.
1447
+ * * `pctr_rank`: predicted conversion rate adjustment as a rank use
1448
+ * predicted Click-through rate (pCTR) to gauge the relevance and
1449
+ * attractiveness of a search result from a user's perspective. A higher
1450
+ * pCTR suggests that the result is more likely to satisfy the user's query
1451
+ * and intent, making it a valuable signal for ranking.
1452
+ * * `freshness_rank`: freshness adjustment as a rank
1453
+ * * `document_age`: The time in hours elapsed since the document was last
1454
+ * updated, a floating-point number (e.g., 0.25 means 15 minutes).
1455
+ * * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
1456
+ * Google model to determine the keyword-based overlap between the query and
1457
+ * the document.
1458
+ * * `base_rank`: the default rank of the result
1459
+ * @param {google.cloud.discoveryengine.v1beta.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
1460
+ * The backend to use for the ranking expression evaluation.
1197
1461
  * @param {boolean} request.safeSearch
1198
1462
  * Whether to turn on safe search. This is only supported for
1199
1463
  * website search.
@@ -1462,8 +1726,14 @@ export declare class SearchServiceClient {
1462
1726
  * The ranking expression controls the customized ranking on retrieval
1463
1727
  * documents. This overrides
1464
1728
  * {@link protos.google.cloud.discoveryengine.v1beta.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
1465
- * The ranking expression is a single function or multiple functions that are
1466
- * joined by "+".
1729
+ * The syntax and supported features depend on the
1730
+ * `ranking_expression_backend` value. If `ranking_expression_backend` is not
1731
+ * provided, it defaults to `RANK_BY_EMBEDDING`.
1732
+ *
1733
+ * If
1734
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
1735
+ * is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
1736
+ * function or multiple functions that are joined by "+".
1467
1737
  *
1468
1738
  * * ranking_expression = function, { " + ", function };
1469
1739
  *
@@ -1478,13 +1748,73 @@ export declare class SearchServiceClient {
1478
1748
  * between query and document.
1479
1749
  * * `embedding_field_path`: the document embedding field
1480
1750
  * used with query embedding vector.
1481
- * * `dotProduct`: embedding function between embedding_field_path and query
1482
- * embedding vector.
1751
+ * * `dotProduct`: embedding function between `embedding_field_path` and
1752
+ * query embedding vector.
1483
1753
  *
1484
1754
  * Example ranking expression:
1485
1755
  *
1486
1756
  * If document has an embedding field doc_embedding, the ranking expression
1487
1757
  * could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
1758
+ *
1759
+ * If
1760
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
1761
+ * is set to `RANK_BY_FORMULA`, the following expression types (and
1762
+ * combinations of those chained using + or
1763
+ * * operators) are supported:
1764
+ *
1765
+ * * `double`
1766
+ * * `signal`
1767
+ * * `log(signal)`
1768
+ * * `exp(signal)`
1769
+ * * `rr(signal, double > 0)` -- reciprocal rank transformation with second
1770
+ * argument being a denominator constant.
1771
+ * * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
1772
+ * * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
1773
+ * signal2 | double, else returns signal1.
1774
+ *
1775
+ * Here are a few examples of ranking formulas that use the supported
1776
+ * ranking expression types:
1777
+ *
1778
+ * - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
1779
+ * -- mostly rank by the logarithm of `keyword_similarity_score` with slight
1780
+ * `semantic_smilarity_score` adjustment.
1781
+ * - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
1782
+ * is_nan(keyword_similarity_score)` -- rank by the exponent of
1783
+ * `semantic_similarity_score` filling the value with 0 if it's NaN, also
1784
+ * add constant 0.3 adjustment to the final score if
1785
+ * `semantic_similarity_score` is NaN.
1786
+ * - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
1787
+ * rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
1788
+ * of `keyword_similarity_score` with slight adjustment of reciprocal rank
1789
+ * of `semantic_smilarity_score`.
1790
+ *
1791
+ * The following signals are supported:
1792
+ *
1793
+ * * `semantic_similarity_score`: semantic similarity adjustment that is
1794
+ * calculated using the embeddings generated by a proprietary Google model.
1795
+ * This score determines how semantically similar a search query is to a
1796
+ * document.
1797
+ * * `keyword_similarity_score`: keyword match adjustment uses the Best
1798
+ * Match 25 (BM25) ranking function. This score is calculated using a
1799
+ * probabilistic model to estimate the probability that a document is
1800
+ * relevant to a given query.
1801
+ * * `relevance_score`: semantic relevance adjustment that uses a
1802
+ * proprietary Google model to determine the meaning and intent behind a
1803
+ * user's query in context with the content in the documents.
1804
+ * * `pctr_rank`: predicted conversion rate adjustment as a rank use
1805
+ * predicted Click-through rate (pCTR) to gauge the relevance and
1806
+ * attractiveness of a search result from a user's perspective. A higher
1807
+ * pCTR suggests that the result is more likely to satisfy the user's query
1808
+ * and intent, making it a valuable signal for ranking.
1809
+ * * `freshness_rank`: freshness adjustment as a rank
1810
+ * * `document_age`: The time in hours elapsed since the document was last
1811
+ * updated, a floating-point number (e.g., 0.25 means 15 minutes).
1812
+ * * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
1813
+ * Google model to determine the keyword-based overlap between the query and
1814
+ * the document.
1815
+ * * `base_rank`: the default rank of the result
1816
+ * @param {google.cloud.discoveryengine.v1beta.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
1817
+ * The backend to use for the ranking expression evaluation.
1488
1818
  * @param {boolean} request.safeSearch
1489
1819
  * Whether to turn on safe search. This is only supported for
1490
1820
  * website search.
@@ -1748,8 +2078,14 @@ export declare class SearchServiceClient {
1748
2078
  * The ranking expression controls the customized ranking on retrieval
1749
2079
  * documents. This overrides
1750
2080
  * {@link protos.google.cloud.discoveryengine.v1beta.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
1751
- * The ranking expression is a single function or multiple functions that are
1752
- * joined by "+".
2081
+ * The syntax and supported features depend on the
2082
+ * `ranking_expression_backend` value. If `ranking_expression_backend` is not
2083
+ * provided, it defaults to `RANK_BY_EMBEDDING`.
2084
+ *
2085
+ * If
2086
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
2087
+ * is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
2088
+ * function or multiple functions that are joined by "+".
1753
2089
  *
1754
2090
  * * ranking_expression = function, { " + ", function };
1755
2091
  *
@@ -1764,13 +2100,73 @@ export declare class SearchServiceClient {
1764
2100
  * between query and document.
1765
2101
  * * `embedding_field_path`: the document embedding field
1766
2102
  * used with query embedding vector.
1767
- * * `dotProduct`: embedding function between embedding_field_path and query
1768
- * embedding vector.
2103
+ * * `dotProduct`: embedding function between `embedding_field_path` and
2104
+ * query embedding vector.
1769
2105
  *
1770
2106
  * Example ranking expression:
1771
2107
  *
1772
2108
  * If document has an embedding field doc_embedding, the ranking expression
1773
2109
  * could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
2110
+ *
2111
+ * If
2112
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
2113
+ * is set to `RANK_BY_FORMULA`, the following expression types (and
2114
+ * combinations of those chained using + or
2115
+ * * operators) are supported:
2116
+ *
2117
+ * * `double`
2118
+ * * `signal`
2119
+ * * `log(signal)`
2120
+ * * `exp(signal)`
2121
+ * * `rr(signal, double > 0)` -- reciprocal rank transformation with second
2122
+ * argument being a denominator constant.
2123
+ * * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
2124
+ * * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
2125
+ * signal2 | double, else returns signal1.
2126
+ *
2127
+ * Here are a few examples of ranking formulas that use the supported
2128
+ * ranking expression types:
2129
+ *
2130
+ * - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
2131
+ * -- mostly rank by the logarithm of `keyword_similarity_score` with slight
2132
+ * `semantic_smilarity_score` adjustment.
2133
+ * - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
2134
+ * is_nan(keyword_similarity_score)` -- rank by the exponent of
2135
+ * `semantic_similarity_score` filling the value with 0 if it's NaN, also
2136
+ * add constant 0.3 adjustment to the final score if
2137
+ * `semantic_similarity_score` is NaN.
2138
+ * - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
2139
+ * rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
2140
+ * of `keyword_similarity_score` with slight adjustment of reciprocal rank
2141
+ * of `semantic_smilarity_score`.
2142
+ *
2143
+ * The following signals are supported:
2144
+ *
2145
+ * * `semantic_similarity_score`: semantic similarity adjustment that is
2146
+ * calculated using the embeddings generated by a proprietary Google model.
2147
+ * This score determines how semantically similar a search query is to a
2148
+ * document.
2149
+ * * `keyword_similarity_score`: keyword match adjustment uses the Best
2150
+ * Match 25 (BM25) ranking function. This score is calculated using a
2151
+ * probabilistic model to estimate the probability that a document is
2152
+ * relevant to a given query.
2153
+ * * `relevance_score`: semantic relevance adjustment that uses a
2154
+ * proprietary Google model to determine the meaning and intent behind a
2155
+ * user's query in context with the content in the documents.
2156
+ * * `pctr_rank`: predicted conversion rate adjustment as a rank use
2157
+ * predicted Click-through rate (pCTR) to gauge the relevance and
2158
+ * attractiveness of a search result from a user's perspective. A higher
2159
+ * pCTR suggests that the result is more likely to satisfy the user's query
2160
+ * and intent, making it a valuable signal for ranking.
2161
+ * * `freshness_rank`: freshness adjustment as a rank
2162
+ * * `document_age`: The time in hours elapsed since the document was last
2163
+ * updated, a floating-point number (e.g., 0.25 means 15 minutes).
2164
+ * * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
2165
+ * Google model to determine the keyword-based overlap between the query and
2166
+ * the document.
2167
+ * * `base_rank`: the default rank of the result
2168
+ * @param {google.cloud.discoveryengine.v1beta.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
2169
+ * The backend to use for the ranking expression evaluation.
1774
2170
  * @param {boolean} request.safeSearch
1775
2171
  * Whether to turn on safe search. This is only supported for
1776
2172
  * website search.