Discovery Engine API . projects . locations . collections . engines . assistants

Instance Methods

agents()

Returns the agents Resource.

cannedQueries()

Returns the cannedQueries Resource.

close()

Close httplib2 connections.

create(parent, assistantId=None, body=None, x__xgafv=None)

Creates an Assistant.

delete(name, x__xgafv=None)

Deletes an Assistant.

get(name, x__xgafv=None)

Gets an Assistant.

list(parent, pageSize=None, pageToken=None, x__xgafv=None)

Lists all Assistants under an Engine.

listAvailableAgentViews(parent, adminView=None, agentOrigin=None, filter=None, languageCode=None, maxSuggestedPrompts=None, pageSize=None, pageToken=None, sortBy=None, x__xgafv=None)

Lists the data for displaying the Agents under an Assistant which are available to the caller.

listAvailableAgentViews_next()

Retrieves the next page of results.

list_next()

Retrieves the next page of results.

patch(name, body=None, updateMask=None, x__xgafv=None)

Updates an Assistant

streamAssist(name, body=None, x__xgafv=None)

Assists the user with a query in a streaming fashion.

Method Details

close()
Close httplib2 connections.
create(parent, assistantId=None, body=None, x__xgafv=None)
Creates an Assistant.

Args:
  parent: string, Required. The parent resource name. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}` (required)
  body: object, The request body.
    The object takes the form of:

{ # Discovery Engine Assistant resource.
  "customerPolicy": { # Customer-defined policy for the assistant. # Optional. Customer policy for the assistant.
    "bannedPhrases": [ # Optional. List of banned phrases.
      { # Definition of a customer-defined banned phrase. A banned phrase is not allowed to appear in the user query or the LLM response, or else the answer will be refused.
        "ignoreDiacritics": True or False, # Optional. If true, diacritical marks (e.g., accents, umlauts) are ignored when matching banned phrases. For example, "cafe" would match "café".
        "matchType": "A String", # Optional. Match type for the banned phrase.
        "phrase": "A String", # Required. The raw string content to be banned.
      },
    ],
    "modelArmorConfig": { # Configuration for customer defined Model Armor templates to be used for sanitizing user prompts and assistant responses. # Optional. Model Armor configuration to be used for sanitizing user prompts and assistant responses.
      "failureMode": "A String", # Optional. Defines the failure mode for Model Armor sanitization.
      "responseTemplate": "A String", # Optional. The resource name of the Model Armor template for sanitizing assistant responses. Format: `projects/{project}/locations/{location}/templates/{template_id}` If not specified, no sanitization will be applied to the assistant response.
      "userPromptTemplate": "A String", # Optional. The resource name of the Model Armor template for sanitizing user prompts. Format: `projects/{project}/locations/{location}/templates/{template_id}` If not specified, no sanitization will be applied to the user prompt.
    },
  },
  "description": "A String", # Optional. Description for additional information. Expected to be shown on the configuration UI, not to the users of the assistant.
  "disableLocationContext": True or False, # Optional. Indicates whether to disable user location context. By default, user location context is enabled.
  "displayName": "A String", # Required. The assistant display name. It must be a UTF-8 encoded string with a length limit of 128 characters.
  "enabledTools": { # Optional. Note: not implemented yet. Use enabled_actions instead. The enabled tools on this assistant. The keys are connector name, for example "projects/{projectId}/locations/{locationId}/collections/{collectionId}/dataconnector The values consist of admin enabled tools towards the connector instance. Admin can selectively enable multiple tools on any of the connector instances that they created in the project. For example {"jira1ConnectorName": [(toolId1, "createTicket"), (toolId2, "transferTicket")], "gmail1ConnectorName": [(toolId3, "sendEmail"),..] }
    "a_key": { # The enabled tools on a connector
      "toolInfo": [ # The list of tools with corresponding tool information.
        { # Information to identify a tool.
          "toolDisplayName": "A String", # The display name of the tool.
          "toolName": "A String", # The name of the tool as defined by DataConnectorService.QueryAvailableActions. Note: it's using `action` in the DataConnectorService apis, but they are the same as the `tool` here.
        },
      ],
    },
  },
  "generationConfig": { # Configuration for the generation of the assistant response. # Optional. Configuration for the generation of the assistant response.
    "allowedModelIds": [ # Optional. The list of models that are allowed to be used for assistant.
      "A String",
    ],
    "defaultLanguage": "A String", # The default language to use for the generation of the assistant response. Use an ISO 639-1 language code such as `en`. If not specified, the language will be automatically detected.
    "defaultModelId": "A String", # Optional. The default model to use for assistant.
    "systemInstruction": { # System instruction, also known as the prompt preamble for LLM calls. # System instruction, also known as the prompt preamble for LLM calls. See also https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/system-instructions
      "additionalSystemInstruction": "A String", # Optional. Additional system instruction that will be added to the default system instruction.
    },
  },
  "name": "A String", # Immutable. Resource name of the assistant. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}` It must be a UTF-8 encoded string with a length limit of 1024 characters.
  "webGroundingType": "A String", # Optional. The type of web grounding to use.
}

  assistantId: string, Required. The ID to use for the Assistant, which will become the final component of the Assistant's resource name. This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) with a length limit of 63 characters.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Discovery Engine Assistant resource.
  "customerPolicy": { # Customer-defined policy for the assistant. # Optional. Customer policy for the assistant.
    "bannedPhrases": [ # Optional. List of banned phrases.
      { # Definition of a customer-defined banned phrase. A banned phrase is not allowed to appear in the user query or the LLM response, or else the answer will be refused.
        "ignoreDiacritics": True or False, # Optional. If true, diacritical marks (e.g., accents, umlauts) are ignored when matching banned phrases. For example, "cafe" would match "café".
        "matchType": "A String", # Optional. Match type for the banned phrase.
        "phrase": "A String", # Required. The raw string content to be banned.
      },
    ],
    "modelArmorConfig": { # Configuration for customer defined Model Armor templates to be used for sanitizing user prompts and assistant responses. # Optional. Model Armor configuration to be used for sanitizing user prompts and assistant responses.
      "failureMode": "A String", # Optional. Defines the failure mode for Model Armor sanitization.
      "responseTemplate": "A String", # Optional. The resource name of the Model Armor template for sanitizing assistant responses. Format: `projects/{project}/locations/{location}/templates/{template_id}` If not specified, no sanitization will be applied to the assistant response.
      "userPromptTemplate": "A String", # Optional. The resource name of the Model Armor template for sanitizing user prompts. Format: `projects/{project}/locations/{location}/templates/{template_id}` If not specified, no sanitization will be applied to the user prompt.
    },
  },
  "description": "A String", # Optional. Description for additional information. Expected to be shown on the configuration UI, not to the users of the assistant.
  "disableLocationContext": True or False, # Optional. Indicates whether to disable user location context. By default, user location context is enabled.
  "displayName": "A String", # Required. The assistant display name. It must be a UTF-8 encoded string with a length limit of 128 characters.
  "enabledTools": { # Optional. Note: not implemented yet. Use enabled_actions instead. The enabled tools on this assistant. The keys are connector name, for example "projects/{projectId}/locations/{locationId}/collections/{collectionId}/dataconnector The values consist of admin enabled tools towards the connector instance. Admin can selectively enable multiple tools on any of the connector instances that they created in the project. For example {"jira1ConnectorName": [(toolId1, "createTicket"), (toolId2, "transferTicket")], "gmail1ConnectorName": [(toolId3, "sendEmail"),..] }
    "a_key": { # The enabled tools on a connector
      "toolInfo": [ # The list of tools with corresponding tool information.
        { # Information to identify a tool.
          "toolDisplayName": "A String", # The display name of the tool.
          "toolName": "A String", # The name of the tool as defined by DataConnectorService.QueryAvailableActions. Note: it's using `action` in the DataConnectorService apis, but they are the same as the `tool` here.
        },
      ],
    },
  },
  "generationConfig": { # Configuration for the generation of the assistant response. # Optional. Configuration for the generation of the assistant response.
    "allowedModelIds": [ # Optional. The list of models that are allowed to be used for assistant.
      "A String",
    ],
    "defaultLanguage": "A String", # The default language to use for the generation of the assistant response. Use an ISO 639-1 language code such as `en`. If not specified, the language will be automatically detected.
    "defaultModelId": "A String", # Optional. The default model to use for assistant.
    "systemInstruction": { # System instruction, also known as the prompt preamble for LLM calls. # System instruction, also known as the prompt preamble for LLM calls. See also https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/system-instructions
      "additionalSystemInstruction": "A String", # Optional. Additional system instruction that will be added to the default system instruction.
    },
  },
  "name": "A String", # Immutable. Resource name of the assistant. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}` It must be a UTF-8 encoded string with a length limit of 1024 characters.
  "webGroundingType": "A String", # Optional. The type of web grounding to use.
}
delete(name, x__xgafv=None)
Deletes an Assistant.

