Method: projects.locations.collections.engines.assistants.streamAssist

Assists the user with a query in a streaming fashion.

HTTP request

POST https://discoveryengine.googleapis.com/v1beta/{name=projects/*/locations/*/collections/*/engines/*/assistants/*}:streamAssist

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
name

string

Required. The resource name of the Assistant. Format: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}

Request body

The request body contains data with the following structure:

JSON representation
{
  "query": {
    object (Query)
  },
  "session": string,
  "userMetadata": {
    object (AssistUserMetadata)
  },
  "agentsSpec": {
    object (AgentsSpec)
  },
  "toolsSpec": {
    object (ToolsSpec)
  },
  "generationSpec": {
    object (GenerationSpec)
  }
}
Fields
query

object (Query)

Optional. Current user query.

Empty query is only supported if fileIds are provided. In this case, the answer will be generated based on those context files.

session

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}

userMetadata

object (AssistUserMetadata)

Optional. Information about the user initiating the query.

agentsSpec

object (AgentsSpec)

Optional. Specification of agents that are used to serve the request.

toolsSpec

object (ToolsSpec)

Optional. Specification of tools that are used to serve the request.

generationSpec

object (GenerationSpec)

Optional. Specification of the generation configuration for the request.

Response body

Response for the AssistantService.StreamAssist method.

If successful, the response body contains data with the following structure:

JSON representation
{
  "answer": {
    object (AssistAnswer)
  },
  "sessionInfo": {
    object (SessionInfo)
  },
  "assistToken": string
}
Fields
answer

object (AssistAnswer)

assistants.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.

sessionInfo

object (SessionInfo)

Session information.

assistToken

string

A global unique ID that identifies the current pair of request and stream of responses. Used for feedback and support.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • discoveryengine.assistants.assist

For more information, see the IAM documentation.

AssistUserMetadata

User metadata of the request.

JSON representation
{
  "timeZone": string,
  "preferredLanguageCode": string
}
Fields
timeZone

string

Optional. IANA time zone, e.g. Europe/Budapest.

preferredLanguageCode

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.

AgentsSpec

Specification of agents that are used to serve the request.

JSON representation
{
  "agentSpecs": [
    {
      object (AgentSpec)
    }
  ]
}
Fields
agentSpecs[]

object (AgentSpec)

Optional. Specification of agents that are used to serve the request.

AgentSpec

Specification of an agent.

JSON representation
{
  "agentId": string
}
Fields
agentId

string

Required. id to identify the agent resource serving the request.

This field must conform to RFC-1034 with a length limit of 63 characters.

ToolsSpec

Specification of tools that are used to serve the request.

JSON representation
{
  "vertexAiSearchSpec": {
    object (VertexAiSearchSpec)
  },
  "webGroundingSpec": {
    object (WebGroundingSpec)
  },
  "imageGenerationSpec": {
    object (ImageGenerationSpec)
  },
  "videoGenerationSpec": {
    object (VideoGenerationSpec)
  }
}
Fields
vertexAiSearchSpec

object (VertexAiSearchSpec)

Optional. Specification of the Vertex AI Search tool.

webGroundingSpec

object (WebGroundingSpec)

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][].

imageGenerationSpec

object (ImageGenerationSpec)

Optional. Specification of the image generation tool.

videoGenerationSpec

object (VideoGenerationSpec)

Optional. Specification of the video generation tool.

VertexAiSearchSpec

Specification of the Vertex AI Search tool.

JSON representation
{
  "dataStoreSpecs": [
    {
      object (DataStoreSpec)
    }
  ],
  "filter": string
}
Fields
dataStoreSpecs[]

object (DataStoreSpec)

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.

filter

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

WebGroundingSpec

This type has no fields.

Specification of the web grounding tool.

ImageGenerationSpec

This type has no fields.

Specification of the image generation tool.

VideoGenerationSpec

This type has no fields.

Specification of the video generation tool.

GenerationSpec

Assistant generation specification for the request. This allows to override the default generation configuration at the engine level.

JSON representation
{
  "modelId": string
}
Fields
modelId

string

Optional. The Vertex AI modelId used for the generative model. If not set, the default Assistant model will be used.

SessionInfo

Information about the session.

JSON representation
{
  "session": string
}
Fields
session

string

Name of the newly generated or continued session.

Format: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}.