Starting from version 2.20.0 of QuickBlox iOS SDK, the AI functionality is enabled and based on our SmartChat Assistants. The QuickBlox iOS SDK provides a range of features to enhance the chat experience. With essential messaging functionalities such as answer assistant, users can engage in more interactive conversations.
Supported features
Name
Description
AI Assist
Provides answers based on chat history to selected message.
AI Translate
Provides translation based on chat history to selected incoming message.
let smartChatAssistantId = "XXXXXXXXXXXXXXXXXXXXXXXX"let messageToAssist = "What is Quickblox?"let history = [QBAIAnswerAssistHistoryMessage(role: .assistant, message: "History message"), QBAIAnswerAssistHistoryMessage(role: .user, message: "Hi"), QBAIAnswerAssistHistoryMessage(role: .assistant, message: "Hello! How can I assist you today?")]let result = try await QB.ai.answerAssist(withSmartChatAssistantId: smartChatAssistantId, messageToAssist: messageToAssist, history: history)let answer = result.answer// handle answer
let smartChatAssistantId = "XXXXXXXXXXXXXXXXXXXXXXXX"let messageToAssist = "What is Quickblox?"let history = [QBAIAnswerAssistHistoryMessage(role: .assistant, message: "History message"), QBAIAnswerAssistHistoryMessage(role: .user, message: "Hi"), QBAIAnswerAssistHistoryMessage(role: .assistant, message: "Hello! How can I assist you today?")]let result = try await QB.ai.answerAssist(withSmartChatAssistantId: smartChatAssistantId, messageToAssist: messageToAssist, history: history)let answer = result.answer// handle answer
let smartChatAssistantId = "XXXXXXXXXXXXXXXXXXXXXXXX"let messageToAssist = "What is Quickblox?"let history = [QBAIAnswerAssistHistoryMessage(role: .assistant, message: "History message"), QBAIAnswerAssistHistoryMessage(role: .user, message: "Hi"), QBAIAnswerAssistHistoryMessage(role: .assistant, message: "Hello! How can I assist you today?")]QB.ai.answerAssist(withSmartChatAssistantId: smartChatAssistantId, messageToAssist: messageToAssist, history: history) { result, error in if let error = error { // handle error return } let answer = result.answer // handle answer}
NSString *smartChatAssistantId = @"XXXXXXXXXXXXXXXXXXXXXXXX";NSString *messageToAssist = @"What is Quickblox?";NSArray *history = @[ [[QBAIAnswerAssistHistoryMessage alloc] initWithRole:QBAIRoleTypeAssistant message:@"History message"], [[QBAIAnswerAssistHistoryMessage alloc] initWithRole:QBAIRoleTypeUser message:@"Hi"], [[QBAIAnswerAssistHistoryMessage alloc] initWithRole:QBAIRoleTypeAssistant message:@"Hello! How can I assist you today?"]];[QB.ai answerAssistWithSmartChatAssistantId:smartChatAssistantId messageToAssist:messageToAssist history:history completion:^(id<QBAIAnswerAssistResultProtocol> _Nonnull result, NSError * _Nullable error) { if (error) { // handle error return; } NSString *answer = result.answer; // handle answer}];
Parameter name
Type
Description
smartChatAssistantId
String
This field should hold your actual Smart Chat Assistant ID that you’ll receive from the Quickblox account. This ID is used to authenticate your requests to the AI service.
messageToAssist
String
Message you want to get answer for.
history
Array of Object
Conversation history. Used to add context. Each object of array should have the two fields: ‘role’ and ‘message’. The field role should contains one of next values: ‘user’ or ‘assistant’. The field message should be a string with chat message.
QuickBlox offers translation functionality that helps users easily translate text messages in chat, taking into account the context of the chat history.
This field should hold your actual Smart Chat Assistant ID that you’ll receive from the Quickblox account. This ID is used to authenticate your requests to the AI service.