QConnect / Client / query_assistant
query_assistant#
- QConnect.Client.query_assistant(**kwargs)#
Warning
This API will be discontinued starting June 1, 2024. To receive generative responses after March 1, 2024, you will need to create a new Assistant in the Amazon Connect console and integrate the Amazon Q in Connect JavaScript library (amazon-q-connectjs) into your applications.
Performs a manual search against the specified assistant. To retrieve recommendations for an assistant, use GetRecommendations.
Danger
This operation is deprecated and may not function as expected. This operation should not be used going forward and is only kept for the purpose of backwards compatiblity.
See also: AWS API Documentation
Request Syntax
response = client.query_assistant( assistantId='string', maxResults=123, nextToken='string', queryCondition=[ { 'single': { 'comparator': 'EQUALS', 'field': 'RESULT_TYPE', 'value': 'string' } }, ], queryText='string', sessionId='string' )
- Parameters:
assistantId (string) –
[REQUIRED]
The identifier of the Amazon Q in Connect assistant. Can be either the ID or the ARN. URLs cannot contain the ARN.
maxResults (integer) – The maximum number of results to return per page.
nextToken (string) – The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.
queryCondition (list) –
Information about how to query content.
(dict) –
Information about how to query content.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
single
.single (dict) –
The condition for the query.
comparator (string) – [REQUIRED]
The comparison operator for query condition to query on.
field (string) – [REQUIRED]
The name of the field for query condition to query on.
value (string) – [REQUIRED]
The value for the query condition to query on.
queryText (string) –
[REQUIRED]
The text to search for.
sessionId (string) – The identifier of the Amazon Q in Connect session. Can be either the ID or the ARN. URLs cannot contain the ARN.
- Return type:
dict
- Returns:
Response Syntax
{ 'nextToken': 'string', 'results': [ { 'data': { 'details': { 'contentData': { 'rankingData': { 'relevanceLevel': 'HIGH'|'MEDIUM'|'LOW', 'relevanceScore': 123.0 }, 'textData': { 'excerpt': { 'highlights': [ { 'beginOffsetInclusive': 123, 'endOffsetExclusive': 123 }, ], 'text': 'string' }, 'title': { 'highlights': [ { 'beginOffsetInclusive': 123, 'endOffsetExclusive': 123 }, ], 'text': 'string' } } }, 'generativeData': { 'completion': 'string', 'rankingData': { 'relevanceLevel': 'HIGH'|'MEDIUM'|'LOW', 'relevanceScore': 123.0 }, 'references': [ {'... recursive ...'}, ] }, 'sourceContentData': { 'id': 'string', 'rankingData': { 'relevanceLevel': 'HIGH'|'MEDIUM'|'LOW', 'relevanceScore': 123.0 }, 'textData': { 'excerpt': { 'highlights': [ { 'beginOffsetInclusive': 123, 'endOffsetExclusive': 123 }, ], 'text': 'string' }, 'title': { 'highlights': [ { 'beginOffsetInclusive': 123, 'endOffsetExclusive': 123 }, ], 'text': 'string' } }, 'type': 'KNOWLEDGE_CONTENT' } }, 'reference': { 'contentReference': { 'contentArn': 'string', 'contentId': 'string', 'knowledgeBaseArn': 'string', 'knowledgeBaseId': 'string' }, 'generativeReference': { 'generationId': 'string', 'modelId': 'string' } } }, 'document': { 'contentReference': { 'contentArn': 'string', 'contentId': 'string', 'knowledgeBaseArn': 'string', 'knowledgeBaseId': 'string' }, 'excerpt': { 'highlights': [ { 'beginOffsetInclusive': 123, 'endOffsetExclusive': 123 }, ], 'text': 'string' }, 'title': { 'highlights': [ { 'beginOffsetInclusive': 123, 'endOffsetExclusive': 123 }, ], 'text': 'string' } }, 'relevanceScore': 123.0, 'resultId': 'string', 'type': 'KNOWLEDGE_CONTENT'|'GENERATIVE_ANSWER' }, ] }
Response Structure
(dict) –
nextToken (string) –
If there are additional results, this is the token for the next set of results.
results (list) –
The results of the query.
(dict) –
Information about the result.
data (dict) –
Summary of the recommended content.
details (dict) –
Details about the data.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
contentData
,generativeData
,sourceContentData
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
contentData (dict) –
Details about the content data.
rankingData (dict) –
Details about the content ranking data.
relevanceLevel (string) –
The relevance score of the content.
relevanceScore (float) –
The relevance level of the recommendation.
textData (dict) –
Details about the content text data.
excerpt (dict) –
The text of the document.
highlights (list) –
Highlights in the document text.
(dict) –
Offset specification to describe highlighting of document excerpts for rendering search results and recommendations.
beginOffsetInclusive (integer) –
The offset for the start of the highlight.
endOffsetExclusive (integer) –
The offset for the end of the highlight.
text (string) –
Text in the document.
title (dict) –
The text of the document.
highlights (list) –
Highlights in the document text.
(dict) –
Offset specification to describe highlighting of document excerpts for rendering search results and recommendations.
beginOffsetInclusive (integer) –
The offset for the start of the highlight.
endOffsetExclusive (integer) –
The offset for the end of the highlight.
text (string) –
Text in the document.
generativeData (dict) –
Details about the generative data.
completion (string) –
The LLM response.
rankingData (dict) –
Details about the generative content ranking data.
relevanceLevel (string) –
The relevance score of the content.
relevanceScore (float) –
The relevance level of the recommendation.
references (list) –
The references used to generative the LLM response.
(dict) –
Summary of the data.
sourceContentData (dict) –
Details about the content data.
id (string) –
The identifier of the source content.
rankingData (dict) –
Details about the source content ranking data.
relevanceLevel (string) –
The relevance score of the content.
relevanceScore (float) –
The relevance level of the recommendation.
textData (dict) –
Details about the source content text data.
excerpt (dict) –
The text of the document.
highlights (list) –
Highlights in the document text.
(dict) –
Offset specification to describe highlighting of document excerpts for rendering search results and recommendations.
beginOffsetInclusive (integer) –
The offset for the start of the highlight.
endOffsetExclusive (integer) –
The offset for the end of the highlight.
text (string) –
Text in the document.
title (dict) –
The text of the document.
highlights (list) –
Highlights in the document text.
(dict) –
Offset specification to describe highlighting of document excerpts for rendering search results and recommendations.
beginOffsetInclusive (integer) –
The offset for the start of the highlight.
endOffsetExclusive (integer) –
The offset for the end of the highlight.
text (string) –
Text in the document.
type (string) –
The type of the source content.
reference (dict) –
Reference information about the content.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
contentReference
,generativeReference
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
contentReference (dict) –
Reference information about the content.
contentArn (string) –
The Amazon Resource Name (ARN) of the content.
contentId (string) –
The identifier of the content.
knowledgeBaseArn (string) –
The Amazon Resource Name (ARN) of the knowledge base.
knowledgeBaseId (string) –
The identifier of the knowledge base. This should not be a QUICK_RESPONSES type knowledge base.
generativeReference (dict) –
Reference information about the generative content.
generationId (string) –
The identifier of the LLM model.
modelId (string) –
The identifier of the LLM model.
document (dict) –
The document.
contentReference (dict) –
A reference to the content resource.
contentArn (string) –
The Amazon Resource Name (ARN) of the content.
contentId (string) –
The identifier of the content.
knowledgeBaseArn (string) –
The Amazon Resource Name (ARN) of the knowledge base.
knowledgeBaseId (string) –
The identifier of the knowledge base. This should not be a QUICK_RESPONSES type knowledge base.
excerpt (dict) –
The excerpt from the document.
highlights (list) –
Highlights in the document text.
(dict) –
Offset specification to describe highlighting of document excerpts for rendering search results and recommendations.
beginOffsetInclusive (integer) –
The offset for the start of the highlight.
endOffsetExclusive (integer) –
The offset for the end of the highlight.
text (string) –
Text in the document.
title (dict) –
The title of the document.
highlights (list) –
Highlights in the document text.
(dict) –
Offset specification to describe highlighting of document excerpts for rendering search results and recommendations.
beginOffsetInclusive (integer) –
The offset for the start of the highlight.
endOffsetExclusive (integer) –
The offset for the end of the highlight.
text (string) –
Text in the document.
relevanceScore (float) –
The relevance score of the results.
resultId (string) –
The identifier of the result data.
type (string) –
The type of the query result.
Exceptions
QConnect.Client.exceptions.RequestTimeoutException
QConnect.Client.exceptions.ValidationException
QConnect.Client.exceptions.AccessDeniedException
QConnect.Client.exceptions.ResourceNotFoundException