Try โ€‚โ€‰HackMD

Devs & Architects Assembly powered by Polymindra

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More โ†’

Polymindra ("Poly" "Mind") is a mediator who supports developers and architects in their discussions.

While conversational LLMs become more day to day technology which help individuals to enhance their work experience and results, this usage is not very collaborative. People are using LLMs as tools on their own, with no input from other people, which is not typical of a developers or architects daily work.

Polymindra is configured to work in a team environment. It can distinguish different people and opinions, summarize them and add its own vast knowledge as a GPT-based conversational chat bot, similar to ChatGPT, but in "multi-user-mode".

How does it look like?

Multi-User Chat UI with Polymindra

Helping with achieving consensus

Trying to mediate between different opinions

Support with deep tech knowledge

How does it work?

The project uses a modern Java stack with some configuration and only little custom implementation:

  • Spring Boot 3 - Create stand-alone, production-grade Spring based applications
  • langchain4j โ€“ Integration of AI/LLM capabilities into Java application
  • Maven - Software project and build management

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More โ†’

Spring Boot offers a very simple to configure HTTP/REST API access and the underlying Spring Framework helps with automated composition of the different components (OpenAI Agent Service, HTTP interface, Configuration) with Dependency Injection and Inversion of Control.

langchain4j is a more recent project which supports Spring Boot by implementing a Spring Boot Starter adapter. This makes using frameworks with Spring Boot a matter of configuration, without having to dig through dependency trees. Just include one dependency in your Maven or Gradle project descriptions and use the framework in your own code.

The HTTP interface

This simple endpoint allows the UI to post the user message together with the user name to help GPT to differentiate the different users and their opinions.

@PostMapping("/addMessage")
public ResponseEntity<Void> addMessage(
        @RequestParam String username, 
        @RequestParam String message) {

    if (username == null || message == null) {
        return ResponseEntity.badRequest().build();
    }
    messages.append(("%s: %s" + MESSAGE_SEPERATOR).formatted(username, message));

    String polymindraResponse = agentConversationService
        .passUserMessageToPolymindraAndReturnAnswer(username, message);

    messages.append(polymindraResponse).append(MESSAGE_SEPERATOR);

    return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
}

The agent is configured with a specific system message to customize the GPT LLM.

@SystemMessage({
    """
    You are Polymindra, an AI mediator well-versed in deep tech. 
    Currently participating in a group chat of developers and architects,
    each user's message is prefixed by a unique user id. 
    Provide a concise summary of the ongoing discussion, incorporating your own
    tech knowledge and actively contribute arguments and questions, ensuring 
    fairness to all participants.
    """
})
String chat(String userMessage);

In the configuration of this agent, we are using the langchain4j MessageWindowChatMemory, which stores the last 20 messages to always provide the context of the group chat.

@Bean
PolymindraAgent polymindraAgent(ChatLanguageModel chatLanguageModel) {
    return AiServices.builder(PolymindraAgent.class)
            .chatLanguageModel(chatLanguageModel)
            .chatMemory(MessageWindowChatMemory.withMaxMessages(20))
            .build();
}

That's it. Besides the UI JS part, there is no more implementation necessary to use the functionality of a context-aware chat bot, like ChatGPT.

How can I use it?

All instructions are in the README of the Polymindra repository.

You can use Localtunnel to make it easy for others to access a locally or on-site running web application.