This page details the protocol that frontends can implement to interact with the backend.

Overview

The architecture is divided into one backend and multiple frontends. The backend is responsible for implementing almost all of the logic, data storage, communication with models, etc. while the frontends act largely as proxies that connect a particular user interaction domain with the backend. Examples for frontends are discord bots, web applications, telegram bots, etc. essentially anything that can interact with a human. Having the frontends act largely as proxies has the advantage that we do not need to implement the same logic many times for the different frontends, but as long as a frontend implements our communication protocol, it can join our network.

graph TD
  Database --- Backend
	ModelInference --- Backend
	S3 --- Backend
	.... --- Backend
	Backend -- Protocol --- DiscordBot1
	Backend -- Protocol --- DiscordBot2
	Backend -- Protocol --- Website1
	Backend -- Protocol --- ...

The Protocol

At the heart of the effort is the protocol. The protocol is designed to let any frontend communicate with the backend in a structured way. The frontend is responsible to facilitate this communication between the backend and the human in the way that is most appropriate for the particular channel the frontend runs on.

Example: One type of message could be to ask the user to rate some text from 1-5, the message might be something like (yaml for readability)

type: TextRatingTask
data:
	text: "Johnny was a good boy! Very good!"
	range:
		min: 1
		max: 5

A discord bot could implement this using reaction symbols, such as 1️⃣ 2️⃣ …, whereas a purely text-based frontend could prompt the user to respond with a number between 1 and 5.

<aside> 💡 Note that for the frontend, this means there is no need to implement complex logic & templates, this is all handled in the backend.

</aside>

Core Protocol Concepts

<aside> 💡 For now, the protocol could support multi-post interactions, but we don’t implement that yet. The user is always asked to do 1 thing, i.e. to write a single next reply in a conversation, or to rank one set of replies. Then the current task will be done and the next task starts.

</aside>

<aside> 💡 The goal here is to make the frontends as stateless as possible. Interactions with users are tracked via the user IDs and post IDs (which the frontend, e.g. a discord bot, can determine at any time). The backend has more structures internally to pull these things together.

</aside>

The protocol’s core flow

The basic principle is always the same