Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.4.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.4.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
PurgeUserEventsRequest,
PurgeUserEventsResponse,
)
from .types.safety import HarmCategory, SafetySetting
from .types.search_service import (
ExperimentInfo,
ProductAttributeInterval,
Expand Down Expand Up @@ -378,6 +379,7 @@
"GetProductRequest",
"GetProjectRequest",
"GetServingConfigRequest",
"HarmCategory",
"Image",
"ImportCompletionDataRequest",
"ImportCompletionDataResponse",
Expand Down Expand Up @@ -457,6 +459,7 @@
"ReplaceCatalogAttributeRequest",
"ResumeModelRequest",
"Rule",
"SafetySetting",
"SearchRequest",
"SearchResponse",
"SearchServiceClient",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.4.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
PurgeUserEventsRequest,
PurgeUserEventsResponse,
)
from .safety import HarmCategory, SafetySetting
from .search_service import (
ExperimentInfo,
ProductAttributeInterval,
Expand Down Expand Up @@ -385,6 +386,8 @@
"PurgeProductsResponse",
"PurgeUserEventsRequest",
"PurgeUserEventsResponse",
"SafetySetting",
"HarmCategory",
"ExperimentInfo",
"ProductAttributeInterval",
"ProductAttributeValue",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import proto # type: ignore

from google.cloud.retail_v2alpha.types import common, search_service
from google.cloud.retail_v2alpha.types import common, safety, search_service

__protobuf__ = proto.module(
package="google.cloud.retail.v2alpha",
Expand Down Expand Up @@ -95,6 +95,31 @@ class ConversationalSearchRequest(proto.Message):
conversational_filtering_spec (google.cloud.retail_v2alpha.types.ConversationalSearchRequest.ConversationalFilteringSpec):
Optional. This field specifies all
conversational filtering related parameters.
user_labels (MutableMapping[str, str]):
Optional. The user labels applied to a resource must meet
the following requirements:

- Each resource can have multiple labels, up to a maximum
of 64.
- Each label must be a key-value pair.
- Keys have a minimum length of 1 character and a maximum
length of 63 characters and cannot be empty. Values can
be empty and have a maximum length of 63 characters.
- Keys and values can contain only lowercase letters,
numeric characters, underscores, and dashes. All
characters must use UTF-8 encoding, and international
characters are allowed.
- The key portion of a label must be unique. However, you
can use the same key with multiple resources.
- Keys must start with a lowercase letter or international
character.

See `Google Cloud
Document <https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements>`__
for more details.
safety_settings (MutableSequence[google.cloud.retail_v2alpha.types.SafetySetting]):
Optional. The safety settings to be applied
to the generated content.
"""

class SearchParams(proto.Message):
Expand Down Expand Up @@ -228,11 +253,18 @@ class Mode(proto.Enum):
Values:
MODE_UNSPECIFIED (0):
Default value.
DISABLED (1):
Disable Conversational Filtering.
ENABLED (2):
Enabled Conversational Filtering with default
Conversational Search.
CONVERSATIONAL_FILTER_ONLY (3):
Enabled Conversational Filtering without
default Conversational Search.
"""
MODE_UNSPECIFIED = 0
DISABLED = 1
ENABLED = 2
CONVERSATIONAL_FILTER_ONLY = 3

enable_conversational_filtering: bool = proto.Field(
Expand Down Expand Up @@ -289,6 +321,16 @@ class Mode(proto.Enum):
number=8,
message=ConversationalFilteringSpec,
)
user_labels: MutableMapping[str, str] = proto.MapField(
proto.STRING,
proto.STRING,
number=12,
)
safety_settings: MutableSequence[safety.SafetySetting] = proto.RepeatedField(
proto.MESSAGE,
number=14,
message=safety.SafetySetting,
)


class ConversationalSearchResponse(proto.Message):
Expand All @@ -297,6 +339,31 @@ class ConversationalSearchResponse(proto.Message):
method.

Attributes:
user_query_types (MutableSequence[str]):
The types Retail classifies the search query as.

Supported values are:

- "ADVERSARIAL"
- "CHITCHAT"
- "JAILBREAK"
- "ORDER_SUPPORT"
- "SIMPLE_PRODUCT_SEARCH"
- "INTENT_REFINEMENT"
- "PRODUCT_DETAILS"
- "PRODUCT_COMPARISON"
- "DEALS_AND_COUPONS"
- "STORE_RELEVANT"
- "BLOCKLISTED"
- "BEST_PRODUCT"
- "RETAIL_SUPPORT"
- "DISABLED" clang-format off clang-format on
conversational_text_response (str):
The conversational answer-based text response
generated by the Server.
followup_question (google.cloud.retail_v2alpha.types.ConversationalSearchResponse.FollowupQuestion):
The conversational followup question
generated for Intent refinement.
conversation_id (str):
Conversation UUID. This field will be stored in client side
storage to maintain the conversation session with server and
Expand All @@ -312,8 +379,26 @@ class ConversationalSearchResponse(proto.Message):
This field specifies all related information
that is needed on client side for UI rendering
of conversational filtering search.
state (google.cloud.retail_v2alpha.types.ConversationalSearchResponse.State):
Output only. The state of the response
generation.
"""

class State(proto.Enum):
r"""The state of the response generation.

Values:
STATE_UNSPECIFIED (0):
Unknown.
STREAMING (1):
Response generation is being streamed.
SUCCEEDED (2):
Response generation has succeeded.
"""
STATE_UNSPECIFIED = 0
STREAMING = 1
SUCCEEDED = 2

class FollowupQuestion(proto.Message):
r"""The conversational followup question generated for Intent
refinement.
Expand Down Expand Up @@ -419,6 +504,19 @@ class AdditionalFilter(proto.Message):
message="ConversationalSearchResponse.ConversationalFilteringResult.AdditionalFilter",
)

user_query_types: MutableSequence[str] = proto.RepeatedField(
proto.STRING,
number=10,
)
conversational_text_response: str = proto.Field(
proto.STRING,
number=2,
)
followup_question: FollowupQuestion = proto.Field(
proto.MESSAGE,
number=3,
message=FollowupQuestion,
)
conversation_id: str = proto.Field(
proto.STRING,
number=4,
Expand All @@ -433,6 +531,11 @@ class AdditionalFilter(proto.Message):
number=7,
message=ConversationalFilteringResult,
)
state: State = proto.Field(
proto.ENUM,
number=9,
enum=State,
)


__all__ = tuple(sorted(__protobuf__.manifest))
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# -*- coding: utf-8 -*-
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from __future__ import annotations

from typing import MutableMapping, MutableSequence

import proto # type: ignore

__protobuf__ = proto.module(
package="google.cloud.retail.v2alpha",
manifest={
"HarmCategory",
"SafetySetting",
},
)


class HarmCategory(proto.Enum):
r"""Harm categories that will block the content.

Values:
HARM_CATEGORY_UNSPECIFIED (0):
The harm category is unspecified.
HARM_CATEGORY_HATE_SPEECH (1):
The harm category is hate speech.
HARM_CATEGORY_DANGEROUS_CONTENT (2):
The harm category is dangerous content.
HARM_CATEGORY_HARASSMENT (3):
The harm category is harassment.
HARM_CATEGORY_SEXUALLY_EXPLICIT (4):
The harm category is sexually explicit
content.
HARM_CATEGORY_CIVIC_INTEGRITY (5):
The harm category is civic integrity.
"""
HARM_CATEGORY_UNSPECIFIED = 0
HARM_CATEGORY_HATE_SPEECH = 1
HARM_CATEGORY_DANGEROUS_CONTENT = 2
HARM_CATEGORY_HARASSMENT = 3
HARM_CATEGORY_SEXUALLY_EXPLICIT = 4
HARM_CATEGORY_CIVIC_INTEGRITY = 5


class SafetySetting(proto.Message):
r"""Safety settings.

Attributes:
category (google.cloud.retail_v2alpha.types.HarmCategory):
Harm category.
threshold (google.cloud.retail_v2alpha.types.SafetySetting.HarmBlockThreshold):
The harm block threshold.
method (google.cloud.retail_v2alpha.types.SafetySetting.HarmBlockMethod):
Optional. Specify if the threshold is used
for probability or severity score. If not
specified, the threshold is used for probability
score.
"""

class HarmBlockThreshold(proto.Enum):
r"""Probability based thresholds levels for blocking.

Values:
HARM_BLOCK_THRESHOLD_UNSPECIFIED (0):
Unspecified harm block threshold.
BLOCK_LOW_AND_ABOVE (1):
Block low threshold and above (i.e. block
more).
BLOCK_MEDIUM_AND_ABOVE (2):
Block medium threshold and above.
BLOCK_ONLY_HIGH (3):
Block only high threshold (i.e. block less).
BLOCK_NONE (4):
Block none.
OFF (5):
Turn off the safety filter.
"""
HARM_BLOCK_THRESHOLD_UNSPECIFIED = 0
BLOCK_LOW_AND_ABOVE = 1
BLOCK_MEDIUM_AND_ABOVE = 2
BLOCK_ONLY_HIGH = 3
BLOCK_NONE = 4
OFF = 5

class HarmBlockMethod(proto.Enum):
r"""Probability vs severity.

Values:
HARM_BLOCK_METHOD_UNSPECIFIED (0):
The harm block method is unspecified.
SEVERITY (1):
The harm block method uses both probability
and severity scores.
PROBABILITY (2):
The harm block method uses the probability
score.
"""
HARM_BLOCK_METHOD_UNSPECIFIED = 0
SEVERITY = 1
PROBABILITY = 2

category: "HarmCategory" = proto.Field(
proto.ENUM,
number=1,
enum="HarmCategory",
)
threshold: HarmBlockThreshold = proto.Field(
proto.ENUM,
number=2,
enum=HarmBlockThreshold,
)
method: HarmBlockMethod = proto.Field(
proto.ENUM,
number=3,
enum=HarmBlockMethod,
)


__all__ = tuple(sorted(__protobuf__.manifest))
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.4.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-retail",
"version": "2.4.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-retail",
"version": "2.4.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-retail",
"version": "2.4.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Loading
Loading