CreateAIPromptCommand

Creates an Amazon Q in Connect AI Prompt.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { QConnectClient, CreateAIPromptCommand } from "@aws-sdk/client-qconnect"; // ES Modules import
// const { QConnectClient, CreateAIPromptCommand } = require("@aws-sdk/client-qconnect"); // CommonJS import
const client = new QConnectClient(config);
const input = { // CreateAIPromptRequest
  clientToken: "STRING_VALUE",
  assistantId: "STRING_VALUE", // required
  name: "STRING_VALUE", // required
  type: "STRING_VALUE", // required
  templateConfiguration: { // AIPromptTemplateConfiguration Union: only one key present
    textFullAIPromptEditTemplateConfiguration: { // TextFullAIPromptEditTemplateConfiguration
      text: "STRING_VALUE", // required
    },
  },
  visibilityStatus: "STRING_VALUE", // required
  templateType: "STRING_VALUE", // required
  modelId: "STRING_VALUE", // required
  apiFormat: "STRING_VALUE", // required
  tags: { // Tags
    "<keys>": "STRING_VALUE",
  },
  description: "STRING_VALUE",
};
const command = new CreateAIPromptCommand(input);
const response = await client.send(command);
// { // CreateAIPromptResponse
//   aiPrompt: { // AIPromptData
//     assistantId: "STRING_VALUE", // required
//     assistantArn: "STRING_VALUE", // required
//     aiPromptId: "STRING_VALUE", // required
//     aiPromptArn: "STRING_VALUE", // required
//     name: "STRING_VALUE", // required
//     type: "STRING_VALUE", // required
//     templateType: "STRING_VALUE", // required
//     modelId: "STRING_VALUE", // required
//     apiFormat: "STRING_VALUE", // required
//     templateConfiguration: { // AIPromptTemplateConfiguration Union: only one key present
//       textFullAIPromptEditTemplateConfiguration: { // TextFullAIPromptEditTemplateConfiguration
//         text: "STRING_VALUE", // required
//       },
//     },
//     modifiedTime: new Date("TIMESTAMP"),
//     description: "STRING_VALUE",
//     visibilityStatus: "STRING_VALUE", // required
//     tags: { // Tags
//       "<keys>": "STRING_VALUE",
//     },
//     origin: "STRING_VALUE",
//     status: "STRING_VALUE",
//   },
// };

CreateAIPromptCommand Input

See CreateAIPromptCommandInput for more details

Parameter
Type
Description
apiFormat
Required
AIPromptAPIFormat | undefined

The API Format of the AI Prompt.

Recommended values: MESSAGES | TEXT_COMPLETIONS

The values ANTHROPIC_CLAUDE_MESSAGES | ANTHROPIC_CLAUDE_TEXT_COMPLETIONS will be deprecated.

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.

modelId
Required
string | undefined

The identifier of the model used for this AI Prompt.

name
Required
string | undefined

The name of the AI Prompt.

templateConfiguration
Required
AIPromptTemplateConfiguration | undefined

The configuration of the prompt template for this AI Prompt.

templateType
Required
AIPromptTemplateType | undefined

The type of the prompt template for this AI Prompt.

type
Required
AIPromptType | undefined

The type of this AI Prompt.

visibilityStatus
Required
VisibilityStatus | undefined

The visibility status of the AI Prompt.

clientToken
string | undefined

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs ..

description
string | undefined

The description of the AI Prompt.

tags
Record<string, string> | undefined

The tags used to organize, track, or control access for this resource.

CreateAIPromptCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
aiPrompt
AIPromptData | undefined

The data of the AI Prompt.

Throws

Name
Fault
Details
AccessDeniedException
client

You do not have sufficient access to perform this action.

ConflictException
client

The request could not be processed because of conflict in the current state of the resource. For example, if you're using a Create API (such as CreateAssistant) that accepts name, a conflicting resource (usually with the same name) is being created or mutated.

ResourceNotFoundException
client

The specified resource does not exist.

ServiceQuotaExceededException
client

You've exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use service quotas to request a service quota increase.

ThrottlingException
client

The throttling limit has been exceeded.

ValidationException
client

The input fails to satisfy the constraints specified by a service.

QConnectServiceException
Base exception class for all service exceptions from QConnect service.