Args:
  name: string, Required. Resource name of Assistant. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}` If the caller does not have permission to delete the Assistant, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. If the Assistant to delete does not exist, a NOT_FOUND error is returned. (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
}
get(name, x__xgafv=None)
Gets an Assistant.

Args:
  name: string, Required. Resource name of Assistant. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}` (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Discovery Engine Assistant resource.
  "customerPolicy": { # Customer-defined policy for the assistant. # Optional. Customer policy for the assistant.
    "bannedPhrases": [ # Optional. List of banned phrases.
      { # Definition of a customer-defined banned phrase. A banned phrase is not allowed to appear in the user query or the LLM response, or else the answer will be refused.
        "ignoreDiacritics": True or False, # Optional. If true, diacritical marks (e.g., accents, umlauts) are ignored when matching banned phrases. For example, "cafe" would match "café".
        "matchType": "A String", # Optional. Match type for the banned phrase.
        "phrase": "A String", # Required. The raw string content to be banned.
      },
    ],
    "modelArmorConfig": { # Configuration for customer defined Model Armor templates to be used for sanitizing user prompts and assistant responses. # Optional. Model Armor configuration to be used for sanitizing user prompts and assistant responses.
      "failureMode": "A String", # Optional. Defines the failure mode for Model Armor sanitization.
      "responseTemplate": "A String", # Optional. The resource name of the Model Armor template for sanitizing assistant responses. Format: `projects/{project}/locations/{location}/templates/{template_id}` If not specified, no sanitization will be applied to the assistant response.
      "userPromptTemplate": "A String", # Optional. The resource name of the Model Armor template for sanitizing user prompts. Format: `projects/{project}/locations/{location}/templates/{template_id}` If not specified, no sanitization will be applied to the user prompt.
    },
  },
  "description": "A String", # Optional. Description for additional information. Expected to be shown on the configuration UI, not to the users of the assistant.
  "disableLocationContext": True or False, # Optional. Indicates whether to disable user location context. By default, user location context is enabled.
  "displayName": "A String", # Required. The assistant display name. It must be a UTF-8 encoded string with a length limit of 128 characters.
  "enabledTools": { # Optional. Note: not implemented yet. Use enabled_actions instead. The enabled tools on this assistant. The keys are connector name, for example "projects/{projectId}/locations/{locationId}/collections/{collectionId}/dataconnector The values consist of admin enabled tools towards the connector instance. Admin can selectively enable multiple tools on any of the connector instances that they created in the project. For example {"jira1ConnectorName": [(toolId1, "createTicket"), (toolId2, "transferTicket")], "gmail1ConnectorName": [(toolId3, "sendEmail"),..] }
    "a_key": { # The enabled tools on a connector
      "toolInfo": [ # The list of tools with corresponding tool information.
        { # Information to identify a tool.
          "toolDisplayName": "A String", # The display name of the tool.
          "toolName": "A String", # The name of the tool as defined by DataConnectorService.QueryAvailableActions. Note: it's using `action` in the DataConnectorService apis, but they are the same as the `tool` here.
        },
      ],
    },
  },
  "generationConfig": { # Configuration for the generation of the assistant response. # Optional. Configuration for the generation of the assistant response.
    "allowedModelIds": [ # Optional. The list of models that are allowed to be used for assistant.
      "A String",
    ],
    "defaultLanguage": "A String", # The default language to use for the generation of the assistant response. Use an ISO 639-1 language code such as `en`. If not specified, the language will be automatically detected.
    "defaultModelId": "A String", # Optional. The default model to use for assistant.
    "systemInstruction": { # System instruction, also known as the prompt preamble for LLM calls. # System instruction, also known as the prompt preamble for LLM calls. See also https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/system-instructions
      "additionalSystemInstruction": "A String", # Optional. Additional system instruction that will be added to the default system instruction.
    },
  },
  "name": "A String", # Immutable. Resource name of the assistant. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}` It must be a UTF-8 encoded string with a length limit of 1024 characters.
  "webGroundingType": "A String", # Optional. The type of web grounding to use.
}
list(parent, pageSize=None, pageToken=None, x__xgafv=None)
Lists all Assistants under an Engine.

