Class CreateAssistantMessageCommand

Create a new message from the user to the assistant.

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

import { Apiv2Client, CreateAssistantMessageCommand } from "@codegrade/apiv2-client"; // ES Modules import
// const { Apiv2Client, CreateAssistantMessageCommand } = require("@codegrade/apiv2-client"); // CommonJS import
const client = new Apiv2Client(config);
const input = { // CreateAssistantMessageRequest
assistantId: "STRING_VALUE", // required
conversationId: "STRING_VALUE", // required
content: { // AssistantMessageUserContent Union: only one key present
text: "STRING_VALUE",
},
};
const command = new CreateAssistantMessageCommand(input);
const response = await client.send(command);
// { // CreateAssistantMessageResponse
// message: { // AssistantMessage
// assistantId: "STRING_VALUE", // required
// conversationId: "STRING_VALUE", // required
// messageId: "STRING_VALUE", // required
// createdAt: new Date("TIMESTAMP"), // required
// data: { // AssistantMessageData Union: only one key present
// user: { // AssistantMessageUserData
// content: { // AssistantMessageUserContent Union: only one key present
// text: "STRING_VALUE",
// },
// author: { // User
// id: "STRING_VALUE", // required
// username: "STRING_VALUE", // required
// name: "STRING_VALUE",
// tenantId: "STRING_VALUE",
// isTestStudent: true || false, // required
// },
// },
// assistant: { // AssistantMessageAssistantData
// content: { // AssistantMessageAssistantContent Union: only one key present
// text: "STRING_VALUE",
// },
// stopReason: { // AssistantMessageStopReason Union: only one key present
// endTurn: {},
// maxTokens: { // AssistantMessageStopMaxTokens
// maxTokens: Number("int"), // required
// },
// },
// },
// },
// },
// };

CreateAssistantMessageCommandInput

InternalServerError (server fault) An internal failure at the fault of the server.

BadRequestError (client fault) An error at the fault of the client sending invalid input.

NotFoundError (client fault) An error due to the client attempting to access a missing resource.

NotAuthorizedError (client fault) An error due to the client not being authorized to access the resource.

NotAuthenticatedError (client fault) An error due to the client not being authenticated.

ValidationError (client fault) A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.

Apiv2ServiceException

Base exception class for all service exceptions from Apiv2 service.

Hierarchy

Constructors

  • Returns CreateAssistantMessageCommand

  • Parameters

    Returns CreateAssistantMessageCommand

Properties

middlewareStack: MiddlewareStack<
    CreateAssistantMessageCommandInput,
    CreateAssistantMessageCommandOutput,
>
schema?: OperationSchema

This should be OperationSchema from @smithy/types, but would create problems with the client transform type adaptors.

__types: {
    api: {
        input: CreateAssistantMessageRequest;
        output: CreateAssistantMessageResponse;
    };
    sdk: {
        input: CreateAssistantMessageCommandInput;
        output: CreateAssistantMessageCommandOutput;
    };
}

type navigation helper, not in runtime.

Methods

  • Internal

    Parameters

    • clientStack: MiddlewareStack<any, any>
    • configuration: { logger: Logger; requestHandler: RequestHandler<any, any, any> }
    • options: any
    • __namedParameters: ResolveMiddlewareContextArgs

    Returns InitializeHandler<any, CreateAssistantMessageCommandOutput>

  • Returns EndpointParameterInstructions