@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
@@ -485,7 +485,7 @@ class IdentityMappingStoreServiceClient {
|
|
485
485
|
options.otherArgs = options.otherArgs || {};
|
486
486
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
487
487
|
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
488
|
-
'identity_mapping_store': request.identityMappingStore ?? '',
|
488
|
+
'identity_mapping_store': request.identityMappingStore?.toString() ?? '',
|
489
489
|
});
|
490
490
|
this.initialize().catch(err => { throw err; });
|
491
491
|
const wrappedCallback = callback
|
@@ -533,7 +533,7 @@ class IdentityMappingStoreServiceClient {
|
|
533
533
|
options.otherArgs = options.otherArgs || {};
|
534
534
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
535
535
|
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
536
|
-
'identity_mapping_store': request.identityMappingStore ?? '',
|
536
|
+
'identity_mapping_store': request.identityMappingStore?.toString() ?? '',
|
537
537
|
});
|
538
538
|
this.initialize().catch(err => { throw err; });
|
539
539
|
const wrappedCallback = callback
|
@@ -581,7 +581,7 @@ class IdentityMappingStoreServiceClient {
|
|
581
581
|
options.otherArgs = options.otherArgs || {};
|
582
582
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
583
583
|
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
584
|
-
'identity_mapping_store': request.identityMappingStore ?? '',
|
584
|
+
'identity_mapping_store': request.identityMappingStore?.toString() ?? '',
|
585
585
|
});
|
586
586
|
this.initialize().catch(err => { throw err; });
|
587
587
|
const wrappedCallback = callback
|
@@ -634,7 +634,7 @@ class IdentityMappingStoreServiceClient {
|
|
634
634
|
options.otherArgs = options.otherArgs || {};
|
635
635
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
636
636
|
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
637
|
-
'identity_mapping_store': request.identityMappingStore ?? '',
|
637
|
+
'identity_mapping_store': request.identityMappingStore?.toString() ?? '',
|
638
638
|
});
|
639
639
|
const defaultCallSettings = this._defaults['listIdentityMappings'];
|
640
640
|
const callSettings = defaultCallSettings.merge(options);
|
@@ -681,7 +681,7 @@ class IdentityMappingStoreServiceClient {
|
|
681
681
|
options.otherArgs = options.otherArgs || {};
|
682
682
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
683
683
|
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
684
|
-
'identity_mapping_store': request.identityMappingStore ?? '',
|
684
|
+
'identity_mapping_store': request.identityMappingStore?.toString() ?? '',
|
685
685
|
});
|
686
686
|
const defaultCallSettings = this._defaults['listIdentityMappings'];
|
687
687
|
const callSettings = defaultCallSettings.merge(options);
|
@@ -342,6 +342,99 @@ export declare class SearchServiceClient {
|
|
342
342
|
* This feature is not supported for healthcare search.
|
343
343
|
* @param {google.cloud.discoveryengine.v1.SearchRequest.RelevanceScoreSpec} [request.relevanceScoreSpec]
|
344
344
|
* Optional. The specification for returning the relevance score.
|
345
|
+
* @param {string} request.rankingExpression
|
346
|
+
* The ranking expression controls the customized ranking on retrieval
|
347
|
+
* documents. This overrides
|
348
|
+
* {@link protos.google.cloud.discoveryengine.v1.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
|
349
|
+
* The syntax and supported features depend on the
|
350
|
+
* `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
351
|
+
* provided, it defaults to `RANK_BY_EMBEDDING`.
|
352
|
+
*
|
353
|
+
* If
|
354
|
+
* {@link protos.google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
355
|
+
* is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
356
|
+
* function or multiple functions that are joined by "+".
|
357
|
+
*
|
358
|
+
* * ranking_expression = function, { " + ", function };
|
359
|
+
*
|
360
|
+
* Supported functions:
|
361
|
+
*
|
362
|
+
* * double * relevance_score
|
363
|
+
* * double * dotProduct(embedding_field_path)
|
364
|
+
*
|
365
|
+
* Function variables:
|
366
|
+
*
|
367
|
+
* * `relevance_score`: pre-defined keywords, used for measure relevance
|
368
|
+
* between query and document.
|
369
|
+
* * `embedding_field_path`: the document embedding field
|
370
|
+
* used with query embedding vector.
|
371
|
+
* * `dotProduct`: embedding function between `embedding_field_path` and
|
372
|
+
* query embedding vector.
|
373
|
+
*
|
374
|
+
* Example ranking expression:
|
375
|
+
*
|
376
|
+
* If document has an embedding field doc_embedding, the ranking expression
|
377
|
+
* could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
378
|
+
*
|
379
|
+
* If
|
380
|
+
* {@link protos.google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
381
|
+
* is set to `RANK_BY_FORMULA`, the following expression types (and
|
382
|
+
* combinations of those chained using + or
|
383
|
+
* * operators) are supported:
|
384
|
+
*
|
385
|
+
* * `double`
|
386
|
+
* * `signal`
|
387
|
+
* * `log(signal)`
|
388
|
+
* * `exp(signal)`
|
389
|
+
* * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
390
|
+
* argument being a denominator constant.
|
391
|
+
* * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
392
|
+
* * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
393
|
+
* signal2 | double, else returns signal1.
|
394
|
+
*
|
395
|
+
* Here are a few examples of ranking formulas that use the supported
|
396
|
+
* ranking expression types:
|
397
|
+
*
|
398
|
+
* - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
399
|
+
* -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
400
|
+
* `semantic_smilarity_score` adjustment.
|
401
|
+
* - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
402
|
+
* is_nan(keyword_similarity_score)` -- rank by the exponent of
|
403
|
+
* `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
404
|
+
* add constant 0.3 adjustment to the final score if
|
405
|
+
* `semantic_similarity_score` is NaN.
|
406
|
+
* - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
407
|
+
* rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
408
|
+
* of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
409
|
+
* of `semantic_smilarity_score`.
|
410
|
+
*
|
411
|
+
* The following signals are supported:
|
412
|
+
*
|
413
|
+
* * `semantic_similarity_score`: semantic similarity adjustment that is
|
414
|
+
* calculated using the embeddings generated by a proprietary Google model.
|
415
|
+
* This score determines how semantically similar a search query is to a
|
416
|
+
* document.
|
417
|
+
* * `keyword_similarity_score`: keyword match adjustment uses the Best
|
418
|
+
* Match 25 (BM25) ranking function. This score is calculated using a
|
419
|
+
* probabilistic model to estimate the probability that a document is
|
420
|
+
* relevant to a given query.
|
421
|
+
* * `relevance_score`: semantic relevance adjustment that uses a
|
422
|
+
* proprietary Google model to determine the meaning and intent behind a
|
423
|
+
* user's query in context with the content in the documents.
|
424
|
+
* * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
425
|
+
* predicted Click-through rate (pCTR) to gauge the relevance and
|
426
|
+
* attractiveness of a search result from a user's perspective. A higher
|
427
|
+
* pCTR suggests that the result is more likely to satisfy the user's query
|
428
|
+
* and intent, making it a valuable signal for ranking.
|
429
|
+
* * `freshness_rank`: freshness adjustment as a rank
|
430
|
+
* * `document_age`: The time in hours elapsed since the document was last
|
431
|
+
* updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
432
|
+
* * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
433
|
+
* Google model to determine the keyword-based overlap between the query and
|
434
|
+
* the document.
|
435
|
+
* * `base_rank`: the default rank of the result
|
436
|
+
* @param {google.cloud.discoveryengine.v1.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
|
437
|
+
* The backend to use for the ranking expression evaluation.
|
345
438
|
* @param {object} [options]
|
346
439
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
347
440
|
* @returns {Promise} - The promise which resolves to an array.
|
@@ -586,6 +679,99 @@ export declare class SearchServiceClient {
|
|
586
679
|
* This feature is not supported for healthcare search.
|
587
680
|
* @param {google.cloud.discoveryengine.v1.SearchRequest.RelevanceScoreSpec} [request.relevanceScoreSpec]
|
588
681
|
* Optional. The specification for returning the relevance score.
|
682
|
+
* @param {string} request.rankingExpression
|
683
|
+
* The ranking expression controls the customized ranking on retrieval
|
684
|
+
* documents. This overrides
|
685
|
+
* {@link protos.google.cloud.discoveryengine.v1.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
|
686
|
+
* The syntax and supported features depend on the
|
687
|
+
* `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
688
|
+
* provided, it defaults to `RANK_BY_EMBEDDING`.
|
689
|
+
*
|
690
|
+
* If
|
691
|
+
* {@link protos.google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
692
|
+
* is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
693
|
+
* function or multiple functions that are joined by "+".
|
694
|
+
*
|
695
|
+
* * ranking_expression = function, { " + ", function };
|
696
|
+
*
|
697
|
+
* Supported functions:
|
698
|
+
*
|
699
|
+
* * double * relevance_score
|
700
|
+
* * double * dotProduct(embedding_field_path)
|
701
|
+
*
|
702
|
+
* Function variables:
|
703
|
+
*
|
704
|
+
* * `relevance_score`: pre-defined keywords, used for measure relevance
|
705
|
+
* between query and document.
|
706
|
+
* * `embedding_field_path`: the document embedding field
|
707
|
+
* used with query embedding vector.
|
708
|
+
* * `dotProduct`: embedding function between `embedding_field_path` and
|
709
|
+
* query embedding vector.
|
710
|
+
*
|
711
|
+
* Example ranking expression:
|
712
|
+
*
|
713
|
+
* If document has an embedding field doc_embedding, the ranking expression
|
714
|
+
* could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
715
|
+
*
|
716
|
+
* If
|
717
|
+
* {@link protos.google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
718
|
+
* is set to `RANK_BY_FORMULA`, the following expression types (and
|
719
|
+
* combinations of those chained using + or
|
720
|
+
* * operators) are supported:
|
721
|
+
*
|
722
|
+
* * `double`
|
723
|
+
* * `signal`
|
724
|
+
* * `log(signal)`
|
725
|
+
* * `exp(signal)`
|
726
|
+
* * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
727
|
+
* argument being a denominator constant.
|
728
|
+
* * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
729
|
+
* * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
730
|
+
* signal2 | double, else returns signal1.
|
731
|
+
*
|
732
|
+
* Here are a few examples of ranking formulas that use the supported
|
733
|
+
* ranking expression types:
|
734
|
+
*
|
735
|
+
* - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
736
|
+
* -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
737
|
+
* `semantic_smilarity_score` adjustment.
|
738
|
+
* - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
739
|
+
* is_nan(keyword_similarity_score)` -- rank by the exponent of
|
740
|
+
* `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
741
|
+
* add constant 0.3 adjustment to the final score if
|
742
|
+
* `semantic_similarity_score` is NaN.
|
743
|
+
* - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
744
|
+
* rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
745
|
+
* of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
746
|
+
* of `semantic_smilarity_score`.
|
747
|
+
*
|
748
|
+
* The following signals are supported:
|
749
|
+
*
|
750
|
+
* * `semantic_similarity_score`: semantic similarity adjustment that is
|
751
|
+
* calculated using the embeddings generated by a proprietary Google model.
|
752
|
+
* This score determines how semantically similar a search query is to a
|
753
|
+
* document.
|
754
|
+
* * `keyword_similarity_score`: keyword match adjustment uses the Best
|
755
|
+
* Match 25 (BM25) ranking function. This score is calculated using a
|
756
|
+
* probabilistic model to estimate the probability that a document is
|
757
|
+
* relevant to a given query.
|
758
|
+
* * `relevance_score`: semantic relevance adjustment that uses a
|
759
|
+
* proprietary Google model to determine the meaning and intent behind a
|
760
|
+
* user's query in context with the content in the documents.
|
761
|
+
* * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
762
|
+
* predicted Click-through rate (pCTR) to gauge the relevance and
|
763
|
+
* attractiveness of a search result from a user's perspective. A higher
|
764
|
+
* pCTR suggests that the result is more likely to satisfy the user's query
|
765
|
+
* and intent, making it a valuable signal for ranking.
|
766
|
+
* * `freshness_rank`: freshness adjustment as a rank
|
767
|
+
* * `document_age`: The time in hours elapsed since the document was last
|
768
|
+
* updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
769
|
+
* * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
770
|
+
* Google model to determine the keyword-based overlap between the query and
|
771
|
+
* the document.
|
772
|
+
* * `base_rank`: the default rank of the result
|
773
|
+
* @param {google.cloud.discoveryengine.v1.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
|
774
|
+
* The backend to use for the ranking expression evaluation.
|
589
775
|
* @param {object} [options]
|
590
776
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
591
777
|
* @returns {Stream}
|
@@ -825,6 +1011,99 @@ export declare class SearchServiceClient {
|
|
825
1011
|
* This feature is not supported for healthcare search.
|
826
1012
|
* @param {google.cloud.discoveryengine.v1.SearchRequest.RelevanceScoreSpec} [request.relevanceScoreSpec]
|
827
1013
|
* Optional. The specification for returning the relevance score.
|
1014
|
+
* @param {string} request.rankingExpression
|
1015
|
+
* The ranking expression controls the customized ranking on retrieval
|
1016
|
+
* documents. This overrides
|
1017
|
+
* {@link protos.google.cloud.discoveryengine.v1.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
|
1018
|
+
* The syntax and supported features depend on the
|
1019
|
+
* `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
1020
|
+
* provided, it defaults to `RANK_BY_EMBEDDING`.
|
1021
|
+
*
|
1022
|
+
* If
|
1023
|
+
* {@link protos.google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
1024
|
+
* is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
1025
|
+
* function or multiple functions that are joined by "+".
|
1026
|
+
*
|
1027
|
+
* * ranking_expression = function, { " + ", function };
|
1028
|
+
*
|
1029
|
+
* Supported functions:
|
1030
|
+
*
|
1031
|
+
* * double * relevance_score
|
1032
|
+
* * double * dotProduct(embedding_field_path)
|
1033
|
+
*
|
1034
|
+
* Function variables:
|
1035
|
+
*
|
1036
|
+
* * `relevance_score`: pre-defined keywords, used for measure relevance
|
1037
|
+
* between query and document.
|
1038
|
+
* * `embedding_field_path`: the document embedding field
|
1039
|
+
* used with query embedding vector.
|
1040
|
+
* * `dotProduct`: embedding function between `embedding_field_path` and
|
1041
|
+
* query embedding vector.
|
1042
|
+
*
|
1043
|
+
* Example ranking expression:
|
1044
|
+
*
|
1045
|
+
* If document has an embedding field doc_embedding, the ranking expression
|
1046
|
+
* could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
1047
|
+
*
|
1048
|
+
* If
|
1049
|
+
* {@link protos.google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
1050
|
+
* is set to `RANK_BY_FORMULA`, the following expression types (and
|
1051
|
+
* combinations of those chained using + or
|
1052
|
+
* * operators) are supported:
|
1053
|
+
*
|
1054
|
+
* * `double`
|
1055
|
+
* * `signal`
|
1056
|
+
* * `log(signal)`
|
1057
|
+
* * `exp(signal)`
|
1058
|
+
* * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
1059
|
+
* argument being a denominator constant.
|
1060
|
+
* * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
1061
|
+
* * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
1062
|
+
* signal2 | double, else returns signal1.
|
1063
|
+
*
|
1064
|
+
* Here are a few examples of ranking formulas that use the supported
|
1065
|
+
* ranking expression types:
|
1066
|
+
*
|
1067
|
+
* - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
1068
|
+
* -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
1069
|
+
* `semantic_smilarity_score` adjustment.
|
1070
|
+
* - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
1071
|
+
* is_nan(keyword_similarity_score)` -- rank by the exponent of
|
1072
|
+
* `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
1073
|
+
* add constant 0.3 adjustment to the final score if
|
1074
|
+
* `semantic_similarity_score` is NaN.
|
1075
|
+
* - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
1076
|
+
* rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
1077
|
+
* of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
1078
|
+
* of `semantic_smilarity_score`.
|
1079
|
+
*
|
1080
|
+
* The following signals are supported:
|
1081
|
+
*
|
1082
|
+
* * `semantic_similarity_score`: semantic similarity adjustment that is
|
1083
|
+
* calculated using the embeddings generated by a proprietary Google model.
|
1084
|
+
* This score determines how semantically similar a search query is to a
|
1085
|
+
* document.
|
1086
|
+
* * `keyword_similarity_score`: keyword match adjustment uses the Best
|
1087
|
+
* Match 25 (BM25) ranking function. This score is calculated using a
|
1088
|
+
* probabilistic model to estimate the probability that a document is
|
1089
|
+
* relevant to a given query.
|
1090
|
+
* * `relevance_score`: semantic relevance adjustment that uses a
|
1091
|
+
* proprietary Google model to determine the meaning and intent behind a
|
1092
|
+
* user's query in context with the content in the documents.
|
1093
|
+
* * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
1094
|
+
* predicted Click-through rate (pCTR) to gauge the relevance and
|
1095
|
+
* attractiveness of a search result from a user's perspective. A higher
|
1096
|
+
* pCTR suggests that the result is more likely to satisfy the user's query
|
1097
|
+
* and intent, making it a valuable signal for ranking.
|
1098
|
+
* * `freshness_rank`: freshness adjustment as a rank
|
1099
|
+
* * `document_age`: The time in hours elapsed since the document was last
|
1100
|
+
* updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
1101
|
+
* * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
1102
|
+
* Google model to determine the keyword-based overlap between the query and
|
1103
|
+
* the document.
|
1104
|
+
* * `base_rank`: the default rank of the result
|
1105
|
+
* @param {google.cloud.discoveryengine.v1.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
|
1106
|
+
* The backend to use for the ranking expression evaluation.
|
828
1107
|
* @param {object} [options]
|
829
1108
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
830
1109
|
* @returns {Object}
|
@@ -1076,6 +1355,99 @@ export declare class SearchServiceClient {
|
|
1076
1355
|
* This feature is not supported for healthcare search.
|
1077
1356
|
* @param {google.cloud.discoveryengine.v1.SearchRequest.RelevanceScoreSpec} [request.relevanceScoreSpec]
|
1078
1357
|
* Optional. The specification for returning the relevance score.
|
1358
|
+
* @param {string} request.rankingExpression
|
1359
|
+
* The ranking expression controls the customized ranking on retrieval
|
1360
|
+
* documents. This overrides
|
1361
|
+
* {@link protos.google.cloud.discoveryengine.v1.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
|
1362
|
+
* The syntax and supported features depend on the
|
1363
|
+
* `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
1364
|
+
* provided, it defaults to `RANK_BY_EMBEDDING`.
|
1365
|
+
*
|
1366
|
+
* If
|
1367
|
+
* {@link protos.google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
1368
|
+
* is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
1369
|
+
* function or multiple functions that are joined by "+".
|
1370
|
+
*
|
1371
|
+
* * ranking_expression = function, { " + ", function };
|
1372
|
+
*
|
1373
|
+
* Supported functions:
|
1374
|
+
*
|
1375
|
+
* * double * relevance_score
|
1376
|
+
* * double * dotProduct(embedding_field_path)
|
1377
|
+
*
|
1378
|
+
* Function variables:
|
1379
|
+
*
|
1380
|
+
* * `relevance_score`: pre-defined keywords, used for measure relevance
|
1381
|
+
* between query and document.
|
1382
|
+
* * `embedding_field_path`: the document embedding field
|
1383
|
+
* used with query embedding vector.
|
1384
|
+
* * `dotProduct`: embedding function between `embedding_field_path` and
|
1385
|
+
* query embedding vector.
|
1386
|
+
*
|
1387
|
+
* Example ranking expression:
|
1388
|
+
*
|
1389
|
+
* If document has an embedding field doc_embedding, the ranking expression
|
1390
|
+
* could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
1391
|
+
*
|
1392
|
+
* If
|
1393
|
+
* {@link protos.google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
1394
|
+
* is set to `RANK_BY_FORMULA`, the following expression types (and
|
1395
|
+
* combinations of those chained using + or
|
1396
|
+
* * operators) are supported:
|
1397
|
+
*
|
1398
|
+
* * `double`
|
1399
|
+
* * `signal`
|
1400
|
+
* * `log(signal)`
|
1401
|
+
* * `exp(signal)`
|
1402
|
+
* * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
1403
|
+
* argument being a denominator constant.
|
1404
|
+
* * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
1405
|
+
* * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
1406
|
+
* signal2 | double, else returns signal1.
|
1407
|
+
*
|
1408
|
+
* Here are a few examples of ranking formulas that use the supported
|
1409
|
+
* ranking expression types:
|
1410
|
+
*
|
1411
|
+
* - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
1412
|
+
* -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
1413
|
+
* `semantic_smilarity_score` adjustment.
|
1414
|
+
* - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
1415
|
+
* is_nan(keyword_similarity_score)` -- rank by the exponent of
|
1416
|
+
* `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
1417
|
+
* add constant 0.3 adjustment to the final score if
|
1418
|
+
* `semantic_similarity_score` is NaN.
|
1419
|
+
* - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
1420
|
+
* rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
1421
|
+
* of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
1422
|
+
* of `semantic_smilarity_score`.
|
1423
|
+
*
|
1424
|
+
* The following signals are supported:
|
1425
|
+
*
|
1426
|
+
* * `semantic_similarity_score`: semantic similarity adjustment that is
|
1427
|
+
* calculated using the embeddings generated by a proprietary Google model.
|
1428
|
+
* This score determines how semantically similar a search query is to a
|
1429
|
+
* document.
|
1430
|
+
* * `keyword_similarity_score`: keyword match adjustment uses the Best
|
1431
|
+
* Match 25 (BM25) ranking function. This score is calculated using a
|
1432
|
+
* probabilistic model to estimate the probability that a document is
|
1433
|
+
* relevant to a given query.
|
1434
|
+
* * `relevance_score`: semantic relevance adjustment that uses a
|
1435
|
+
* proprietary Google model to determine the meaning and intent behind a
|
1436
|
+
* user's query in context with the content in the documents.
|
1437
|
+
* * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
1438
|
+
* predicted Click-through rate (pCTR) to gauge the relevance and
|
1439
|
+
* attractiveness of a search result from a user's perspective. A higher
|
1440
|
+
* pCTR suggests that the result is more likely to satisfy the user's query
|
1441
|
+
* and intent, making it a valuable signal for ranking.
|
1442
|
+
* * `freshness_rank`: freshness adjustment as a rank
|
1443
|
+
* * `document_age`: The time in hours elapsed since the document was last
|
1444
|
+
* updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
1445
|
+
* * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
1446
|
+
* Google model to determine the keyword-based overlap between the query and
|
1447
|
+
* the document.
|
1448
|
+
* * `base_rank`: the default rank of the result
|
1449
|
+
* @param {google.cloud.discoveryengine.v1.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
|
1450
|
+
* The backend to use for the ranking expression evaluation.
|
1079
1451
|
* @param {object} [options]
|
1080
1452
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
1081
1453
|
* @returns {Promise} - The promise which resolves to an array.
|
@@ -1320,6 +1692,99 @@ export declare class SearchServiceClient {
|
|
1320
1692
|
* This feature is not supported for healthcare search.
|
1321
1693
|
* @param {google.cloud.discoveryengine.v1.SearchRequest.RelevanceScoreSpec} [request.relevanceScoreSpec]
|
1322
1694
|
* Optional. The specification for returning the relevance score.
|
1695
|
+
* @param {string} request.rankingExpression
|
1696
|
+
* The ranking expression controls the customized ranking on retrieval
|
1697
|
+
* documents. This overrides
|
1698
|
+
* {@link protos.google.cloud.discoveryengine.v1.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
|
1699
|
+
* The syntax and supported features depend on the
|
1700
|
+
* `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
1701
|
+
* provided, it defaults to `RANK_BY_EMBEDDING`.
|
1702
|
+
*
|
1703
|
+
* If
|
1704
|
+
* {@link protos.google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
1705
|
+
* is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
1706
|
+
* function or multiple functions that are joined by "+".
|
1707
|
+
*
|
1708
|
+
* * ranking_expression = function, { " + ", function };
|
1709
|
+
*
|
1710
|
+
* Supported functions:
|
1711
|
+
*
|
1712
|
+
* * double * relevance_score
|
1713
|
+
* * double * dotProduct(embedding_field_path)
|
1714
|
+
*
|
1715
|
+
* Function variables:
|
1716
|
+
*
|
1717
|
+
* * `relevance_score`: pre-defined keywords, used for measure relevance
|
1718
|
+
* between query and document.
|
1719
|
+
* * `embedding_field_path`: the document embedding field
|
1720
|
+
* used with query embedding vector.
|
1721
|
+
* * `dotProduct`: embedding function between `embedding_field_path` and
|
1722
|
+
* query embedding vector.
|
1723
|
+
*
|
1724
|
+
* Example ranking expression:
|
1725
|
+
*
|
1726
|
+
* If document has an embedding field doc_embedding, the ranking expression
|
1727
|
+
* could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
1728
|
+
*
|
1729
|
+
* If
|
1730
|
+
* {@link protos.google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
1731
|
+
* is set to `RANK_BY_FORMULA`, the following expression types (and
|
1732
|
+
* combinations of those chained using + or
|
1733
|
+
* * operators) are supported:
|
1734
|
+
*
|
1735
|
+
* * `double`
|
1736
|
+
* * `signal`
|
1737
|
+
* * `log(signal)`
|
1738
|
+
* * `exp(signal)`
|
1739
|
+
* * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
1740
|
+
* argument being a denominator constant.
|
1741
|
+
* * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
1742
|
+
* * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
1743
|
+
* signal2 | double, else returns signal1.
|
1744
|
+
*
|
1745
|
+
* Here are a few examples of ranking formulas that use the supported
|
1746
|
+
* ranking expression types:
|
1747
|
+
*
|
1748
|
+
* - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
1749
|
+
* -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
1750
|
+
* `semantic_smilarity_score` adjustment.
|
1751
|
+
* - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
1752
|
+
* is_nan(keyword_similarity_score)` -- rank by the exponent of
|
1753
|
+
* `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
1754
|
+
* add constant 0.3 adjustment to the final score if
|
1755
|
+
* `semantic_similarity_score` is NaN.
|
1756
|
+
* - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
1757
|
+
* rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
1758
|
+
* of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
1759
|
+
* of `semantic_smilarity_score`.
|
1760
|
+
*
|
1761
|
+
* The following signals are supported:
|
1762
|
+
*
|
1763
|
+
* * `semantic_similarity_score`: semantic similarity adjustment that is
|
1764
|
+
* calculated using the embeddings generated by a proprietary Google model.
|
1765
|
+
* This score determines how semantically similar a search query is to a
|
1766
|
+
* document.
|
1767
|
+
* * `keyword_similarity_score`: keyword match adjustment uses the Best
|
1768
|
+
* Match 25 (BM25) ranking function. This score is calculated using a
|
1769
|
+
* probabilistic model to estimate the probability that a document is
|
1770
|
+
* relevant to a given query.
|
1771
|
+
* * `relevance_score`: semantic relevance adjustment that uses a
|
1772
|
+
* proprietary Google model to determine the meaning and intent behind a
|
1773
|
+
* user's query in context with the content in the documents.
|
1774
|
+
* * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
1775
|
+
* predicted Click-through rate (pCTR) to gauge the relevance and
|
1776
|
+
* attractiveness of a search result from a user's perspective. A higher
|
1777
|
+
* pCTR suggests that the result is more likely to satisfy the user's query
|
1778
|
+
* and intent, making it a valuable signal for ranking.
|
1779
|
+
* * `freshness_rank`: freshness adjustment as a rank
|
1780
|
+
* * `document_age`: The time in hours elapsed since the document was last
|
1781
|
+
* updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
1782
|
+
* * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
1783
|
+
* Google model to determine the keyword-based overlap between the query and
|
1784
|
+
* the document.
|
1785
|
+
* * `base_rank`: the default rank of the result
|
1786
|
+
* @param {google.cloud.discoveryengine.v1.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
|
1787
|
+
* The backend to use for the ranking expression evaluation.
|
1323
1788
|
* @param {object} [options]
|
1324
1789
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
1325
1790
|
* @returns {Stream}
|
@@ -1559,6 +2024,99 @@ export declare class SearchServiceClient {
|
|
1559
2024
|
* This feature is not supported for healthcare search.
|
1560
2025
|
* @param {google.cloud.discoveryengine.v1.SearchRequest.RelevanceScoreSpec} [request.relevanceScoreSpec]
|
1561
2026
|
* Optional. The specification for returning the relevance score.
|
2027
|
+
* @param {string} request.rankingExpression
|
2028
|
+
* The ranking expression controls the customized ranking on retrieval
|
2029
|
+
* documents. This overrides
|
2030
|
+
* {@link protos.google.cloud.discoveryengine.v1.ServingConfig.ranking_expression|ServingConfig.ranking_expression}.
|
2031
|
+
* The syntax and supported features depend on the
|
2032
|
+
* `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
2033
|
+
* provided, it defaults to `RANK_BY_EMBEDDING`.
|
2034
|
+
*
|
2035
|
+
* If
|
2036
|
+
* {@link protos.google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
2037
|
+
* is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
2038
|
+
* function or multiple functions that are joined by "+".
|
2039
|
+
*
|
2040
|
+
* * ranking_expression = function, { " + ", function };
|
2041
|
+
*
|
2042
|
+
* Supported functions:
|
2043
|
+
*
|
2044
|
+
* * double * relevance_score
|
2045
|
+
* * double * dotProduct(embedding_field_path)
|
2046
|
+
*
|
2047
|
+
* Function variables:
|
2048
|
+
*
|
2049
|
+
* * `relevance_score`: pre-defined keywords, used for measure relevance
|
2050
|
+
* between query and document.
|
2051
|
+
* * `embedding_field_path`: the document embedding field
|
2052
|
+
* used with query embedding vector.
|
2053
|
+
* * `dotProduct`: embedding function between `embedding_field_path` and
|
2054
|
+
* query embedding vector.
|
2055
|
+
*
|
2056
|
+
* Example ranking expression:
|
2057
|
+
*
|
2058
|
+
* If document has an embedding field doc_embedding, the ranking expression
|
2059
|
+
* could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
2060
|
+
*
|
2061
|
+
* If
|
2062
|
+
* {@link protos.google.cloud.discoveryengine.v1.SearchRequest.ranking_expression_backend|ranking_expression_backend}
|
2063
|
+
* is set to `RANK_BY_FORMULA`, the following expression types (and
|
2064
|
+
* combinations of those chained using + or
|
2065
|
+
* * operators) are supported:
|
2066
|
+
*
|
2067
|
+
* * `double`
|
2068
|
+
* * `signal`
|
2069
|
+
* * `log(signal)`
|
2070
|
+
* * `exp(signal)`
|
2071
|
+
* * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
2072
|
+
* argument being a denominator constant.
|
2073
|
+
* * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
2074
|
+
* * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
2075
|
+
* signal2 | double, else returns signal1.
|
2076
|
+
*
|
2077
|
+
* Here are a few examples of ranking formulas that use the supported
|
2078
|
+
* ranking expression types:
|
2079
|
+
*
|
2080
|
+
* - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
2081
|
+
* -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
2082
|
+
* `semantic_smilarity_score` adjustment.
|
2083
|
+
* - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
2084
|
+
* is_nan(keyword_similarity_score)` -- rank by the exponent of
|
2085
|
+
* `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
2086
|
+
* add constant 0.3 adjustment to the final score if
|
2087
|
+
* `semantic_similarity_score` is NaN.
|
2088
|
+
* - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
2089
|
+
* rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
2090
|
+
* of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
2091
|
+
* of `semantic_smilarity_score`.
|
2092
|
+
*
|
2093
|
+
* The following signals are supported:
|
2094
|
+
*
|
2095
|
+
* * `semantic_similarity_score`: semantic similarity adjustment that is
|
2096
|
+
* calculated using the embeddings generated by a proprietary Google model.
|
2097
|
+
* This score determines how semantically similar a search query is to a
|
2098
|
+
* document.
|
2099
|
+
* * `keyword_similarity_score`: keyword match adjustment uses the Best
|
2100
|
+
* Match 25 (BM25) ranking function. This score is calculated using a
|
2101
|
+
* probabilistic model to estimate the probability that a document is
|
2102
|
+
* relevant to a given query.
|
2103
|
+
* * `relevance_score`: semantic relevance adjustment that uses a
|
2104
|
+
* proprietary Google model to determine the meaning and intent behind a
|
2105
|
+
* user's query in context with the content in the documents.
|
2106
|
+
* * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
2107
|
+
* predicted Click-through rate (pCTR) to gauge the relevance and
|
2108
|
+
* attractiveness of a search result from a user's perspective. A higher
|
2109
|
+
* pCTR suggests that the result is more likely to satisfy the user's query
|
2110
|
+
* and intent, making it a valuable signal for ranking.
|
2111
|
+
* * `freshness_rank`: freshness adjustment as a rank
|
2112
|
+
* * `document_age`: The time in hours elapsed since the document was last
|
2113
|
+
* updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
2114
|
+
* * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
2115
|
+
* Google model to determine the keyword-based overlap between the query and
|
2116
|
+
* the document.
|
2117
|
+
* * `base_rank`: the default rank of the result
|
2118
|
+
* @param {google.cloud.discoveryengine.v1.SearchRequest.RankingExpressionBackend} [request.rankingExpressionBackend]
|
2119
|
+
* The backend to use for the ranking expression evaluation.
|
1562
2120
|
* @param {object} [options]
|
1563
2121
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
1564
2122
|
* @returns {Object}
|