Args:
  parent: string, Required. The parent resource name. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}` (required)
  pageSize: integer, Maximum number of Assistants to return. If unspecified, defaults to 100. The maximum allowed value is 1000; anything above that will be coerced down to 1000.
  pageToken: string, A page token ListAssistantsResponse.next_page_token, received from a previous AssistantService.ListAssistants call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to ListAssistants must match the call that provided the page token.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response message for the AssistantService.ListAssistants method.
  "assistants": [ # All the customer's Assistants.
    { # Discovery Engine Assistant resource.
      "customerPolicy": { # Customer-defined policy for the assistant. # Optional. Customer policy for the assistant.
        "bannedPhrases": [ # Optional. List of banned phrases.
          { # Definition of a customer-defined banned phrase. A banned phrase is not allowed to appear in the user query or the LLM response, or else the answer will be refused.
            "ignoreDiacritics": True or False, # Optional. If true, diacritical marks (e.g., accents, umlauts) are ignored when matching banned phrases. For example, "cafe" would match "café".
            "matchType": "A String", # Optional. Match type for the banned phrase.
            "phrase": "A String", # Required. The raw string content to be banned.
          },
        ],
        "modelArmorConfig": { # Configuration for customer defined Model Armor templates to be used for sanitizing user prompts and assistant responses. # Optional. Model Armor configuration to be used for sanitizing user prompts and assistant responses.
          "failureMode": "A String", # Optional. Defines the failure mode for Model Armor sanitization.
          "responseTemplate": "A String", # Optional. The resource name of the Model Armor template for sanitizing assistant responses. Format: `projects/{project}/locations/{location}/templates/{template_id}` If not specified, no sanitization will be applied to the assistant response.
          "userPromptTemplate": "A String", # Optional. The resource name of the Model Armor template for sanitizing user prompts. Format: `projects/{project}/locations/{location}/templates/{template_id}` If not specified, no sanitization will be applied to the user prompt.
        },
      },
      "description": "A String", # Optional. Description for additional information. Expected to be shown on the configuration UI, not to the users of the assistant.
      "disableLocationContext": True or False, # Optional. Indicates whether to disable user location context. By default, user location context is enabled.
      "displayName": "A String", # Required. The assistant display name. It must be a UTF-8 encoded string with a length limit of 128 characters.
      "enabledTools": { # Optional. Note: not implemented yet. Use enabled_actions instead. The enabled tools on this assistant. The keys are connector name, for example "projects/{projectId}/locations/{locationId}/collections/{collectionId}/dataconnector The values consist of admin enabled tools towards the connector instance. Admin can selectively enable multiple tools on any of the connector instances that they created in the project. For example {"jira1ConnectorName": [(toolId1, "createTicket"), (toolId2, "transferTicket")], "gmail1ConnectorName": [(toolId3, "sendEmail"),..] }
        "a_key": { # The enabled tools on a connector
          "toolInfo": [ # The list of tools with corresponding tool information.
            { # Information to identify a tool.
              "toolDisplayName": "A String", # The display name of the tool.
              "toolName": "A String", # The name of the tool as defined by DataConnectorService.QueryAvailableActions. Note: it's using `action` in the DataConnectorService apis, but they are the same as the `tool` here.
            },
          ],
        },
      },
      "generationConfig": { # Configuration for the generation of the assistant response. # Optional. Configuration for the generation of the assistant response.
        "allowedModelIds": [ # Optional. The list of models that are allowed to be used for assistant.
          "A String",
        ],
        "defaultLanguage": "A String", # The default language to use for the generation of the assistant response. Use an ISO 639-1 language code such as `en`. If not specified, the language will be automatically detected.
        "defaultModelId": "A String", # Optional. The default model to use for assistant.
        "systemInstruction": { # System instruction, also known as the prompt preamble for LLM calls. # System instruction, also known as the prompt preamble for LLM calls. See also https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/system-instructions
          "additionalSystemInstruction": "A String", # Optional. Additional system instruction that will be added to the default system instruction.
        },
      },
      "name": "A String", # Immutable. Resource name of the assistant. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}` It must be a UTF-8 encoded string with a length limit of 1024 characters.
      "webGroundingType": "A String", # Optional. The type of web grounding to use.
    },
  ],
  "nextPageToken": "A String", # A token that can be sent as ListAssistantsRequest.page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.
}
listAvailableAgentViews(parent, adminView=None, agentOrigin=None, filter=None, languageCode=None, maxSuggestedPrompts=None, pageSize=None, pageToken=None, sortBy=None, x__xgafv=None)
Lists the data for displaying the Agents under an Assistant which are available to the caller.

