@google-cloud/discoveryengine 2.4.0 → 2.5.0

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.
@@ -532,8 +532,14 @@ class SearchServiceClient {
532
532
  * The ranking expression controls the customized ranking on retrieval
533
533
  * documents. This overrides
534
534
  * {@link protos.google.cloud.discoveryengine.v1beta.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
535
- * The ranking expression is a single function or multiple functions that are
536
- * joined by "+".
535
+ * The syntax and supported features depend on the
536
+ * `ranking_expression_backend` value. If `ranking_expression_backend` is not
537
+ * provided, it defaults to `RANK_BY_EMBEDDING`.
538
+ *
539
+ * If
540
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
541
+ * is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
542
+ * function or multiple functions that are joined by "+".
537
543
  *
538
544
  * * ranking_expression = function, { " + ", function };
539
545
  *
@@ -548,13 +554,73 @@ class SearchServiceClient {
548
554
  * between query and document.
549
555
  * * `embedding_field_path`: the document embedding field
550
556
  * used with query embedding vector.
551
- * * `dotProduct`: embedding function between embedding_field_path and query
552
- * embedding vector.
557
+ * * `dotProduct`: embedding function between `embedding_field_path` and
558
+ * query embedding vector.
553
559
  *
554
560
  * Example ranking expression:
555
561
  *
556
562
  * If document has an embedding field doc_embedding, the ranking expression
557
563
  * could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
564
+ *
565
+ * If
566
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
567
+ * is set to `RANK_BY_FORMULA`, the following expression types (and
568
+ * combinations of those chained using + or
569
+ * * operators) are supported:
570
+ *
571
+ * * `double`
572
+ * * `signal`
573
+ * * `log(signal)`
574
+ * * `exp(signal)`
575
+ * * `rr(signal, double > 0)` -- reciprocal rank transformation with second
576
+ * argument being a denominator constant.
577
+ * * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
578
+ * * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
579
+ * signal2 | double, else returns signal1.
580
+ *
581
+ * Here are a few examples of ranking formulas that use the supported
582
+ * ranking expression types:
583
+ *
584
+ * - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
585
+ * -- mostly rank by the logarithm of `keyword_similarity_score` with slight
586
+ * `semantic_smilarity_score` adjustment.
587
+ * - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
588
+ * is_nan(keyword_similarity_score)` -- rank by the exponent of
589
+ * `semantic_similarity_score` filling the value with 0 if it's NaN, also
590
+ * add constant 0.3 adjustment to the final score if
591
+ * `semantic_similarity_score` is NaN.
592
+ * - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
593
+ * rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
594
+ * of `keyword_similarity_score` with slight adjustment of reciprocal rank
595
+ * of `semantic_smilarity_score`.
596
+ *
597
+ * The following signals are supported:
598
+ *
599
+ * * `semantic_similarity_score`: semantic similarity adjustment that is
600
+ * calculated using the embeddings generated by a proprietary Google model.
601
+ * This score determines how semantically similar a search query is to a
602
+ * document.
603
+ * * `keyword_similarity_score`: keyword match adjustment uses the Best
604
+ * Match 25 (BM25) ranking function. This score is calculated using a
605
+ * probabilistic model to estimate the probability that a document is
606
+ * relevant to a given query.
607
+ * * `relevance_score`: semantic relevance adjustment that uses a
608
+ * proprietary Google model to determine the meaning and intent behind a
609
+ * user's query in context with the content in the documents.
610
+ * * `pctr_rank`: predicted conversion rate adjustment as a rank use
611
+ * predicted Click-through rate (pCTR) to gauge the relevance and
612
+ * attractiveness of a search result from a user's perspective. A higher
613
+ * pCTR suggests that the result is more likely to satisfy the user's query
614
+ * and intent, making it a valuable signal for ranking.
615
+ * * `freshness_rank`: freshness adjustment as a rank
616
+ * * `document_age`: The time in hours elapsed since the document was last
617
+ * updated, a floating-point number (e.g., 0.25 means 15 minutes).
618
+ * * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
619
+ * Google model to determine the keyword-based overlap between the query and
620
+ * the document.
621
+ * * `base_rank`: the default rank of the result
622
+ * @param {google.cloud.discoveryengine.v1beta.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
623
+ * The backend to use for the ranking expression evaluation.
558
624
  * @param {boolean} request.safeSearch
559
625
  * Whether to turn on safe search. This is only supported for
560
626
  * website search.
@@ -831,8 +897,14 @@ class SearchServiceClient {
831
897
  * The ranking expression controls the customized ranking on retrieval
832
898
  * documents. This overrides
833
899
  * {@link protos.google.cloud.discoveryengine.v1beta.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
834
- * The ranking expression is a single function or multiple functions that are
835
- * joined by "+".
900
+ * The syntax and supported features depend on the
901
+ * `ranking_expression_backend` value. If `ranking_expression_backend` is not
902
+ * provided, it defaults to `RANK_BY_EMBEDDING`.
903
+ *
904
+ * If
905
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
906
+ * is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
907
+ * function or multiple functions that are joined by "+".
836
908
  *
837
909
  * * ranking_expression = function, { " + ", function };
838
910
  *
@@ -847,13 +919,73 @@ class SearchServiceClient {
847
919
  * between query and document.
848
920
  * * `embedding_field_path`: the document embedding field
849
921
  * used with query embedding vector.
850
- * * `dotProduct`: embedding function between embedding_field_path and query
851
- * embedding vector.
922
+ * * `dotProduct`: embedding function between `embedding_field_path` and
923
+ * query embedding vector.
852
924
  *
853
925
  * Example ranking expression:
854
926
  *
855
927
  * If document has an embedding field doc_embedding, the ranking expression
856
928
  * could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
929
+ *
930
+ * If
931
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
932
+ * is set to `RANK_BY_FORMULA`, the following expression types (and
933
+ * combinations of those chained using + or
934
+ * * operators) are supported:
935
+ *
936
+ * * `double`
937
+ * * `signal`
938
+ * * `log(signal)`
939
+ * * `exp(signal)`
940
+ * * `rr(signal, double > 0)` -- reciprocal rank transformation with second
941
+ * argument being a denominator constant.
942
+ * * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
943
+ * * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
944
+ * signal2 | double, else returns signal1.
945
+ *
946
+ * Here are a few examples of ranking formulas that use the supported
947
+ * ranking expression types:
948
+ *
949
+ * - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
950
+ * -- mostly rank by the logarithm of `keyword_similarity_score` with slight
951
+ * `semantic_smilarity_score` adjustment.
952
+ * - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
953
+ * is_nan(keyword_similarity_score)` -- rank by the exponent of
954
+ * `semantic_similarity_score` filling the value with 0 if it's NaN, also
955
+ * add constant 0.3 adjustment to the final score if
956
+ * `semantic_similarity_score` is NaN.
957
+ * - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
958
+ * rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
959
+ * of `keyword_similarity_score` with slight adjustment of reciprocal rank
960
+ * of `semantic_smilarity_score`.
961
+ *
962
+ * The following signals are supported:
963
+ *
964
+ * * `semantic_similarity_score`: semantic similarity adjustment that is
965
+ * calculated using the embeddings generated by a proprietary Google model.
966
+ * This score determines how semantically similar a search query is to a
967
+ * document.
968
+ * * `keyword_similarity_score`: keyword match adjustment uses the Best
969
+ * Match 25 (BM25) ranking function. This score is calculated using a
970
+ * probabilistic model to estimate the probability that a document is
971
+ * relevant to a given query.
972
+ * * `relevance_score`: semantic relevance adjustment that uses a
973
+ * proprietary Google model to determine the meaning and intent behind a
974
+ * user's query in context with the content in the documents.
975
+ * * `pctr_rank`: predicted conversion rate adjustment as a rank use
976
+ * predicted Click-through rate (pCTR) to gauge the relevance and
977
+ * attractiveness of a search result from a user's perspective. A higher
978
+ * pCTR suggests that the result is more likely to satisfy the user's query
979
+ * and intent, making it a valuable signal for ranking.
980
+ * * `freshness_rank`: freshness adjustment as a rank
981
+ * * `document_age`: The time in hours elapsed since the document was last
982
+ * updated, a floating-point number (e.g., 0.25 means 15 minutes).
983
+ * * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
984
+ * Google model to determine the keyword-based overlap between the query and
985
+ * the document.
986
+ * * `base_rank`: the default rank of the result
987
+ * @param {google.cloud.discoveryengine.v1beta.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
988
+ * The backend to use for the ranking expression evaluation.
857
989
  * @param {boolean} request.safeSearch
858
990
  * Whether to turn on safe search. This is only supported for
859
991
  * website search.
@@ -1160,8 +1292,14 @@ class SearchServiceClient {
1160
1292
  * The ranking expression controls the customized ranking on retrieval
1161
1293
  * documents. This overrides
1162
1294
  * {@link protos.google.cloud.discoveryengine.v1beta.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
1163
- * The ranking expression is a single function or multiple functions that are
1164
- * joined by "+".
1295
+ * The syntax and supported features depend on the
1296
+ * `ranking_expression_backend` value. If `ranking_expression_backend` is not
1297
+ * provided, it defaults to `RANK_BY_EMBEDDING`.
1298
+ *
1299
+ * If
1300
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
1301
+ * is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
1302
+ * function or multiple functions that are joined by "+".
1165
1303
  *
1166
1304
  * * ranking_expression = function, { " + ", function };
1167
1305
  *
@@ -1176,13 +1314,73 @@ class SearchServiceClient {
1176
1314
  * between query and document.
1177
1315
  * * `embedding_field_path`: the document embedding field
1178
1316
  * used with query embedding vector.
1179
- * * `dotProduct`: embedding function between embedding_field_path and query
1180
- * embedding vector.
1317
+ * * `dotProduct`: embedding function between `embedding_field_path` and
1318
+ * query embedding vector.
1181
1319
  *
1182
1320
  * Example ranking expression:
1183
1321
  *
1184
1322
  * If document has an embedding field doc_embedding, the ranking expression
1185
1323
  * could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
1324
+ *
1325
+ * If
1326
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
1327
+ * is set to `RANK_BY_FORMULA`, the following expression types (and
1328
+ * combinations of those chained using + or
1329
+ * * operators) are supported:
1330
+ *
1331
+ * * `double`
1332
+ * * `signal`
1333
+ * * `log(signal)`
1334
+ * * `exp(signal)`
1335
+ * * `rr(signal, double > 0)` -- reciprocal rank transformation with second
1336
+ * argument being a denominator constant.
1337
+ * * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
1338
+ * * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
1339
+ * signal2 | double, else returns signal1.
1340
+ *
1341
+ * Here are a few examples of ranking formulas that use the supported
1342
+ * ranking expression types:
1343
+ *
1344
+ * - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
1345
+ * -- mostly rank by the logarithm of `keyword_similarity_score` with slight
1346
+ * `semantic_smilarity_score` adjustment.
1347
+ * - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
1348
+ * is_nan(keyword_similarity_score)` -- rank by the exponent of
1349
+ * `semantic_similarity_score` filling the value with 0 if it's NaN, also
1350
+ * add constant 0.3 adjustment to the final score if
1351
+ * `semantic_similarity_score` is NaN.
1352
+ * - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
1353
+ * rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
1354
+ * of `keyword_similarity_score` with slight adjustment of reciprocal rank
1355
+ * of `semantic_smilarity_score`.
1356
+ *
1357
+ * The following signals are supported:
1358
+ *
1359
+ * * `semantic_similarity_score`: semantic similarity adjustment that is
1360
+ * calculated using the embeddings generated by a proprietary Google model.
1361
+ * This score determines how semantically similar a search query is to a
1362
+ * document.
1363
+ * * `keyword_similarity_score`: keyword match adjustment uses the Best
1364
+ * Match 25 (BM25) ranking function. This score is calculated using a
1365
+ * probabilistic model to estimate the probability that a document is
1366
+ * relevant to a given query.
1367
+ * * `relevance_score`: semantic relevance adjustment that uses a
1368
+ * proprietary Google model to determine the meaning and intent behind a
1369
+ * user's query in context with the content in the documents.
1370
+ * * `pctr_rank`: predicted conversion rate adjustment as a rank use
1371
+ * predicted Click-through rate (pCTR) to gauge the relevance and
1372
+ * attractiveness of a search result from a user's perspective. A higher
1373
+ * pCTR suggests that the result is more likely to satisfy the user's query
1374
+ * and intent, making it a valuable signal for ranking.
1375
+ * * `freshness_rank`: freshness adjustment as a rank
1376
+ * * `document_age`: The time in hours elapsed since the document was last
1377
+ * updated, a floating-point number (e.g., 0.25 means 15 minutes).
1378
+ * * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
1379
+ * Google model to determine the keyword-based overlap between the query and
1380
+ * the document.
1381
+ * * `base_rank`: the default rank of the result
1382
+ * @param {google.cloud.discoveryengine.v1beta.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
1383
+ * The backend to use for the ranking expression evaluation.
1186
1384
  * @param {boolean} request.safeSearch
1187
1385
  * Whether to turn on safe search. This is only supported for
1188
1386
  * website search.
@@ -1459,8 +1657,14 @@ class SearchServiceClient {
1459
1657
  * The ranking expression controls the customized ranking on retrieval
1460
1658
  * documents. This overrides
1461
1659
  * {@link protos.google.cloud.discoveryengine.v1beta.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
1462
- * The ranking expression is a single function or multiple functions that are
1463
- * joined by "+".
1660
+ * The syntax and supported features depend on the
1661
+ * `ranking_expression_backend` value. If `ranking_expression_backend` is not
1662
+ * provided, it defaults to `RANK_BY_EMBEDDING`.
1663
+ *
1664
+ * If
1665
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
1666
+ * is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
1667
+ * function or multiple functions that are joined by "+".
1464
1668
  *
1465
1669
  * * ranking_expression = function, { " + ", function };
1466
1670
  *
@@ -1475,13 +1679,73 @@ class SearchServiceClient {
1475
1679
  * between query and document.
1476
1680
  * * `embedding_field_path`: the document embedding field
1477
1681
  * used with query embedding vector.
1478
- * * `dotProduct`: embedding function between embedding_field_path and query
1479
- * embedding vector.
1682
+ * * `dotProduct`: embedding function between `embedding_field_path` and
1683
+ * query embedding vector.
1480
1684
  *
1481
1685
  * Example ranking expression:
1482
1686
  *
1483
1687
  * If document has an embedding field doc_embedding, the ranking expression
1484
1688
  * could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
1689
+ *
1690
+ * If
1691
+ * {@link protos.google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend|ranking_expression_backend}
1692
+ * is set to `RANK_BY_FORMULA`, the following expression types (and
1693
+ * combinations of those chained using + or
1694
+ * * operators) are supported:
1695
+ *
1696
+ * * `double`
1697
+ * * `signal`
1698
+ * * `log(signal)`
1699
+ * * `exp(signal)`
1700
+ * * `rr(signal, double > 0)` -- reciprocal rank transformation with second
1701
+ * argument being a denominator constant.
1702
+ * * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
1703
+ * * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
1704
+ * signal2 | double, else returns signal1.
1705
+ *
1706
+ * Here are a few examples of ranking formulas that use the supported
1707
+ * ranking expression types:
1708
+ *
1709
+ * - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
1710
+ * -- mostly rank by the logarithm of `keyword_similarity_score` with slight
1711
+ * `semantic_smilarity_score` adjustment.
1712
+ * - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
1713
+ * is_nan(keyword_similarity_score)` -- rank by the exponent of
1714
+ * `semantic_similarity_score` filling the value with 0 if it's NaN, also
1715
+ * add constant 0.3 adjustment to the final score if
1716
+ * `semantic_similarity_score` is NaN.
1717
+ * - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
1718
+ * rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
1719
+ * of `keyword_similarity_score` with slight adjustment of reciprocal rank
1720
+ * of `semantic_smilarity_score`.
1721
+ *
1722
+ * The following signals are supported:
1723
+ *
1724
+ * * `semantic_similarity_score`: semantic similarity adjustment that is
1725
+ * calculated using the embeddings generated by a proprietary Google model.
1726
+ * This score determines how semantically similar a search query is to a
1727
+ * document.
1728
+ * * `keyword_similarity_score`: keyword match adjustment uses the Best
1729
+ * Match 25 (BM25) ranking function. This score is calculated using a
1730
+ * probabilistic model to estimate the probability that a document is
1731
+ * relevant to a given query.
1732
+ * * `relevance_score`: semantic relevance adjustment that uses a
1733
+ * proprietary Google model to determine the meaning and intent behind a
1734
+ * user's query in context with the content in the documents.
1735
+ * * `pctr_rank`: predicted conversion rate adjustment as a rank use
1736
+ * predicted Click-through rate (pCTR) to gauge the relevance and
1737
+ * attractiveness of a search result from a user's perspective. A higher
1738
+ * pCTR suggests that the result is more likely to satisfy the user's query
1739
+ * and intent, making it a valuable signal for ranking.
1740
+ * * `freshness_rank`: freshness adjustment as a rank
1741
+ * * `document_age`: The time in hours elapsed since the document was last
1742
+ * updated, a floating-point number (e.g., 0.25 means 15 minutes).
1743
+ * * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
1744
+ * Google model to determine the keyword-based overlap between the query and
1745
+ * the document.
1746
+ * * `base_rank`: the default rank of the result
1747
+ * @param {google.cloud.discoveryengine.v1beta.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
1748
+ * The backend to use for the ranking expression evaluation.
1485
1749
  * @param {boolean} request.safeSearch
1486
1750
  * Whether to turn on safe search. This is only supported for
1487
1751
  * website search.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-cloud/discoveryengine",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Discovery Engine API client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",