# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T01:54:39+00:00
from __future__ import annotations
from enum import Enum
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field
class GoogleApiHttpBody(BaseModel):
contentType: Optional[str] = Field(
None,
description='The HTTP Content-Type header value specifying the content type of the body.',
)
data: Optional[str] = Field(
None, description='The HTTP request/response body as raw binary.'
)
extensions: Optional[List[Dict[str, Any]]] = Field(
None,
description='Application specific response metadata. Must be set in the first response for streaming APIs.',
)
class GoogleCloudDiscoveryengineLoggingHttpRequestContext(BaseModel):
responseStatusCode: Optional[int] = Field(
None, description='The HTTP response status code for the request.'
)
class GoogleCloudDiscoveryengineLoggingImportErrorContext(BaseModel):
document: Optional[str] = Field(
None,
description='The detailed content which caused the error on importing a document.',
)
gcsPath: Optional[str] = Field(
None,
description='Google Cloud Storage file path of the import source. Can be set for batch operation error.',
)
lineNumber: Optional[str] = Field(
None,
description='Line number of the content in file. Should be empty for permission or batch operation error.',
)
operation: Optional[str] = Field(
None, description='The operation resource name of the LRO.'
)
userEvent: Optional[str] = Field(
None,
description='The detailed content which caused the error on importing a user event.',
)
class GoogleCloudDiscoveryengineLoggingServiceContext(BaseModel):
service: Optional[str] = Field(
None,
description='An identifier of the service—for example, `discoveryengine.googleapis.com`.',
)
class GoogleCloudDiscoveryengineLoggingSourceLocation(BaseModel):
functionName: Optional[str] = Field(
None,
description='Human-readable name of a function or method—for example, `google.cloud.discoveryengine.v1alpha.RecommendationService.Recommend`.',
)
class GoogleCloudDiscoveryengineV1alphaImportDocumentsMetadata(BaseModel):
createTime: Optional[str] = Field(None, description='Operation create time.')
failureCount: Optional[str] = Field(
None, description='Count of entries that encountered errors while processing.'
)
successCount: Optional[str] = Field(
None, description='Count of entries that were processed successfully.'
)
updateTime: Optional[str] = Field(
None,
description='Operation last update time. If the operation is done, this is also the finish time.',
)
class GoogleCloudDiscoveryengineV1alphaImportErrorConfig(BaseModel):
gcsPrefix: Optional[str] = Field(
None,
description='Cloud Storage prefix for import errors. This must be an empty, existing Cloud Storage directory. Import errors will be written to sharded files in this directory, one per line, as a JSON-encoded `google.rpc.Status` message.',
)
class GoogleCloudDiscoveryengineV1alphaImportUserEventsMetadata(BaseModel):
createTime: Optional[str] = Field(None, description='Operation create time.')
failureCount: Optional[str] = Field(
None, description='Count of entries that encountered errors while processing.'
)
successCount: Optional[str] = Field(
None, description='Count of entries that were processed successfully.'
)
updateTime: Optional[str] = Field(
None,
description='Operation last update time. If the operation is done, this is also the finish time.',
)
class GoogleCloudDiscoveryengineV1alphaSchema(BaseModel):
jsonSchema: Optional[str] = Field(
None, description='The JSON representation of the schema.'
)
name: Optional[str] = Field(
None,
description='Immutable. The full resource name of the schema, in the format of `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}`. This field must be a UTF-8 encoded string with a length limit of 1024 characters.',
)
structSchema: Optional[Dict[str, Any]] = Field(
None, description='The structured representation of the schema.'
)
class GoogleCloudDiscoveryengineV1betaCompletionInfo(BaseModel):
selectedPosition: Optional[int] = Field(
None,
description='End user selected CompleteQueryResponse.CompletionResult.suggestion position, starting from 0.',
)
selectedSuggestion: Optional[str] = Field(
None,
description='End user selected CompleteQueryResponse.CompletionResult.suggestion.',
)
class GoogleCloudDiscoveryengineV1betaCustomAttribute(BaseModel):
numbers: Optional[List[float]] = Field(
None,
description='The numerical values of this custom attribute. For example, `[2.3, 15.4]` when the key is "lengths_cm". Exactly one of text or numbers should be set. Otherwise, an INVALID_ARGUMENT error is returned.',
)
text: Optional[List[str]] = Field(
None,
description='The textual values of this custom attribute. For example, `["yellow", "green"]` when the key is "color". Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is returned. Exactly one of text or numbers should be set. Otherwise, an INVALID_ARGUMENT error is returned.',
)
class GoogleCloudDiscoveryengineV1betaDocument(BaseModel):
id: Optional[str] = Field(
None,
description='Immutable. The identifier of the document. Id should conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length limit of 63 characters.',
)
jsonData: Optional[str] = Field(
None,
description='The JSON string representation of the document. It should conform to the registered schema or an INVALID_ARGUMENT error is thrown.',
)
name: Optional[str] = Field(
None,
description='Immutable. The full resource name of the document. Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}`. This field must be a UTF-8 encoded string with a length limit of 1024 characters.',
)
parentDocumentId: Optional[str] = Field(
None,
description='The identifier of the parent document. Currently supports at most two level document hierarchy. Id should conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length limit of 63 characters.',
)
schemaId: Optional[str] = Field(
None, description='The identifier of the schema located in the same data store.'
)
structData: Optional[Dict[str, Any]] = Field(
None,
description='The structured JSON data for the document. It should conform to the registered schema or an INVALID_ARGUMENT error is thrown.',
)
class GoogleCloudDiscoveryengineV1betaDocumentInfo(BaseModel):
id: Optional[str] = Field(None, description='Required. The Document resource ID.')
name: Optional[str] = Field(
None,
description='Required. The Document resource full name, of the form: projects/{project\\_id}/locations/{location}/collections/{collection\\_id}/dataStores/{data\\_store\\_id}/branches/{branch\\_id}/documents/{document\\_id}',
)
promotionIds: Optional[List[str]] = Field(
None,
description='The promotion IDs associated with this Document. Currently, this field is restricted to at most one ID.',
)
quantity: Optional[int] = Field(
None,
description='Quantity of the Document associated with the user event. Defaults to 1. For example, this field will be 2 if two quantities of the same Document are involved in a `add-to-cart` event. Required for events of the following event types: * `add-to-cart` * `purchase`',
)
class GoogleCloudDiscoveryengineV1betaGcsSource(BaseModel):
dataSchema: Optional[str] = Field(
None,
description='The schema to use when parsing the data from the source. Supported values for document imports: * `document` (default): One JSON Document per line. Each document must have a valid Document.id. * `content`: Unstructured data (e.g. PDF, HTML). Each file matched by `input_uris` will become a document, with the ID set to the first 128 bits of SHA256(URI) encoded as a hex string. * `custom`: One custom data JSON per row in arbitrary format that conforms the defined Schema of the data store. This can only be used by the GENERIC Data Store vertical. Supported values for user even imports: * `user_event` (default): One JSON UserEvent per line.',
)
inputUris: Optional[List[str]] = Field(
None,
description='Required. Cloud Storage URIs to input files. URI can be up to 2000 characters long. URIs can match the full object path (for example, `gs://bucket/directory/object.json`) or a pattern matching one or more files, such as `gs://bucket/directory/*.json`. A request can contain at most 100 files (or 100,000 files if `data_schema` is `content`). Each file can be up to 2 GB (or 100 MB if `data_schema` is `content`).',
)
class GoogleCloudDiscoveryengineV1betaImportDocumentsMetadata(BaseModel):
createTime: Optional[str] = Field(None, description='Operation create time.')
failureCount: Optional[str] = Field(
None, description='Count of entries that encountered errors while processing.'
)
successCount: Optional[str] = Field(
None, description='Count of entries that were processed successfully.'
)
updateTime: Optional[str] = Field(
None,
description='Operation last update time. If the operation is done, this is also the finish time.',
)
class ReconciliationMode(Enum):
RECONCILIATION_MODE_UNSPECIFIED = 'RECONCILIATION_MODE_UNSPECIFIED'
INCREMENTAL = 'INCREMENTAL'
FULL = 'FULL'
class GoogleCloudDiscoveryengineV1betaImportDocumentsRequestInlineSource(BaseModel):
documents: Optional[List[GoogleCloudDiscoveryengineV1betaDocument]] = Field(
None,
description='Required. A list of documents to update/create. Each document must have a valid Document.id. Recommended max of 100 items.',
)
class GoogleCloudDiscoveryengineV1betaImportErrorConfig(BaseModel):
gcsPrefix: Optional[str] = Field(
None,
description='Cloud Storage prefix for import errors. This must be an empty, existing Cloud Storage directory. Import errors will be written to sharded files in this directory, one per line, as a JSON-encoded `google.rpc.Status` message.',
)
class GoogleCloudDiscoveryengineV1betaImportUserEventsMetadata(BaseModel):
createTime: Optional[str] = Field(None, description='Operation create time.')
failureCount: Optional[str] = Field(
None, description='Count of entries that encountered errors while processing.'
)
successCount: Optional[str] = Field(
None, description='Count of entries that were processed successfully.'
)
updateTime: Optional[str] = Field(
None,
description='Operation last update time. If the operation is done, this is also the finish time.',
)
class GoogleCloudDiscoveryengineV1betaListDocumentsResponse(BaseModel):
documents: Optional[List[GoogleCloudDiscoveryengineV1betaDocument]] = Field(
None, description='The Documents.'
)
nextPageToken: Optional[str] = Field(
None,
description='A token that can be sent as ListDocumentsRequest.page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.',
)
class GoogleCloudDiscoveryengineV1betaMediaInfo(BaseModel):
mediaProgressDuration: Optional[str] = Field(
None,
description='The media progress time in seconds, if applicable. For example, if the end user has finished 90 seconds of a playback video, then MediaInfo.media_progress_duration.seconds should be set to 90.',
)
mediaProgressPercentage: Optional[float] = Field(
None,
description='Media progress should be computed using only the media_progress_duration relative to the media total length. This value must be between [0, 1.0] inclusive. If this is not a playback or the progress cannot be computed (e.g. ongoing livestream), this field should be unset.',
)
class GoogleCloudDiscoveryengineV1betaPageInfo(BaseModel):
pageCategory: Optional[str] = Field(
None,
description='The most specific category associated with a category page. To represent full path of category, use \'>\' sign to separate different hierarchies. If \'>\' is part of the category name, please replace it with other character(s). Category pages include special pages such as sales or promotions. For instance, a special sale page may have the category hierarchy: "pageCategory" : "Sales > 2017 Black Friday Deals". Required for `view-category-page` events. Other event types should not set this field. Otherwise, an INVALID_ARGUMENT error is returned.',
)
pageviewId: Optional[str] = Field(
None,
description='A unique ID of a web page view. This should be kept the same for all user events triggered from the same pageview. For example, an item detail page view could trigger multiple events as the user is browsing the page. The `pageViewId` property should be kept the same for all these events so that they can be grouped together properly. When using the client side event reporting with JavaScript pixel and Google Tag Manager, this value is filled in automatically.',
)
referrerUri: Optional[str] = Field(
None,
description='The referrer URL of the current page. When using the client side event reporting with JavaScript pixel and Google Tag Manager, this value is filled in automatically. However, some browser privacy restrictions may cause this field to be empty.',
)
uri: Optional[str] = Field(
None,
description="Complete URL (window.location.href) of the user's current page. When using the client side event reporting with JavaScript pixel and Google Tag Manager, this value is filled in automatically. Maximum length 5,000 characters.",
)
class GoogleCloudDiscoveryengineV1betaPanelInfo(BaseModel):
displayName: Optional[str] = Field(
None, description='The display name of the panel.'
)
panelId: Optional[str] = Field(None, description='Required. The panel ID.')
panelPosition: Optional[int] = Field(
None,
description='The ordered position of the panel, if shown to the user with other panels. If set, then total_panels must also be set.',
)
totalPanels: Optional[int] = Field(
None,
description='The total number of panels, including this one, shown to the user. Must be set if panel_position is set.',
)
class GoogleCloudDiscoveryengineV1betaRecommendResponseRecommendationResult(BaseModel):
document: Optional[GoogleCloudDiscoveryengineV1betaDocument] = Field(
None,
description='Set if `returnDocument` is set to true in RecommendRequest.params.',
)
id: Optional[str] = Field(
None, description='Resource ID of the recommended Document.'
)
metadata: Optional[Dict[str, Any]] = Field(
None,
description='Additional Document metadata / annotations. Possible values: * `score`: Recommendation score in double value. Is set if `returnScore` is set to true in RecommendRequest.params.',
)
class GoogleCloudDiscoveryengineV1betaSchema(BaseModel):
jsonSchema: Optional[str] = Field(
None, description='The JSON representation of the schema.'
)
name: Optional[str] = Field(
None,
description='Immutable. The full resource name of the schema, in the format of `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}`. This field must be a UTF-8 encoded string with a length limit of 1024 characters.',
)
structSchema: Optional[Dict[str, Any]] = Field(
None, description='The structured representation of the schema.'
)
class GoogleCloudDiscoveryengineV1betaSearchInfo(BaseModel):
offset: Optional[int] = Field(
None,
description='An integer that specifies the current offset for pagination (the 0-indexed starting location, amongst the products deemed by the API as relevant). See SearchRequest.offset for definition. If this field is negative, an INVALID_ARGUMENT is returned. This can only be set for `search` events. Other event types should not set this field. Otherwise, an INVALID_ARGUMENT error is returned.',
)
orderBy: Optional[str] = Field(
None,
description='The order in which products are returned, if applicable. See SearchRequest.order_by for definition and syntax. The value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned. This can only be set for `search` events. Other event types should not set this field. Otherwise, an INVALID_ARGUMENT error is returned.',
)
searchQuery: Optional[str] = Field(
None,
description="The user's search query. See SearchRequest.query for definition. The value must be a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned. At least one of search_query or page_categories is required for `search` events. Other event types should not set this field. Otherwise, an INVALID_ARGUMENT error is returned.",
)
class GoogleCloudDiscoveryengineV1betaTransactionInfo(BaseModel):
cost: Optional[float] = Field(
None,
description='All the costs associated with the products. These can be manufacturing costs, shipping expenses not borne by the end user, or any other costs, such that: * Profit = value - tax - cost',
)
currency: Optional[str] = Field(
None, description='Required. Currency code. Use three-character ISO-4217 code.'
)
discountValue: Optional[float] = Field(
None,
description='The total discount(s) value applied to this transaction. This figure should be excluded from TransactionInfo.value For example, if a user paid TransactionInfo.value amount, then nominal (pre-discount) value of the transaction is the sum of TransactionInfo.value and TransactionInfo.discount_value This means that profit is calculated the same way, regardless of the discount value, and that TransactionInfo.discount_value can be larger than TransactionInfo.value: * Profit = value - tax - cost',
)
tax: Optional[float] = Field(
None, description='All the taxes associated with the transaction.'
)
transactionId: Optional[str] = Field(
None, description='The transaction ID with a length limit of 128 characters.'
)
value: Optional[float] = Field(
None,
description='Required. Total non-zero value associated with the transaction. This value may include shipping, tax, or other adjustments to the total value that you want to include.',
)
class GoogleCloudDiscoveryengineV1betaUserInfo(BaseModel):
userAgent: Optional[str] = Field(
None,
description='User agent as included in the HTTP header. Required for getting SearchResponse.sponsored_results. The field must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned. This should not be set when using the client side event reporting with GTM or JavaScript tag in UserEventService.CollectUserEvent or if direct_user_request is set.',
)
userId: Optional[str] = Field(
None,
description="Highly recommended for logged-in users. Unique identifier for logged-in user, such as a user name. Don't set for anonymous users. Always use a hashed value for this ID. Don't set the field to the same fixed ID for different users. This mixes the event history of those users together, which results in degraded model quality. The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.",
)
class GoogleProtobufEmpty(BaseModel):
pass
class GoogleRpcStatus(BaseModel):
code: Optional[int] = Field(
None,
description='The status code, which should be an enum value of google.rpc.Code.',
)
details: Optional[List[Dict[str, Any]]] = Field(
None,
description='A list of messages that carry the error details. There is a common set of message types for APIs to use.',
)
message: Optional[str] = Field(
None,
description='A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.',
)
class GoogleTypeDate(BaseModel):
day: Optional[int] = Field(
None,
description="Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.",
)
month: Optional[int] = Field(
None,
description='Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.',
)
year: Optional[int] = Field(
None,
description='Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.',
)
class FieldXgafv(Enum):
field_1 = '1'
field_2 = '2'
class Alt(Enum):
json = 'json'
media = 'media'
proto = 'proto'
class GoogleCloudDiscoveryengineLoggingErrorContext(BaseModel):
httpRequest: Optional[GoogleCloudDiscoveryengineLoggingHttpRequestContext] = Field(
None,
description='The HTTP request which was processed when the error was triggered.',
)
reportLocation: Optional[GoogleCloudDiscoveryengineLoggingSourceLocation] = Field(
None,
description='The location in the source code where the decision was made to report the error, usually the place where it was logged.',
)
class GoogleCloudDiscoveryengineLoggingErrorLog(BaseModel):
context: Optional[GoogleCloudDiscoveryengineLoggingErrorContext] = Field(
None, description='A description of the context in which the error occurred.'
)
importPayload: Optional[GoogleCloudDiscoveryengineLoggingImportErrorContext] = (
Field(
None, description='The error payload that is populated on LRO import APIs.'
)
)
message: Optional[str] = Field(None, description='A message describing the error.')
requestPayload: Optional[Dict[str, Any]] = Field(
None,
description='The API request payload, represented as a protocol buffer. Most API request types are supported—for example: * `type.googleapis.com/google.cloud.discoveryengine.v1alpha.DocumentService.CreateDocumentRequest` * `type.googleapis.com/google.cloud.discoveryengine.v1alpha.UserEventService.WriteUserEventRequest`',
)
responsePayload: Optional[Dict[str, Any]] = Field(
None,
description='The API response payload, represented as a protocol buffer. This is used to log some "soft errors", where the response is valid but we consider there are some quality issues like unjoined events. The following API responses are supported, and no PII is included: * `google.cloud.discoveryengine.v1alpha.RecommendationService.Recommend` * `google.cloud.discoveryengine.v1alpha.UserEventService.WriteUserEvent` * `google.cloud.discoveryengine.v1alpha.UserEventService.CollectUserEvent`',
)
serviceContext: Optional[GoogleCloudDiscoveryengineLoggingServiceContext] = Field(
None, description='The service context in which this error has occurred.'
)
status: Optional[GoogleRpcStatus] = Field(
None, description='The RPC status associated with the error log.'
)
class GoogleCloudDiscoveryengineV1alphaImportDocumentsResponse(BaseModel):
errorConfig: Optional[GoogleCloudDiscoveryengineV1alphaImportErrorConfig] = Field(
None,
description='Echoes the destination for the complete errors in the request if set.',
)
errorSamples: Optional[List[GoogleRpcStatus]] = Field(
None, description='A sample of errors encountered while processing the request.'
)
class GoogleCloudDiscoveryengineV1alphaImportUserEventsResponse(BaseModel):
errorConfig: Optional[GoogleCloudDiscoveryengineV1alphaImportErrorConfig] = Field(
None,
description='Echoes the destination for the complete errors if this field was set in the request.',
)
errorSamples: Optional[List[GoogleRpcStatus]] = Field(
None, description='A sample of errors encountered while processing the request.'
)
joinedEventsCount: Optional[str] = Field(
None,
description='Count of user events imported with complete existing Documents.',
)
unjoinedEventsCount: Optional[str] = Field(
None,
description='Count of user events imported, but with Document information not found in the existing Branch.',
)
class GoogleCloudDiscoveryengineV1betaBigQuerySource(BaseModel):
dataSchema: Optional[str] = Field(
None,
description='The schema to use when parsing the data from the source. Supported values for user event imports: * `user_event` (default): One UserEvent per row. Supported values for document imports: * `document` (default): One Document format per row. Each document must have a valid Document.id and one of Document.json_data or Document.struct_data. * `custom`: One custom data per row in arbitrary format that conforms the defined Schema of the data store. This can only be used by the GENERIC Data Store vertical.',
)
datasetId: Optional[str] = Field(
None,
description='Required. The BigQuery data set to copy the data from with a length limit of 1,024 characters.',
)
gcsStagingDir: Optional[str] = Field(
None,
description='Intermediate Cloud Storage directory used for the import with a length limit of 2,000 characters. Can be specified if one wants to have the BigQuery export to a specific Cloud Storage directory.',
)
partitionDate: Optional[GoogleTypeDate] = Field(
None,
description="BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.",
)
projectId: Optional[str] = Field(
None,
description='The project ID (can be project # or ID) that the BigQuery source is in with a length limit of 128 characters. If not specified, inherits the project ID from the parent request.',
)
tableId: Optional[str] = Field(
None,
description='Required. The BigQuery table to copy the data from with a length limit of 1,024 characters.',
)
class GoogleCloudDiscoveryengineV1betaImportDocumentsRequest(BaseModel):
bigquerySource: Optional[GoogleCloudDiscoveryengineV1betaBigQuerySource] = Field(
None, description='BigQuery input source.'
)
errorConfig: Optional[GoogleCloudDiscoveryengineV1betaImportErrorConfig] = Field(
None, description='The desired location of errors incurred during the Import.'
)
gcsSource: Optional[GoogleCloudDiscoveryengineV1betaGcsSource] = Field(
None, description='Cloud Storage location for the input content.'
)
inlineSource: Optional[
GoogleCloudDiscoveryengineV1betaImportDocumentsRequestInlineSource
] = Field(
None, description='The Inline source for the input content for documents.'
)
reconciliationMode: Optional[ReconciliationMode] = Field(
None,
description='The mode of reconciliation between existing documents and the documents to be imported. Defaults to ReconciliationMode.INCREMENTAL.',
)
class GoogleCloudDiscoveryengineV1betaImportDocumentsResponse(BaseModel):
errorConfig: Optional[GoogleCloudDiscoveryengineV1betaImportErrorConfig] = Field(
None,
description='Echoes the destination for the complete errors in the request if set.',
)
errorSamples: Optional[List[GoogleRpcStatus]] = Field(
None, description='A sample of errors encountered while processing the request.'
)
class GoogleCloudDiscoveryengineV1betaImportUserEventsResponse(BaseModel):
errorConfig: Optional[GoogleCloudDiscoveryengineV1betaImportErrorConfig] = Field(
None,
description='Echoes the destination for the complete errors if this field was set in the request.',
)
errorSamples: Optional[List[GoogleRpcStatus]] = Field(
None, description='A sample of errors encountered while processing the request.'
)
joinedEventsCount: Optional[str] = Field(
None,
description='Count of user events imported with complete existing Documents.',
)
unjoinedEventsCount: Optional[str] = Field(
None,
description='Count of user events imported, but with Document information not found in the existing Branch.',
)
class GoogleCloudDiscoveryengineV1betaRecommendResponse(BaseModel):
attributionToken: Optional[str] = Field(
None,
description='A unique attribution token. This should be included in the UserEvent logs resulting from this recommendation, which enables accurate attribution of recommendation model performance.',
)
missingIds: Optional[List[str]] = Field(
None,
description='IDs of documents in the request that were missing from the default Branch associated with the requested ServingConfig.',
)
results: Optional[
List[GoogleCloudDiscoveryengineV1betaRecommendResponseRecommendationResult]
] = Field(
None,
description='A list of recommended Documents. The order represents the ranking (from the most relevant Document to the least).',
)
validateOnly: Optional[bool] = Field(
None, description='True if RecommendRequest.validate_only was set.'
)
class GoogleCloudDiscoveryengineV1betaUserEvent(BaseModel):
attributes: Optional[Dict[str, GoogleCloudDiscoveryengineV1betaCustomAttribute]] = (
Field(
None,
description='Extra user event features to include in the recommendation model. These attributes must NOT contain data that needs to be parsed or processed further, e.g. JSON or other encodings. If you provide custom attributes for ingested user events, also include them in the user events that you associate with prediction requests. Custom attribute formatting must be consistent between imported events and events provided with prediction requests. This lets the Discovery Engine API use those custom attributes when training models and serving predictions, which helps improve recommendation quality. This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT error is returned: * The key must be a UTF-8 encoded string with a length limit of 5,000 characters. * For text attributes, at most 400 values are allowed. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 256 characters. * For number attributes, at most 400 values are allowed. For product recommendations, an example of extra user information is traffic_channel, which is how a user arrives at the site. Users can arrive at the site by coming to the site directly, coming through Google search, or in other ways.',
)
)
attributionToken: Optional[str] = Field(
None,
description="Token to attribute an API response to user action(s) to trigger the event. Highly recommended for user events that are the result of PredictionService.Predict. This field enables accurate attribution of recommendation model performance. The value must be one of: * PredictResponse.attribution_token for events that are the result of PredictionService.Predict. * SearchResponse.attribution_token for events that are the result of SearchService.Search. * CompleteQueryResponse.attribution_token for events that are the result of SearchService.CompleteQuery. This token enables us to accurately attribute page view or conversion completion back to the event and the particular predict response containing this clicked/purchased product. If user clicks on product K in the recommendation results, pass PredictResponse.attribution_token as a URL parameter to product K's page. When recording events on product K's page, log the PredictResponse.attribution_token to this field.",
)
completionInfo: Optional[GoogleCloudDiscoveryengineV1betaCompletionInfo] = Field(
None,
description='CompleteQuery API details related to the event. This field should be set for `search` event when autocomplete function is enabled and the user clicks a suggestion for search.',
)
directUserRequest: Optional[bool] = Field(
None,
description='Should set to true if the request is made directly from the end user, in which case the UserEvent.user_info.user_agent can be populated from the HTTP request. This flag should be set only if the API request is made directly from the end user such as a mobile app (and not if a gateway or a server is processing and pushing the user events). This should not be set when using the JavaScript tag in UserEventService.CollectUserEvent.',
)
documents: Optional[List[GoogleCloudDiscoveryengineV1betaDocumentInfo]] = Field(
None,
description='List of Documents associated with this user event. This field is optional except for the following event types: * `view-item` * `add-to-cart` * `purchase` * `media-play` * `media-complete` In a `search` event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new `search` event with different UserEvent.documents is desired.',
)
eventTime: Optional[str] = Field(
None,
description='Only required for UserEventService.ImportUserEvents method. Timestamp of when the user event happened.',
)
eventType: Optional[str] = Field(
None,
description='Required. User event type. Allowed values are: Generic values: * `search`: Search for Documents. * `view-item`: Detailed page view of a Document. * `view-item-list`: View of a panel or ordered list of Documents. * `view-home-page`: View of the home page. * `view-category-page`: View of a category page, e.g. Home > Men > Jeans Retail-related values: * `add-to-cart`: Add an item(s) to cart, e.g. in Retail online shopping * `purchase`: Purchase an item(s) Media-related values: * `media-play`: Start/resume watching a video, playing a song, etc. * `media-complete`: Finished or stopped midway through a video, song, etc.',
)
filter: Optional[str] = Field(
None,
description='The filter syntax consists of an expression language for constructing a predicate from one or more fields of the documents being filtered. One example is for `search` events, the associated SearchService.SearchRequest may contain a filter expression in SearchService.SearchRequest.filter conforming to https://google.aip.dev/160#filtering. Similarly, for `view-item-list` events that are generated from a PredictionService.PredictRequest, this field may be populated directly from PredictionService.PredictRequest.filter conforming to https://google.aip.dev/160#filtering. The value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.',
)
mediaInfo: Optional[GoogleCloudDiscoveryengineV1betaMediaInfo] = Field(
None, description='Media-specific info.'
)
pageInfo: Optional[GoogleCloudDiscoveryengineV1betaPageInfo] = Field(
None,
description='Page metadata such as categories and other critical information for certain event types such as `view-category-page`.',
)
panel: Optional[GoogleCloudDiscoveryengineV1betaPanelInfo] = Field(
None, description='Panel metadata associated with this user event.'
)
promotionIds: Optional[List[str]] = Field(
None,
description='The promotion IDs if this is an event associated with promotions. Currently, this field is restricted to at most one ID.',
)
searchInfo: Optional[GoogleCloudDiscoveryengineV1betaSearchInfo] = Field(
None,
description='Search API details related to the event. This field should be set for `search` event.',
)
sessionId: Optional[str] = Field(
None,
description='A unique identifier for tracking a visitor session with a length limit of 128 bytes. A session is an aggregation of an end user behavior in a time span. A general guideline to populate the session_id: 1. If user has no activity for 30 min, a new session_id should be assigned. 2. The session_id should be unique across users, suggest use uuid or add UserEvent.user_pseudo_id as prefix.',
)
tagIds: Optional[List[str]] = Field(
None,
description='A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups on the customer end.',
)
transactionInfo: Optional[GoogleCloudDiscoveryengineV1betaTransactionInfo] = Field(
None,
description='The transaction metadata (if any) associated with this user event.',
)
userInfo: Optional[GoogleCloudDiscoveryengineV1betaUserInfo] = Field(
None, description='Information about the end user.'
)
userPseudoId: Optional[str] = Field(
None,
description='Required. A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor log in/out of the website. Do not set the field to the same fixed ID for different users. This mixes the event history of those users together, which results in degraded model quality. The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned. The field should not contain PII or user-data. We recommend to use Google Analytics [Client ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) for this field.',
)
class GoogleLongrunningOperation(BaseModel):
done: Optional[bool] = Field(
None,
description='If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.',
)
error: Optional[GoogleRpcStatus] = Field(
None,
description='The error result of the operation in case of failure or cancellation.',
)
metadata: Optional[Dict[str, Any]] = Field(
None,
description='Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.',
)
name: Optional[str] = Field(
None,
description='The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.',
)
response: Optional[Dict[str, Any]] = Field(
None,
description='The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.',
)
class GoogleCloudDiscoveryengineV1betaImportUserEventsRequestInlineSource(BaseModel):
userEvents: Optional[List[GoogleCloudDiscoveryengineV1betaUserEvent]] = Field(
None,
description='Required. A list of user events to import. Recommended max of 10k items.',
)
class GoogleCloudDiscoveryengineV1betaRecommendRequest(BaseModel):
filter: Optional[str] = Field(
None,
description='Filter for restricting recommendation results with a length limit of 5,000 characters. Currently, only filter expressions on the `filter_tags` attribute is supported. Examples: * (filter_tags: ANY("Red", "Blue") OR filter_tags: ANY("Hot", "Cold")) * (filter_tags: ANY("Red", "Blue")) AND NOT (filter_tags: ANY("Green")) If your filter blocks all results, the API will return generic (unfiltered) popular Documents. If you only want results strictly matching the filters, set `strictFiltering` to True in RecommendRequest.params to receive empty results instead. Note that the API will never return Documents with storageStatus of "EXPIRED" or "DELETED" regardless of filter choices.',
)
pageSize: Optional[int] = Field(
None,
description='Maximum number of results to return. Set this property to the number of recommendation results needed. If zero, the service will choose a reasonable default. The maximum allowed value is 100. Values above 100 will be coerced to 100.',
)
params: Optional[Dict[str, Any]] = Field(
None,
description="Additional domain specific parameters for the recommendations. Allowed values: * `returnDocument`: Boolean. If set to true, the associated Document object will be returned in RecommendResponse.results.document. * `returnScore`: Boolean. If set to true, the recommendation 'score' corresponding to each returned Document will be set in RecommendResponse.results.metadata. The given 'score' indicates the probability of a Document conversion given the user's context and history. * `strictFiltering`: Boolean. True by default. If set to false, the service will return generic (unfiltered) popular Documents instead of empty if your filter blocks all recommendation results. * `diversityLevel`: String. Default empty. If set to be non-empty, then it needs to be one of: * 'no-diversity' * 'low-diversity' * 'medium-diversity' * 'high-diversity' * 'auto-diversity' This gives request-level control and adjusts recommendation results based on Document category.",
)
userEvent: Optional[GoogleCloudDiscoveryengineV1betaUserEvent] = Field(
None,
description="Required. Context about the user, what they are looking at and what action they took to trigger the Recommend request. Note that this user event detail won't be ingested to userEvent logs. Thus, a separate userEvent write request is required for event logging. Don't set UserEvent.user_pseudo_id or UserEvent.user_info.user_id to the same fixed ID for different users. If you are trying to receive non-personalized recommendations (not recommended; this can negatively impact model performance), instead set UserEvent.user_pseudo_id to a random unique ID and leave UserEvent.user_info.user_id unset.",
)
userLabels: Optional[Dict[str, str]] = Field(
None,
description='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 [Requirements for labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) for more details.',
)
validateOnly: Optional[bool] = Field(
None,
description='Use validate only mode for this recommendation query. If set to true, a fake model will be used that returns arbitrary Document IDs. Note that the validate only mode should only be used for testing the API, or if the model is not ready.',
)
class GoogleLongrunningListOperationsResponse(BaseModel):
nextPageToken: Optional[str] = Field(
None, description='The standard List next-page token.'
)
operations: Optional[List[GoogleLongrunningOperation]] = Field(
None,
description='A list of operations that matches the specified filter in the request.',
)
class GoogleCloudDiscoveryengineV1betaImportUserEventsRequest(BaseModel):
bigquerySource: Optional[GoogleCloudDiscoveryengineV1betaBigQuerySource] = Field(
None, description='Required. BigQuery input source.'
)
errorConfig: Optional[GoogleCloudDiscoveryengineV1betaImportErrorConfig] = Field(
None,
description='The desired location of errors incurred during the Import. Cannot be set for inline user event imports.',
)
gcsSource: Optional[GoogleCloudDiscoveryengineV1betaGcsSource] = Field(
None, description='Required. Cloud Storage location for the input content.'
)
inlineSource: Optional[
GoogleCloudDiscoveryengineV1betaImportUserEventsRequestInlineSource
] = Field(
None,
description='Required. The Inline source for the input content for UserEvents.',
)