Args:
  parent: string, Required. The parent resource name. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}` (required)
  adminView: boolean, Optional. Indicates whether to consider if the caller is an admin. If set, and the caller is an admin, the response will consider admin-only permissions. Otherwise, a caller with admin permissions will get a response as an unprivileged user.
  agentOrigin: string, Optional. The origin of the Agent.
    Allowed values
      AGENT_ORIGIN_UNSPECIFIED - The origin is unspecified.
      GOOGLE - Agent defined by Google.
      ORGANIZATION - Agent defined by the organization.
      USER - Agent defined by the user.
  filter: string, Optional. The filter syntax consists of an expression language for constructing a predicate from one or more fields of the files being filtered. Filter expression is case-sensitive. Allowed fields are: * `display_name` * `state` Some examples of filters would be: * `display_name = 'agent_1'` * `display_name = 'agent_1' AND state = ENABLED` For a full description of the filter format, please see https://google.aip.dev/160.
  languageCode: string, Optional. The UI language currently shown to the user. Specifying this field request that the texts in the AgentViews in the response should be translated to this language.
  maxSuggestedPrompts: integer, Optional. The maximum number of suggested prompts to return per agent.
  pageSize: integer, Optional. Maximum number of AgentViewss to return. If unspecified, defaults to 100. The maximum allowed value is 1000; anything above that will be coerced down to 1000.
  pageToken: string, Optional. A page token ListAvailableAgentViewsResponse.next_page_token, received from a previous AgentService.ListAvailableAgentViews call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to ListAvailableAgentViews must match the call that provided the page token.
  sortBy: string, Optional. The field to sort by. Can have the following values: - display-name: The display name of the agent. - description: The description of the agent. - create-time: The creation time of the agent. - state: The state of the agent.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response message for the AgentService.ListAvailableAgentViews method.
  "agentViews": [ # The agent sources visible to the caller under the parent Assistant.
    { # The data for displaying an Agent.
      "agentOrigin": "A String", # Immutable. The origin of the Agent.
      "agentSharingState": "A String", # Output only. The sharing state of the agent.
      "agentType": "A String", # Output only. The type of the agent.
      "customPlaceholderText": "A String", # The custom placeholder text that appears in the text box before the user enters any text.
      "deploymentFailureReason": "A String", # The reason why the agent deployment failed. Only set if the state is DEPLOYMENT_FAILED.
      "description": "A String", # Required. Human-readable description of the agent. This might be used by an LLM to automatically select an agent to respond to a user query and to generate the first version of the steps for the agent that can be modified by the user. The language of this is either Agent.language_code, or ListAvailableAgentViewsRequest.language_code if translations are enabled.
      "displayName": "A String", # Required. Display name of the agent. The language of this is either Agent.language_code, or ListAvailableAgentViewsRequest.language_code if translations are enabled.
      "icon": { # Represents an image. # Optional. The icon that represents the agent on the UI.
        "content": "A String", # Base64-encoded image file contents.
        "uri": "A String", # Image URI.
      },
      "name": "A String", # Resource name of the agent. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}/agents/{agent}`
      "rejectionReason": "A String", # The reason why the agent was rejected. Only set if the state is PRIVATE, and got there via rejection.
      "state": "A String", # Output only. The state of the Agent.
      "suggestedPrompts": [ # Optional. The suggested prompts for the agent, to be shown on the agent landing page.
        { # A suggested prompt for the agent, to be shown on the agent landing page.
          "text": "A String", # Required. The text of the suggested prompt. The language of this is either Agent.language_code, or ListAvailableAgentViewsRequest.language_code if translations are enabled.
        },
      ],
      "suspensionReason": "A String", # The reason why the agent was suspended. Only set if the state is SUSPENDED.
      "userAnnotations": { # Per-user annotations for an Agent, based on UserAnnotation. # Optional. Per-user annotations of the current caller for the agent.
        "pinned": True or False, # Optional. Whether the agent is pinned, pinned agent will be displayed on the top of the agent list.
        "viewed": True or False, # Optional. Whether the agent has been viewed by the user.
      },
      "userPermissions": { # The permissions of the user on an Agent. # The permissions of the user for this Agent.
        "canDelete": True or False, # If the user can delete this Agent.
        "canEdit": True or False, # If the user can edit this Agent.
        "canProposeUsers": True or False, # If the user can propose other users to share the Agent with.
        "canRequestReview": True or False, # If the user can request a review for this Agent.
        "canRun": True or False, # If the user can run this Agent.
        "canView": True or False, # If the user can view the source of this Agent.
        "canWithdraw": True or False, # If the user can withdraw this Agent.
      },
    },
  ],
  "nextPageToken": "A String", # A token that can be sent as ListAvailableAgentViewsRequest.page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.
}
listAvailableAgentViews_next()
Retrieves the next page of results.

        Args:
          previous_request: The request for the previous page. (required)
          previous_response: The response from the request for the previous page. (required)

        Returns:
          A request object that you can call 'execute()' on to request the next
          page. Returns None if there are no more items in the collection.
        
