Table of Contents / Содержание
Link to project in GitHub: https://github.com/RomiconEZ/GenerativeBackend
This Backend service is part of the contact center automation system for the tour business.
He is the link between chatbots for clients and for agents.
The main purpose of the Backend is to generate text and audio answers to user questions, as well as redirect users to agents.
To respond to user requests, a locally deployed LLM is used: IlyaGusev/saiga_mistral_7b_gguf using LM studio and RAG.
RAG: "intfloat/multilingual-e5-large-instruct" is used as the embedding model. Chroma is used to create and use a vector representation of text data. LangChain is used for processing and managing text data. The knowledge base contains a file with information about the tour operator (all matches are random).
To provide asynchronous processing of heavy tasks (LLM request, sound generation) , the ARQ library (Asynchronous Redis Queue) is used, which uses Redis as a message broker to manage task queues.
Solving problems using the service takes place in 2 stages:
- Request to queue a task and get its id
- Requests for the status of the task with its id
Данный Backend сервис является частью системы автоматизации контакт-центра для тур-бизнеса.
Он является связующим звеном между чат-ботами для клиентов и для агентов.
Основная цель Backend-а - генерация текстовых и звуковых ответов на вопросы пользователя, а также перенаправление пользователей к агентам.
Для ответов на запросы пользователя используется локально развернутая LLM: IlyaGusev/saiga_mistral_7b_gguf с помощью LM studio и RAG.
RAG: В качестве модели для эмбеддингов используется "intfloat/multilingual-e5-large-instruct". Chroma используется для создания и использования векторного представления текстовых данных. LangChain используется для обработки и управления текстовыми данными. База знаний содержит файл с информацией о туроператоре (все совпадения случайны).
Для обеспечения асинхронной обработки тяжелых задач (запрос LLM, генерация звука) используется библиотека ARQ (Asynchronous Redis Queue), которая использует Redis в качестве брокера сообщений для управления очередями задач.
Решение задач с помощью сервиса происходит в 2 этапа:
- Запрос на постановку задачи в очередь и получение ее id
- Запросы о статусе выполнения задачи с указанием ее id
- Docker: https://www.docker.com/get-started
- LM studio: https://lmstudio.ai
- Download the IlyaGusev/saiga_mistral_7b_gguf model in LM studio
-
Clone the repository.
-
Copy the
.env.example
file in the directory and change the name to.env
. Customize the env file for your project. -
Launch the server in LM studio
- In the terminal, navigate to the root directory of the cloned repository. Build the Docker containers with the following command:
If an error occurred when starting the containers when creating databases, run the command again:
docker compose up
docker compose up
- http://127.0.0.1:8000/ - FastAPI документация
- http://127.0.0.1:5050/ - PgAdmin
This project is licensed under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license. See the LICENSE file for details.
Roman Neronov:
- email: roman.nieronov@gmail.com / roman.nieronov@mail.ru
- telegram: @Romiconchik