- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- IAM Permissions
- AnswerGenerationMode
- AssistSkippingMode
- AssistUserMetadata
- AssistGenerationConfig
- ToolsSpec
- VertexAiSearchSpec
- WebGroundingSpec
- ImageGenerationSpec
- VideoGenerationSpec
- GenerationSpec
- SessionInfo
- StatusUpdate
- ToolResult
Assists the user with a query in a streaming fashion.
HTTP request
POST https://discoveryengine.googleapis.com/v1alpha/{name=projects/*/locations/*/collections/*/engines/*/assistants/*}:streamAssist
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
name |
Required. The resource name of the |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "query": { object ( |
Fields | |
---|---|
query |
Optional. Current user query. Empty query is only supported if |
answerGenerationMode |
Optional. The answer generation mode. If not specified, it defaults to |
session |
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 Format: |
assistSkippingMode |
Optional. Determines the cases in which the assistant will not answer the query. If the answer is skipped, the reasons will be listed in |
fileIds[] |
Optional. The IDs of the files to be used for answering the request. When uploading a file, its ID is returned in |
userMetadata |
Optional. Information about the user initiating the query. |
languageCode |
Optional. 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. |
googleSearchGroundingEnabled |
Optional. Deprecated. Please refrain from using this field. |
webGroundingEnabled |
Optional. Deprecated. Please refrain from using this field. |
dataStoreSpecs[] |
Optional. Deprecated: Use [dataStoreSpecs][ToolSpec.VertexAiSearchSpec.data_store_specs] instead. Specs defining Not setting this field will result in using all data stores in the engine, except when |
assistGenerationConfig |
Optional. Deprecated. Use |
cannedQuery |
Optional. The resource name of the A session is considered new if there is a If the Format: |
toolsSpec |
Optional. Specification of tools that are used to serve the request. |
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 ( |
Fields | |
---|---|
answer |
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 Observe If the state is |
sessionInfo |
Session information. |
statusUpdates[] |
Optional progress updates. |
assistToken |
A global unique ID that identifies the current pair of request and stream of responses. Used for feedback and support. |
toolResult[] |
Results of tool invocations. |
finalResultToolInvocationId |
If this field is present, it contains the id of the tool invocation whose result is used as the final answer. |
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.
AnswerGenerationMode
Available answer generation modes.
Enums | |
---|---|
ANSWER_GENERATION_MODE_UNSPECIFIED |
Unspecified answer generation mode. |
NORMAL |
Normal answer generation mode. May trigger a few searches and call actions. |
RESEARCH |
Research answer generation mode. Deep dives into the query, triggering many searches for a wide range of topics related to the query. |
AssistSkippingMode
Available skipping behaviors for assist requests.
Enums | |
---|---|
ASSIST_SKIPPING_MODE_UNSPECIFIED |
Default value. The answer can be skipped if the query isn't seeking assistance. |
REQUEST_ASSIST |
Request Assistant answer. The answer may still be skipped if the query fails policy checks. |
AssistUserMetadata
User metadata of the request.
JSON representation |
---|
{ "timeZone": string } |
Fields | |
---|---|
timeZone |
Optional. IANA time zone, e.g. Europe/Budapest. |
AssistGenerationConfig
Assistant generation configuration to be used for the request.
JSON representation |
---|
{ "modelId": string } |
Fields | |
---|---|
modelId |
Optional. The Vertex AI modelId used for the generative model. If not set, the default Assistant model will be used. |
ToolsSpec
Specification of tools that are used to serve the request.
JSON representation |
---|
{ "toolRegistry": string, "vertexAiSearchSpec": { object ( |
Fields | |
---|---|
toolRegistry |
Optional. The name of the tool registry to use. Format: |
vertexAiSearchSpec |
Optional. Specification of the Vertex AI Search tool. |
webGroundingSpec |
Optional. Specification of the web grounding tool. If field is present, enables grounding with web search. Works only if |
imageGenerationSpec |
Optional. Specification of the image generation tool. |
videoGenerationSpec |
Optional. Specification of the video generation tool. |
VertexAiSearchSpec
Specification of the Vertex AI Search tool.
JSON representation |
---|
{
"disabled": boolean,
"dataStoreSpecs": [
{
object ( |
Fields | |
---|---|
disabled |
Optional. Deprecated. Please refrain from using this field. Whether the Vertex AI Search tool is disabled. Default value is false, the tool is enabled by default. |
dataStoreSpecs[] |
Optional. Specs defining |
filter |
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 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
Specification of the web grounding tool.
JSON representation |
---|
{ "enabled": boolean } |
Fields | |
---|---|
enabled |
Optional. Deprecated. Please refrain from using this field. Whether the web grounding tool is enabled. |
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 |
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, "queryId": string } |
Fields | |
---|---|
session |
Name of the newly generated or continued session. Format: |
queryId |
Query ID that corresponds to this assist API call. One session can have multiple turns, each with a unique query ID. By specifying the session name and this query id in the assistants.assist API call, the assist request happens in the context of the search results from this search call. |
StatusUpdate
Update about how the assist call is progressing.
JSON representation |
---|
{ "updateText": string, "invocationId": string } |
Fields | |
---|---|
updateText |
Free text status status update, e.g., 'Starting internal search in HR docs for benefits', or 'Web search for "Moon landing" got 12 results'. |
invocationId |
Unique identifier of the invocation that generates the update. |
ToolResult
(Partial) result of a tool invocation.
JSON representation |
---|
{
"toolInvocationId": string,
"result": {
object ( |
Fields | |
---|---|
toolInvocationId |
Unique identifier of the tool invocation that generates the result. |
result |
Partial content of the result. |