
Искусственный интеллект и машинное обучение уже много лет являются движущей силой инноваций в различных отраслях. Как компании, так и частные лица используют чат-ботов для автоматизации разговоров, обработки запросов в службу поддержки и даже для создания собственных персональных виртуальных помощников.
Однако создание чат-бота, который точно отвечает на запросы и понимает естественный язык, может быть сложным и трудным процессом.
Я даю вам CustomGPT — революционную библиотеку для обучения чат-ботов для NodeJS, которая позволяет вам обучать чат-бота на ваших собственных данных.
О CustomGPT
CustomGPT — это клиентская библиотека для NodeJS, которая позволяет вам обучать модель GPT-3 с помощью ваших собственных данных. Он предоставляет простой и удобный в использовании интерфейс, который позволяет обучать и настраивать чат-бота с помощью всего нескольких строк кода. С помощью CustomGPT вы можете настроить модель, чтобы понять конкретные потребности и нюансы вашего бизнеса или отрасли, в результате чего получится высокоинтеллектуальный чат-бот, который точно отвечает на запросы и взаимодействует с вашими клиентами в естественной манере разговора.
Одной из выдающихся особенностей CustomGPT является поддержка Clip Vision, которая может обнаруживать ссылки на изображения в вашем контенте. Это означает, что вы можете включать изображения в ответы своего чат-бота, улучшая взаимодействие с пользователем и обеспечивая более интерактивный и увлекательный разговор.
Начало работы с CustomGPT
Начать работу с CustomGPT очень просто. Просто установите пакет с помощью npm, и вы готовы приступить к обучению своего чат-бота с вашими собственными данными.
npm install @davmixcool/customgpt
CustomGPT требует, чтобы у вас была запущена служба CustomGPT для использования библиотеки, но вы можете обратиться к разработчику, чтобы купить лицензию для службы.
Обучение CustomGPT вашим данным
После запуска службы вы можете использовать CustomGPT для создания коллекций и обучения своего чат-бота.
//Import and instantiate CustomGPT
const { CustomGPT } = require("@davmixcool/customgpt")
const customgpt = new CustomGPT({
key: "YOUR API KEY",
host: "http://localhost:3000/"
});
//Supply the collection name to be created
let collection = await customgpt.create_collection("articles");
if (collection.err) {
console.error(collection.err);
} else {
console.log(collection.response);
// {
// "id": "aaff97d6-e9a5-11ec-91ba-d954177814f8"
// }
}
//Train customGPT with our data.
let payload = {
collection_id: "aaff97d6-e9a5-11ec-91ba-d954177814f8",
content: `My quest for a good SEO meta tag implementation in Laravel drove me tech mad to write a package that will add standard SEO meta tags to my application with ease. However, I had to go the extra mile to research important meta tags and the role they play when it comes to SEO and how they can be used to improve SEO, So literally I had to do most of the heavy lifting. Lets quickly take a detour to what meta tags are and how they can improve SEO before we unveil the package.`,
tags: ['SEO'] //An array of tags used to categorise the data source
}
let training = await customgpt.start_training(payload);
if (training.err) {
console.error(training.err);
} else {
console.log(training.response);
//A source id is returned used to update and manange training
//
// {
// "id": "c26b16b4-d394-11ed-b5a3-33d8a09a24e3"
// }
}
Вы можете сегментировать свои данные, создавая коллекции и используя теги для классификации источников данных. CustomGPT также предоставляет удобный способ обновления и управления обучением, позволяя вам настраивать чат-бота по мере необходимости. Вы можете обновлять обучение новыми данными, гарантируя, что ваш чат-бот всегда будет в курсе последней информации и тенденций.
//Update a training with it's source id
let payload = {
source_id: "c26b16b4-d394-11ed-b5a3-33d8a09a24e3",
content: `My quest for a good SEO meta tag implementation in Laravel drove me tech mad to write a package that will add standard SEO meta tags to my application with ease. However, I had to go the extra mile to research important meta tags and the role they play when it comes to SEO and how they can be used to improve SEO, So literally I had to do most of the heavy lifting. Lets quickly take a detour to what meta tags are and how they can improve SEO before we unveil the package. Why do meta tags matter? As previously mentioned, meta tags offer more details about your site to search engines and website visitors who encounter your site in the SERP. They can be optimized to highlight the most important elements of your content and make your website stand out in search results. Search engines increasingly value good user experience, and that includes making sure that your site satisfies a user's query as best as it possibly can. Meta tags help with this by making sure that the information searchers need to know about your site is displayed upfront in a concise and useful fashion.`,
tags: ['SEO',"Meta"] //An array of tags used to categorise the data source
}
let training = await customgpt.update_training(payload);
if (training.err) {
console.error(training.err);
} else {
console.log(training.response);
// {
// "id": "c26b16b4-d394-11ed-b5a3-33d8a09a24e3"
// }
}
//Delete the training data
let training = await customgpt.delete_training("c26b16b4-d394-11ed-b5a3-33d8a09a24e3");
if (training.err) {
console.error(training.err);
} else {
console.log(training.response);
// {
// "message": "Deleted succcessfully"
// }
}
Общение с вашими данными
Когда пришло время пообщаться с вашими обученными данными, CustomGPT позволяет легко начать работу. Вы можете общаться со своими данными, используя идентификатор коллекции, сообщение, идентификаторы источника и теги. Вы также можете указать количество векторных вложений, используемых для формирования контекста, что дает вам больше контроля над специфичностью ответов вашего чат-бота. А имея возможность давать инструкции ИИ, вы можете сказать ему, как форматировать его ответы в соответствии с вашими конкретными потребностями.
let payload = {
collection_id: "aaff97d6-e9a5-11ec-91ba-d954177814f8",//The collection to chat
message: "What are meta tags?", //The chat message
source_ids: ["c26b16b4-d394-11ed-b5a3-33d8a09a24e3"], //An optional array of source ids to chat. Will chat the whole collection if not provided
tags: ["SEO"], //An optional array of tags to filter by
top: 10, //The number of vector embeddings used to form a context. A lower number between 5 - 10 gives a more specific answer. Defaults to 5.
instruction: "You are an AI assistant, a creative business assistant that completes requests and always formats his responses in HTML. You are my friendly business AI assistant that is very informative & creative and can provide advice or complete creative tasks that I request. You use the information in the knowledge base as context if relevant. When you respond to me, your answer must be formatted in HTML so it is easier to read with paragraph tags, line breaks, heading and bold for titles, and use lists or tables when applicable." //An instruction to tell the AI how to reply
}
let chat = await customgpt.chat(payload);
if (chat.err) {
console.error(chat.err);
} else {
console.log(chat.response);
// {
// "reply": "The reply goes here.",
// "meta": [
// {
// "source_id": "c26b16b4-d394-11ed-b5a3-33d8a09a24e3",
// "tags": [
// "SEO",
// "Meta"
// ]
// }
// ],
// "usage": {
// "prompt_tokens": 763,
// "completion_tokens": 86,
// "total_tokens": 849
// }
// }
}
Заключение
В заключение, CustomGPT — это важный инструмент для всех, кто хочет создать высокоинтеллектуального и настраиваемого чат-бота для своего бизнеса или личных нужд. Благодаря интуитивно понятному интерфейсу и мощным функциям вы можете обучать и настраивать своего чат-бота с помощью собственных данных, что сделает его более привлекательным и интерактивным для ваших клиентов.