Google-Cloud-Discoveryengine-V1beta
view release on metacpan or search on metacpan
lib/Google/Cloud/Discoveryengine/V1beta/SearchService.pm view on Meta::CPAN
Uses the provided embedding to do additional semantic document retrieval.
The retrieval is based on the dot product of
[SearchRequest.EmbeddingSpec.EmbeddingVector.vector][google.cloud.discoveryengine.v1beta.SearchRequest.EmbeddingSpec.EmbeddingVector.vector]
and the document embedding that is provided in
[SearchRequest.EmbeddingSpec.EmbeddingVector.field_path][google.cloud.discoveryengine.v1beta.SearchRequest.EmbeddingSpec.EmbeddingVector.field_path].
If
[SearchRequest.EmbeddingSpec.EmbeddingVector.field_path][google.cloud.discoveryengine.v1beta.SearchRequest.EmbeddingSpec.EmbeddingVector.field_path]
is not provided, it will use
[ServingConfig.EmbeddingConfig.field_path][google.cloud.discoveryengine.v1beta.ServingConfig.embedding_config].
=item * C<< $msg->ranking_expression() >> / C<< $msg->ranking_expression($value) >>
Type: C<String>
Optional. The ranking expression controls the customized ranking on
retrieval documents. This overrides
[ServingConfig.ranking_expression][google.cloud.discoveryengine.v1beta.ServingConfig.ranking_expression].
The syntax and supported features depend on the
`ranking_expression_backend` value. If `ranking_expression_backend` is not
provided, it defaults to `RANK_BY_EMBEDDING`.
If
[ranking_expression_backend][google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend]
is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
function or multiple functions that are joined by "+".
* ranking_expression = function, { " + ", function };
Supported functions:
* double * relevance_score
* double * dotProduct(embedding_field_path)
Function variables:
* `relevance_score`: pre-defined keywords, used for measure relevance
between query and document.
* `embedding_field_path`: the document embedding field
used with query embedding vector.
* `dotProduct`: embedding function between `embedding_field_path` and
query embedding vector.
Example ranking expression:
If document has an embedding field doc_embedding, the ranking expression
could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
If
[ranking_expression_backend][google.cloud.discoveryengine.v1beta.SearchRequest.ranking_expression_backend]
is set to `RANK_BY_FORMULA`, the following expression types (and
combinations of those chained using + or
* operators) are supported:
* `double`
* `signal`
* `log(signal)`
* `exp(signal)`
* `rr(signal, double > 0)` -- reciprocal rank transformation with second
argument being a denominator constant.
* `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
* `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
signal2 | double, else returns signal1.
Here are a few examples of ranking formulas that use the supported
ranking expression types:
- `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
-- mostly rank by the logarithm of `keyword_similarity_score` with slight
`semantic_smilarity_score` adjustment.
- `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
is_nan(keyword_similarity_score)` -- rank by the exponent of
`semantic_similarity_score` filling the value with 0 if it's NaN, also
add constant 0.3 adjustment to the final score if
`semantic_similarity_score` is NaN.
- `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
of `keyword_similarity_score` with slight adjustment of reciprocal rank
of `semantic_smilarity_score`.
The following signals are supported:
* `semantic_similarity_score`: semantic similarity adjustment that is
calculated using the embeddings generated by a proprietary Google model.
This score determines how semantically similar a search query is to a
document.
* `keyword_similarity_score`: keyword match adjustment uses the Best
Match 25 (BM25) ranking function. This score is calculated using a
probabilistic model to estimate the probability that a document is
relevant to a given query.
* `relevance_score`: semantic relevance adjustment that uses a
proprietary Google model to determine the meaning and intent behind a
user's query in context with the content in the documents.
* `pctr_rank`: predicted conversion rate adjustment as a rank use
predicted Click-through rate (pCTR) to gauge the relevance and
attractiveness of a search result from a user's perspective. A higher
pCTR suggests that the result is more likely to satisfy the user's query
and intent, making it a valuable signal for ranking.
* `freshness_rank`: freshness adjustment as a rank
* `document_age`: The time in hours elapsed since the document was last
updated, a floating-point number (e.g., 0.25 means 15 minutes).
* `topicality_rank`: topicality adjustment as a rank. Uses proprietary
Google model to determine the keyword-based overlap between the query and
the document.
* `base_rank`: the default rank of the result
* `media_actor_match`: whether the media actor matches the query
* `media_director_match`: whether the media director matches the query
* `media_genre_match`: whether the media genre matches the query
* `media_language_match`: whether the media language matches the query
* `media_title_match`: whether the media title matches the query
* `media_prefix_similarity_rank`: prefix similarity rank for media
results
* `media_semantic_similarity_rank`: semantic similarity rank for media
results
=item * C<< $msg->ranking_expression_backend() >> / C<< $msg->ranking_expression_backend($value) >>
Type: C<Enum> (L<Google::Cloud::Discoveryengine::V1beta::SearchRequest::RankingExpressionBackend>)
Optional. The backend to use for the ranking expression evaluation.
=item * C<< $msg->safe_search() >> / C<< $msg->safe_search($value) >>
Type: C<Bool>
Whether to turn on safe search. This is only supported for
website search.
=item * C<< $msg->user_labels() >> / C<< $msg->user_labels($value) >>
Type: C<Message> (L<Google::Cloud::Discoveryengine::V1beta::SearchService::SearchRequest::UserLabelsEntry>)
The user labels applied to a resource must meet the following requirements:
* Each resource can have multiple labels, up to a maximum of 64.
( run in 1.995 second using v1.01-cache-2.11-cpan-60884a8df76 )