list_next()
Retrieves the next page of results.

        Args:
          previous_request: The request for the previous page. (required)
          previous_response: The response from the request for the previous page. (required)

        Returns:
          A request object that you can call 'execute()' on to request the next
          page. Returns None if there are no more items in the collection.
        
patch(name, body=None, updateMask=None, x__xgafv=None)
Updates an Assistant

Args:
  name: string, Immutable. Resource name of the assistant. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}` It must be a UTF-8 encoded string with a length limit of 1024 characters. (required)
  body: object, The request body.
    The object takes the form of:

{ # Discovery Engine Assistant resource.
  "customerPolicy": { # Customer-defined policy for the assistant. # Optional. Customer policy for the assistant.
    "bannedPhrases": [ # Optional. List of banned phrases.
      { # Definition of a customer-defined banned phrase. A banned phrase is not allowed to appear in the user query or the LLM response, or else the answer will be refused.
        "ignoreDiacritics": True or False, # Optional. If true, diacritical marks (e.g., accents, umlauts) are ignored when matching banned phrases. For example, "cafe" would match "café".
        "matchType": "A String", # Optional. Match type for the banned phrase.
        "phrase": "A String", # Required. The raw string content to be banned.
      },
    ],
    "modelArmorConfig": { # Configuration for customer defined Model Armor templates to be used for sanitizing user prompts and assistant responses. # Optional. Model Armor configuration to be used for sanitizing user prompts and assistant responses.
      "failureMode": "A String", # Optional. Defines the failure mode for Model Armor sanitization.
      "responseTemplate": "A String", # Optional. The resource name of the Model Armor template for sanitizing assistant responses. Format: `projects/{project}/locations/{location}/templates/{template_id}` If not specified, no sanitization will be applied to the assistant response.
      "userPromptTemplate": "A String", # Optional. The resource name of the Model Armor template for sanitizing user prompts. Format: `projects/{project}/locations/{location}/templates/{template_id}` If not specified, no sanitization will be applied to the user prompt.
    },
  },
  "description": "A String", # Optional. Description for additional information. Expected to be shown on the configuration UI, not to the users of the assistant.
  "disableLocationContext": True or False, # Optional. Indicates whether to disable user location context. By default, user location context is enabled.
  "displayName": "A String", # Required. The assistant display name. It must be a UTF-8 encoded string with a length limit of 128 characters.
  "enabledTools": { # Optional. Note: not implemented yet. Use enabled_actions instead. The enabled tools on this assistant. The keys are connector name, for example "projects/{projectId}/locations/{locationId}/collections/{collectionId}/dataconnector The values consist of admin enabled tools towards the connector instance. Admin can selectively enable multiple tools on any of the connector instances that they created in the project. For example {"jira1ConnectorName": [(toolId1, "createTicket"), (toolId2, "transferTicket")], "gmail1ConnectorName": [(toolId3, "sendEmail"),..] }
    "a_key": { # The enabled tools on a connector
      "toolInfo": [ # The list of tools with corresponding tool information.
        { # Information to identify a tool.
          "toolDisplayName": "A String", # The display name of the tool.
          "toolName": "A String", # The name of the tool as defined by DataConnectorService.QueryAvailableActions. Note: it's using `action` in the DataConnectorService apis, but they are the same as the `tool` here.
        },
      ],
    },
  },
  "generationConfig": { # Configuration for the generation of the assistant response. # Optional. Configuration for the generation of the assistant response.
    "allowedModelIds": [ # Optional. The list of models that are allowed to be used for assistant.
      "A String",
    ],
    "defaultLanguage": "A String", # The default language to use for the generation of the assistant response. Use an ISO 639-1 language code such as `en`. If not specified, the language will be automatically detected.
    "defaultModelId": "A String", # Optional. The default model to use for assistant.
    "systemInstruction": { # System instruction, also known as the prompt preamble for LLM calls. # System instruction, also known as the prompt preamble for LLM calls. See also https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/system-instructions
      "additionalSystemInstruction": "A String", # Optional. Additional system instruction that will be added to the default system instruction.
    },
  },
  "name": "A String", # Immutable. Resource name of the assistant. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}` It must be a UTF-8 encoded string with a length limit of 1024 characters.
  "webGroundingType": "A String", # Optional. The type of web grounding to use.
}

  updateMask: string, The list of fields to update.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Discovery Engine Assistant resource.
  "customerPolicy": { # Customer-defined policy for the assistant. # Optional. Customer policy for the assistant.
    "bannedPhrases": [ # Optional. List of banned phrases.
      { # Definition of a customer-defined banned phrase. A banned phrase is not allowed to appear in the user query or the LLM response, or else the answer will be refused.
        "ignoreDiacritics": True or False, # Optional. If true, diacritical marks (e.g., accents, umlauts) are ignored when matching banned phrases. For example, "cafe" would match "café".
        "matchType": "A String", # Optional. Match type for the banned phrase.
        "phrase": "A String", # Required. The raw string content to be banned.
      },
    ],
    "modelArmorConfig": { # Configuration for customer defined Model Armor templates to be used for sanitizing user prompts and assistant responses. # Optional. Model Armor configuration to be used for sanitizing user prompts and assistant responses.
      "failureMode": "A String", # Optional. Defines the failure mode for Model Armor sanitization.
      "responseTemplate": "A String", # Optional. The resource name of the Model Armor template for sanitizing assistant responses. Format: `projects/{project}/locations/{location}/templates/{template_id}` If not specified, no sanitization will be applied to the assistant response.
      "userPromptTemplate": "A String", # Optional. The resource name of the Model Armor template for sanitizing user prompts. Format: `projects/{project}/locations/{location}/templates/{template_id}` If not specified, no sanitization will be applied to the user prompt.
    },
  },
  "description": "A String", # Optional. Description for additional information. Expected to be shown on the configuration UI, not to the users of the assistant.
  "disableLocationContext": True or False, # Optional. Indicates whether to disable user location context. By default, user location context is enabled.
  "displayName": "A String", # Required. The assistant display name. It must be a UTF-8 encoded string with a length limit of 128 characters.
  "enabledTools": { # Optional. Note: not implemented yet. Use enabled_actions instead. The enabled tools on this assistant. The keys are connector name, for example "projects/{projectId}/locations/{locationId}/collections/{collectionId}/dataconnector The values consist of admin enabled tools towards the connector instance. Admin can selectively enable multiple tools on any of the connector instances that they created in the project. For example {"jira1ConnectorName": [(toolId1, "createTicket"), (toolId2, "transferTicket")], "gmail1ConnectorName": [(toolId3, "sendEmail"),..] }
    "a_key": { # The enabled tools on a connector
      "toolInfo": [ # The list of tools with corresponding tool information.
        { # Information to identify a tool.
          "toolDisplayName": "A String", # The display name of the tool.
          "toolName": "A String", # The name of the tool as defined by DataConnectorService.QueryAvailableActions. Note: it's using `action` in the DataConnectorService apis, but they are the same as the `tool` here.
        },
      ],
    },
  },
  "generationConfig": { # Configuration for the generation of the assistant response. # Optional. Configuration for the generation of the assistant response.
    "allowedModelIds": [ # Optional. The list of models that are allowed to be used for assistant.
      "A String",
    ],
    "defaultLanguage": "A String", # The default language to use for the generation of the assistant response. Use an ISO 639-1 language code such as `en`. If not specified, the language will be automatically detected.
    "defaultModelId": "A String", # Optional. The default model to use for assistant.
    "systemInstruction": { # System instruction, also known as the prompt preamble for LLM calls. # System instruction, also known as the prompt preamble for LLM calls. See also https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/system-instructions
      "additionalSystemInstruction": "A String", # Optional. Additional system instruction that will be added to the default system instruction.
    },
  },
  "name": "A String", # Immutable. Resource name of the assistant. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}` It must be a UTF-8 encoded string with a length limit of 1024 characters.
  "webGroundingType": "A String", # Optional. The type of web grounding to use.
}
streamAssist(name, body=None, x__xgafv=None)
Assists the user with a query in a streaming fashion.

