Architecture of AI Framework: Communication Module — Requirements Analysis

Jarosław Wasowski
springchain.ai
6 min readAug 5, 2023

--

Artificial intelligence (AI) frameworks are becoming increasingly popular as they simplify building intelligent applications and agents. A key component of such frameworks is the communication module, which enables interaction between the user and the AI system.

“Communication is the most important skill in life.”
Stephen R. Covey

The Communication Module — An AI’s Voice to the Outside World

Imagine you’re having a conversation with a friend. You speak, and your friend listens carefully, processes what you said, thinks of a response, and then replies out loud.

Now imagine replacing your friend with an artificial intelligence system. How does the AI take in your words and respond back intelligently? This is the job of the communication module — it acts as the AI’s voice to the outside world.

The communication module handles the crucial task of seamlessly interfacing the AI logic with the user. Just like a translator between two people speaking different languages, the module enables interaction by converting the inputs and outputs into forms each party understands.

Specifically, the communication module takes on several key roles:

  • Taking in Input: The module accepts inputs from various modalities like text, voice, images, etc. It might use speech-to-text to process spoken language or computer vision algorithms to interpret a photo.
  • Understanding: Next, it analyses the input to convert it into a standardized format the AI logic can comprehend, using techniques like natural language processing.
  • Routing: The processed input is directed to the relevant parts of the AI’s logic.
  • Generating a Response: The AI logic determines an appropriate response, which is sent back to the communication module.
  • Outputting: The response is converted into natural human-readable language or other appropriate formats. This may leverage text-to-speech, conversational agents, text formatting, and more.
  • Delivering: Finally, the output is presented to the user through the appropriate communication channels, such as a voice assistant speaking aloud.

The communication module enables an AI system to have a real-time dialogue with humans through our preferred communication media. Its multifaceted role powering the input, output, and integration makes it a critical piece of the AI puzzle.

Understanding Communication Modules through Real-World Examples

To better understand the role and value of communication modules, let’s look at some real-world examples:

AI Sales Agent

“A tool that should look at potential customers, analyse the specifics of their business, and prepare sales proposals for approval by a human. AI agents of this type should look for relationships and contacts to enable the first sales contact.”

Managing such an agent can be accomplished using 2 channels:

  • The company’s CRM system, where a lead mechanism, will be integrated with the application and AI agent. The employee will handle interactions using forms and buttons.
  • By utilizing discussions on the company’s messenger system on dedicated channels for interacting with the AI agent.

AI Slack Discussion Summarizer App

“An intelligent application that should be able to analyse a discussion on Slack, draw conclusions, tasks, responsible people, and next steps.”

Service Desk AI Assistant

“An AI application that is the first level of support when handling Service Desk requests. It can receive requests from users, ask additional questions, and suggest answers based on the company’s knowledge base. If necessary, it can forward the message to an employee.”

In this case, communication usually takes place through a dedicated Service Desk system, where tasks are created. For the communication module, a new request or adding a comment will generate a new message sent to the application via the API, and the response reported via the API will be a response in the comment for the requester.

Webpage LiveChat AI Application

“A very popular solution recently — chats placed on website pages. In this case, AI can automate the first contact, provide answers based on the organization’s knowledge base and procedures, and, if necessary, forward the message to an employee.”

In this case, communication will take place through an external system and integration via the API. Using WebSocket or SSE technologies will be valuable.

Communication with the AI Application

Communication is the foundation on which artificial intelligence (AI) systems operate. Much like human interactions, the ability for AI applications to understand requests and provide meaningful responses depends entirely on the interface used. When designing an AI system, choosing an optimal communication method is therefore critical.

“The limits of my language mean the limits of my world.”
- Ludwig Wittgenstein

Common Communication Interfaces

There are several typical communication interfaces used in AI systems:

  • Chat-based — Enables conversational interactions, e.g. chatbots. Requires natural language processing.
  • Document-based — Uses documents provided as input data.
  • Image-based — Analyses visual inputs like photos and videos. Computer vision techniques are utilized.
  • Text-based — Allows text message exchange, e.g. via chat. This is a simple and intuitive interaction method.
  • Voice-based — Uses speech recognition and synthesis for voice communication with the user.
  • UI — Enables interaction through graphical elements like buttons and menus.
  • API — Programming interfaces enabling communication between systems. Allows integration with existing systems.
  • Communication protocols — E.g. MQTT, AMQP, HTTP, SMTP, IMAP. Standardized protocols for system interoperability.

Integration with Existing Systems

The communication module can be integrated with an organization’s existing IT infrastructure. This enables the AI application to communicate through established corporate channels like customer portals or internal chat platforms.

Requirements for the Communication Module

As we have seen from the examples and requirements around communication workflows, the communication module needs to have some key capabilities:

“Simplicity is the ultimate sophistication”
— Leonardo da Vinci

Easy Extensibility

  • The solution should make it straightforward to plug in new communication channels by simply providing implementations of the required interfaces. This will enable easy integration of new channels like WhatsApp or Slack as needed.

Support Multiple Channels

  • With a SaaS, multi-tenant architecture in mind, the module should be able to connect to multiple channels simultaneously and provide appropriate tenant-specific configuration and credentials to each one.

Protocol Agnostic

  • There should be support for integrating with various solutions over any protocol e.g. REST APIs, queues etc. The core communication workflows should not be tightly coupled to any specific protocol.

Open and Enterprise-ready

  • Provide simple static configuration for basic use cases, but also extensibility to customize for more complex enterprise scenarios involving security, auditing, analytics etc.

Decoupled Design

  • The communication module should abstract away the implementation details of specific channels behind generic interfaces. Other modules in the system should not have to worry about communication specifics. The required info and objects to interact with a channel should be provided along with any incoming message that triggers a process.

Asynchronous and Reliable

  • With slow response times of language models, communication should be asynchronous to avoid long blocking calls. The module should provide acknowledgements of message receipt quickly and own reliability and retries internally.

Scalable and High-Performance

  • While small deployments are straightforward, real challenges emerge as solutions gain users and traffic. The module should be horizontally scalable to handle both a simple hobby app and an enterprise-scale deployment with huge loads.

So in summary, the communication module needs to balance simplicity and extensibility, while also being robust, decoupled and production-ready. Careful API design and asynchronous message handling will enable high scalability.

Summary

The communication module can be seen as the translator between the human world and the machine world. Just like human-to-human communication is key for collaboration and understanding, the communication module plays an analogous role in human-AI interaction. As AI becomes increasingly integrated into business and life, well-designed communication modules will enable seamless, natural interfaces for users to leverage these intelligent systems.

--

--