Skip to content

ConversationExchangeServiceModel

Scoped exchange service for a specific conversation. Auto-fills conversationId from the conversation.

Methods

createFeedback()

createFeedback(exchangeId: string, options: CreateFeedbackOptions): Promise<FeedbackCreateResponse>

Creates feedback for an exchange

Parameters

Parameter Type Description
exchangeId string The exchange to provide feedback for
options CreateFeedbackOptions Feedback data including rating and optional comment

Returns

Promise<FeedbackCreateResponse>

Promise resolving to the feedback creation response

Example

await conversation.exchanges.createFeedback(exchangeId, {
  rating: FeedbackRating.Positive,
  comment: 'Very helpful!'
});

getAll()

getAll(options?: ExchangeGetAllOptions): Promise<PaginatedResponse<ExchangeGetResponse>>

Gets exchanges for this conversation with pagination and optional sort parameters

Returns a paginated response. When called without pageSize/cursor, the backend applies its default page size — inspect hasNextPage/nextCursor to navigate further pages.

Parameters

Parameter Type Description
options? ExchangeGetAllOptions Options for querying exchanges including optional pagination parameters

Returns

Promise<PaginatedResponse<ExchangeGetResponse>>

Promise resolving to a PaginatedResponse<ExchangeGetResponse>

Examples

const conversation = await conversationalAgent.conversations.getById(conversationId);

// First page
const firstPage = await conversation.exchanges.getAll();

// Navigate using cursor
if (firstPage.hasNextPage) {
  const nextPage = await conversation.exchanges.getAll({ cursor: firstPage.nextCursor });
}
import { SortOrder } from '@uipath/uipath-typescript/conversational-agent';

const conversation = await conversationalAgent.conversations.getById(conversationId);

// First page
const firstPage = await conversation.exchanges.getAll({
  pageSize: 10,
  exchangeSort: SortOrder.Descending,
  messageSort: SortOrder.Ascending
});

// Navigate using cursor and same parameters
if (firstPage.hasNextPage) {
  const nextPage = await conversation.exchanges.getAll({
    pageSize: 10,
    exchangeSort: SortOrder.Descending,
    messageSort: SortOrder.Ascending,
    cursor: firstPage.nextCursor
  });
}

getById()

getById(exchangeId: string, options?: ExchangeGetByIdOptions): Promise<ExchangeGetResponse>

Gets an exchange by ID with its messages

Parameters

Parameter Type Description
exchangeId string The exchange ID to retrieve
options? ExchangeGetByIdOptions Optional parameters for message sorting

Returns

Promise<ExchangeGetResponse>

Promise resolving to the exchange with messages

Example

const exchange = await conversation.exchanges.getById(exchangeId);
for (const message of exchange.messages) {
  console.log(message.role, message.contentParts);
}