Args:
  name: string, Required. The resource name of the Assistant. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}` (required)
  body: object, The request body.
    The object takes the form of:

{ # Request for the AssistantService.StreamAssist method.
  "generationSpec": { # Assistant generation specification for the request. This allows to override the default generation configuration at the engine level. # Optional. Specification of the generation configuration for the request.
    "modelId": "A String", # Optional. The Vertex AI model_id used for the generative model. If not set, the default Assistant model will be used.
  },
  "query": { # Defines a user inputed query. # Optional. Current user query. Empty query is only supported if `file_ids` are provided. In this case, the answer will be generated based on those context files.
    "queryId": "A String", # Output only. Unique Id for the query.
    "text": "A String", # Plain text.
  },
  "session": "A String", # Optional. The session to use for the request. If specified, the assistant has access to the session history, and the query and the answer are stored there. If `-` is specified as the session ID, or it is left empty, then a new session is created with an automatically generated ID. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}`
  "toolsSpec": { # Specification of tools that are used to serve the request. # Optional. Specification of tools that are used to serve the request.
    "imageGenerationSpec": { # Specification of the image generation tool. # Optional. Specification of the image generation tool.
    },
    "vertexAiSearchSpec": { # Specification of the Vertex AI Search tool. # Optional. Specification of the Vertex AI Search tool.
      "dataStoreSpecs": [ # Optional. Specs defining DataStores to filter on in a search call and configurations for those data stores. This is only considered for Engines with multiple data stores.
        { # A struct to define data stores to filter on in a search call and configurations for those data stores. Otherwise, an `INVALID_ARGUMENT` error is returned.
          "boostSpec": { # Boost specification to boost certain documents. # Optional. Boost specification to boost certain documents. For more information on boosting, see [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results)
            "conditionBoostSpecs": [ # Condition boost specifications. If a document matches multiple conditions in the specifications, boost scores from these specifications are all applied and combined in a non-linear way. Maximum number of specifications is 20.
              { # Boost applies to documents which match a condition.
                "boost": 3.14, # Strength of the condition boost, which should be in [-1, 1]. Negative boost means demotion. Default is 0.0. Setting to 1.0 gives the document a big promotion. However, it does not necessarily mean that the boosted document will be the top result at all times, nor that other documents will be excluded. Results could still be shown even when none of them matches the condition. And results that are significantly more relevant to the search query can still trump your heavily favored but irrelevant documents. Setting to -1.0 gives the document a big demotion. However, results that are deeply relevant might still be shown. The document will have an upstream battle to get a fairly high ranking, but it is not blocked out completely. Setting to 0.0 means no boost applied. The boosting condition is ignored. Only one of the (condition, boost) combination or the boost_control_spec below are set. If both are set then the global boost is ignored and the more fine-grained boost_control_spec is applied.
                "boostControlSpec": { # Specification for custom ranking based on customer specified attribute value. It provides more controls for customized ranking than the simple (condition, boost) combination above. # Complex specification for custom ranking based on customer defined attribute value.
                  "attributeType": "A String", # The attribute type to be used to determine the boost amount. The attribute value can be derived from the field value of the specified field_name. In the case of numerical it is straightforward i.e. attribute_value = numerical_field_value. In the case of freshness however, attribute_value = (time.now() - datetime_field_value).
                  "controlPoints": [ # The control points used to define the curve. The monotonic function (defined through the interpolation_type above) passes through the control points listed here.
                    { # The control points used to define the curve. The curve defined through these control points can only be monotonically increasing or decreasing(constant values are acceptable).
                      "attributeValue": "A String", # Can be one of: 1. The numerical field value. 2. The duration spec for freshness: The value must be formatted as an XSD `dayTimeDuration` value (a restricted subset of an ISO 8601 duration value). The pattern for this is: `nDnM]`.
                      "boostAmount": 3.14, # The value between -1 to 1 by which to boost the score if the attribute_value evaluates to the value specified above.
                    },
                  ],
                  "fieldName": "A String", # The name of the field whose value will be used to determine the boost amount.
                  "interpolationType": "A String", # The interpolation type to be applied to connect the control points listed below.
                },
                "condition": "A String", # An expression which specifies a boost condition. The syntax and supported fields are the same as a filter expression. See SearchRequest.filter for detail syntax and limitations. Examples: * To boost documents with document ID "doc_1" or "doc_2", and color "Red" or "Blue": `(document_id: ANY("doc_1", "doc_2")) AND (color: ANY("Red", "Blue"))`
              },
            ],
          },
          "customSearchOperators": "A String", # Optional. Custom search operators which if specified will be used to filter results from workspace data stores. For more information on custom search operators, see [SearchOperators](https://support.google.com/cloudsearch/answer/6172299).
          "dataStore": "A String", # Required. Full resource name of DataStore, such as `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`. The path must include the project number, project id is not supported for this field.
          "filter": "A String", # Optional. Filter specification to filter documents in the data store specified by data_store field. For more information on filtering, see [Filtering](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata)
        },
      ],
      "filter": "A String", # Optional. The filter syntax consists of an expression language for constructing a predicate from one or more fields of the documents being filtered. Filter expression is case-sensitive. If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. Filtering in Vertex AI Search is done by mapping the LHS filter key to a key property defined in the Vertex AI Search backend -- this mapping is defined by the customer in their schema. For example a media customer might have a field 'name' in their schema. In this case the filter would look like this: filter --> name:'ANY("king kong")' For more information about filtering including syntax and filter operators, see [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata)
    },
    "videoGenerationSpec": { # Specification of the video generation tool. # Optional. Specification of the video generation tool.
    },
    "webGroundingSpec": { # Specification of the web grounding tool. # Optional. Specification of the web grounding tool. If field is present, enables grounding with web search. Works only if Assistant.web_grounding_type is WEB_GROUNDING_TYPE_GOOGLE_SEARCH or WEB_GROUNDING_TYPE_ENTERPRISE_WEB_SEARCH.
    },
  },
  "userMetadata": { # User metadata of the request. # Optional. Information about the user initiating the query.
    "preferredLanguageCode": "A String", # Optional. Preferred language to be used for answering if language detection fails. Also used as the language of error messages created by actions, regardless of language detection results.
    "timeZone": "A String", # Optional. IANA time zone, e.g. Europe/Budapest.
  },
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response for the AssistantService.StreamAssist method.
  "answer": { # AssistAnswer resource, main part of AssistResponse. # Assist answer resource object containing parts of the assistant's final answer for the user's query. Not present if the current response doesn't add anything to previously sent AssistAnswer.replies. Observe AssistAnswer.state to see if more parts are to be expected. While the state is `IN_PROGRESS`, the AssistAnswer.replies field in each response will contain replies (reply fragments) to be appended to the ones received in previous responses. AssistAnswer.name won't be filled. If the state is `SUCCEEDED`, `FAILED` or `SKIPPED`, the response is the last response and AssistAnswer.name will have a value.
    "assistSkippedReasons": [ # Reasons for not answering the assist call.
      "A String",
    ],
    "customerPolicyEnforcementResult": { # Customer policy enforcement results. Contains the results of the various policy checks, like the banned phrases or the Model Armor checks. # Optional. The field contains information about the various policy checks' results like the banned phrases or the Model Armor checks. This field is populated only if the assist call was skipped due to a policy violation.
      "policyResults": [ # Customer policy enforcement results. Populated only if the assist call was skipped due to a policy violation. It contains results from those filters that blocked the processing of the query.
        { # Customer policy enforcement result for a single policy type.
          "bannedPhraseEnforcementResult": { # Customer policy enforcement result for the banned phrase policy. # The policy enforcement result for the banned phrase policy.
            "bannedPhrases": [ # The banned phrases that were found in the query or the answer.
              "A String",
            ],
          },
          "modelArmorEnforcementResult": { # Customer policy enforcement result for the Model Armor policy. # The policy enforcement result for the Model Armor policy.
            "error": { # The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). # The error returned by Model Armor if the policy enforcement failed for some reason.
              "code": 42, # The status code, which should be an enum value of google.rpc.Code.
              "details": [ # A list of messages that carry the error details. There is a common set of message types for APIs to use.
                {
                  "a_key": "", # Properties of the object. Contains field @type with type URL.
                },
              ],
              "message": "A String", # 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.
            },
            "modelArmorViolation": "A String", # The Model Armor violation that was found.
          },
        },
      ],
      "verdict": "A String", # Final verdict of the customer policy enforcement. If only one policy blocked the processing, the verdict is BLOCK.
    },
    "name": "A String", # Immutable. Identifier. Resource name of the `AssistAnswer`. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}/assistAnswers/{assist_answer}` This field must be a UTF-8 encoded string with a length limit of 1024 characters.
    "replies": [ # Replies of the assistant.
      { # One part of the multi-part response of the assist call.
        "groundedContent": { # A piece of content and possibly its grounding information. Not all content needs grounding. Phrases like "Of course, I will gladly search it for you." do not need grounding. # Possibly grounded response text or media from the assistant.
          "citationMetadata": { # A collection of source attributions for a piece of content. # Source attribution of the generated content. See also https://cloud.google.com/vertex-ai/generative-ai/docs/learn/overview#citation_check
            "citations": [ # Output only. List of citations.
              { # Source attributions for content.
                "endIndex": 42, # Output only. End index into the content.
                "license": "A String", # Output only. License of the attribution.
                "publicationDate": { # Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp # Output only. Publication date of the attribution.
                  "day": 42, # 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": 42, # Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
                  "year": 42, # Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
                },
                "startIndex": 42, # Output only. Start index into the content.
                "title": "A String", # Output only. Title of the attribution.
                "uri": "A String", # Output only. Url reference of the attribution.
              },
            ],
          },
          "content": { # Multi-modal content. # The content.
            "codeExecutionResult": { # Result of executing ExecutableCode. # Result of executing an ExecutableCode.
              "outcome": "A String", # Required. Outcome of the code execution.
              "output": "A String", # Optional. Contains stdout when code execution is successful, stderr or other description otherwise.
            },
            "executableCode": { # Code generated by the model that is meant to be executed by the model. # Code generated by the model that is meant to be executed.
              "code": "A String", # Required. The code content. Currently only supports Python.
            },
            "file": { # A file, e.g., an audio summary. # A file, e.g., an audio summary.
              "fileId": "A String", # Required. The file ID.
              "mimeType": "A String", # Required. The media type (MIME type) of the file.
            },
            "inlineData": { # Inline blob. # Inline binary data.
              "data": "A String", # Required. Raw bytes.
              "mimeType": "A String", # Required. The media type (MIME type) of the generated data.
            },
            "role": "A String", # The producer of the content. Can be "model" or "user".
            "text": "A String", # Inline text.
            "thought": True or False, # Optional. Indicates if the part is thought from the model.
          },
          "textGroundingMetadata": { # Grounding details for text sources. # Metadata for grounding based on text sources.
            "references": [ # References for the grounded text.
              { # Referenced content and related document metadata.
                "content": "A String", # Referenced text content.
                "documentMetadata": { # Document metadata. # Document metadata.
                  "document": "A String", # Document resource name.
                  "domain": "A String", # Domain name from the document URI. Note that the `uri` field may contain a URL that redirects to the actual website, in which case this will contain the domain name of the target site.
                  "mimeType": "A String", # The mime type of the document. https://www.iana.org/assignments/media-types/media-types.xhtml.
                  "pageIdentifier": "A String", # Page identifier.
                  "title": "A String", # Title.
                  "uri": "A String", # URI for the document. It may contain a URL that redirects to the actual website.
                },
              },
            ],
            "segments": [ # Grounding information for parts of the text.
              { # Grounding information for a segment of the text.
                "endIndex": "A String", # End of the segment, exclusive.
                "groundingScore": 3.14, # Score for the segment.
                "referenceIndices": [ # References for the segment.
                  42,
                ],
                "startIndex": "A String", # Zero-based index indicating the start of the segment, measured in bytes of a UTF-8 string (i.e. characters encoded on multiple bytes have a length of more than one).
                "text": "A String", # The text segment itself.
              },
            ],
          },
        },
        "replyId": "A String", # Output only. When set, uniquely identifies a reply within the `AssistAnswer` resource. During an AssistantService.StreamAssist call, multiple `Reply` messages with the same ID can occur within the response stream (across multiple AssistantService.StreamAssistResponse messages). These represent parts of a single `Reply` message in the final `AssistAnswer` resource.
      },
    ],
    "state": "A String", # State of the answer generation.
  },
  "assistToken": "A String", # A global unique ID that identifies the current pair of request and stream of responses. Used for feedback and support.
  "invocationTools": [ # The tool names of the tools that were invoked.
    "A String",
  ],
  "sessionInfo": { # Information about the session. # Session information. Only included in the final StreamAssistResponse of the response stream.
    "session": "A String", # Name of the newly generated or continued session. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}`.
  },
}