- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
QueryAssistantCommand
- QueryAssistant 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 Connect console and integrate the Amazon Q in Connect JavaScript library (amazon-q-connectjs) into your applications.
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 .
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { QConnectClient, QueryAssistantCommand } from "@aws-sdk/client-qconnect"; // ES Modules import
// const { QConnectClient, QueryAssistantCommand } = require("@aws-sdk/client-qconnect"); // CommonJS import
const client = new QConnectClient(config);
const input = { // QueryAssistantRequest
assistantId: "STRING_VALUE", // required
queryText: "STRING_VALUE",
nextToken: "STRING_VALUE",
maxResults: Number("int"),
sessionId: "STRING_VALUE",
queryCondition: [ // QueryConditionExpression
{ // QueryCondition Union: only one key present
single: { // QueryConditionItem
field: "STRING_VALUE", // required
comparator: "STRING_VALUE", // required
value: "STRING_VALUE", // required
},
},
],
queryInputData: { // QueryInputData Union: only one key present
queryTextInputData: { // QueryTextInputData
text: "STRING_VALUE", // required
},
intentInputData: { // IntentInputData
intentId: "STRING_VALUE", // required
},
},
overrideKnowledgeBaseSearchType: "STRING_VALUE",
};
const command = new QueryAssistantCommand(input);
const response = await client.send(command);
// { // QueryAssistantResponse
// results: [ // QueryResultsList // required
// { // ResultData
// resultId: "STRING_VALUE", // required
// document: { // Document
// contentReference: { // ContentReference
// knowledgeBaseArn: "STRING_VALUE",
// knowledgeBaseId: "STRING_VALUE",
// contentArn: "STRING_VALUE",
// contentId: "STRING_VALUE",
// sourceURL: "STRING_VALUE",
// referenceType: "STRING_VALUE",
// },
// title: { // DocumentText
// text: "STRING_VALUE",
// highlights: [ // Highlights
// { // Highlight
// beginOffsetInclusive: Number("int"),
// endOffsetExclusive: Number("int"),
// },
// ],
// },
// excerpt: {
// text: "STRING_VALUE",
// highlights: [
// {
// beginOffsetInclusive: Number("int"),
// endOffsetExclusive: Number("int"),
// },
// ],
// },
// },
// relevanceScore: Number("double"),
// data: { // DataSummary
// reference: { // DataReference Union: only one key present
// contentReference: {
// knowledgeBaseArn: "STRING_VALUE",
// knowledgeBaseId: "STRING_VALUE",
// contentArn: "STRING_VALUE",
// contentId: "STRING_VALUE",
// sourceURL: "STRING_VALUE",
// referenceType: "STRING_VALUE",
// },
// generativeReference: { // GenerativeReference
// modelId: "STRING_VALUE",
// generationId: "STRING_VALUE",
// },
// },
// details: { // DataDetails Union: only one key present
// contentData: { // ContentDataDetails
// textData: { // TextData
// title: {
// text: "STRING_VALUE",
// highlights: [
// {
// beginOffsetInclusive: Number("int"),
// endOffsetExclusive: Number("int"),
// },
// ],
// },
// excerpt: {
// text: "STRING_VALUE",
// highlights: [
// {
// beginOffsetInclusive: Number("int"),
// endOffsetExclusive: Number("int"),
// },
// ],
// },
// },
// rankingData: { // RankingData
// relevanceScore: Number("double"),
// relevanceLevel: "STRING_VALUE",
// },
// },
// generativeData: { // GenerativeDataDetails
// completion: "STRING_VALUE", // required
// references: [ // DataSummaryList // required
// {
// reference: {// Union: only one key present
// contentReference: "<ContentReference>",
// generativeReference: {
// modelId: "STRING_VALUE",
// generationId: "STRING_VALUE",
// },
// },
// details: {// Union: only one key present
// contentData: {
// textData: {
// title: "<DocumentText>",
// excerpt: "<DocumentText>",
// },
// rankingData: {
// relevanceScore: Number("double"),
// relevanceLevel: "STRING_VALUE",
// },
// },
// generativeData: {
// completion: "STRING_VALUE", // required
// references: [ // required
// "<DataSummary>",
// ],
// rankingData: {
// relevanceScore: Number("double"),
// relevanceLevel: "STRING_VALUE",
// },
// },
// intentDetectedData: { // IntentDetectedDataDetails
// intent: "STRING_VALUE", // required
// intentId: "STRING_VALUE", // required
// },
// sourceContentData: { // SourceContentDataDetails
// id: "STRING_VALUE", // required
// type: "STRING_VALUE", // required
// textData: {
// title: "<DocumentText>",
// excerpt: "<DocumentText>",
// },
// rankingData: {
// relevanceScore: Number("double"),
// relevanceLevel: "STRING_VALUE",
// },
// citationSpan: { // CitationSpan
// beginOffsetInclusive: Number("int"),
// endOffsetExclusive: Number("int"),
// },
// },
// generativeChunkData: { // GenerativeChunkDataDetails
// completion: "STRING_VALUE",
// references: [
// "<DataSummary>",
// ],
// nextChunkToken: "STRING_VALUE",
// },
// },
// },
// ],
// rankingData: {
// relevanceScore: Number("double"),
// relevanceLevel: "STRING_VALUE",
// },
// },
// intentDetectedData: {
// intent: "STRING_VALUE", // required
// intentId: "STRING_VALUE", // required
// },
// sourceContentData: {
// id: "STRING_VALUE", // required
// type: "STRING_VALUE", // required
// textData: {
// title: "<DocumentText>",
// excerpt: "<DocumentText>",
// },
// rankingData: "<RankingData>", // required
// citationSpan: {
// beginOffsetInclusive: Number("int"),
// endOffsetExclusive: Number("int"),
// },
// },
// generativeChunkData: {
// completion: "STRING_VALUE",
// references: [
// "<DataSummary>",
// ],
// nextChunkToken: "STRING_VALUE",
// },
// },
// },
// type: "STRING_VALUE",
// },
// ],
// nextToken: "STRING_VALUE",
// };
QueryAssistantCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
assistantId Required | string | undefined | The identifier of the Amazon Q in Connect assistant. Can be either the ID or the ARN. URLs cannot contain the ARN. |
maxResults | number | undefined | The maximum number of results to return per page. |
nextToken | string | undefined | 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. |
overrideKnowledgeBaseSearchType | KnowledgeBaseSearchType | undefined | The search type to be used against the Knowledge Base for this request. The values can be |
queryCondition | QueryCondition[] | undefined | Information about how to query content. |
queryInputData | QueryInputData | undefined | Information about the query. |
queryText | string | undefined | The text to search for. |
sessionId | string | undefined | The identifier of the Amazon Q in Connect session. Can be either the ID or the ARN. URLs cannot contain the ARN. |
QueryAssistantCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
results Required | ResultData[] | undefined | The results of the query. |
nextToken | string | undefined | If there are additional results, this is the token for the next set of results. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDeniedException | client | You do not have sufficient access to perform this action. |
RequestTimeoutException | client | The request reached the service more than 15 minutes after the date stamp on the request or more than 15 minutes after the request expiration date (such as for pre-signed URLs), or the date stamp on the request is more than 15 minutes in the future. |
ResourceNotFoundException | client | The specified resource does not exist. |
ValidationException | client | The input fails to satisfy the constraints specified by a service. |
QConnectServiceException | Base exception class for all service exceptions from QConnect service. |