Langchain based LLM design patterns for telecom use cases

Debajyoti Mukherjee
4 min readOct 30, 2023

--

Authors : Chinmohan Biswas (Chinu da) as our mentor , Charbak Chatterjee and Debajyoti Mukherjee.

In recent times, Generative AI has gained lot of momentum and clients are looking for rapid adaptation in this area. In telecom industry, we have figured out lot of value propositions for Generative AI use cases. While Cloud platforms are coming up with different LLMs and Generative AI platforms, LangChain is providing a more-or-less common interface to work with LLMs, required utility toolsets and patterns. Here the focus is more on adaptation of LangChain patterns for Telecom Use cases. We have also created some starter POC code , vector Databases and shared in public GitHub : https://github.com/debajyoti1d1mukherjee/telecom-usecases-genai-langchain.

Here the below identified patterns.

A>Pattern: Agent

Agent is an intelligent component powered by LLM which creates a Thought, Action, Action Input and Observation for every prompt execution. Agent selects the best prompt , LLM , tool from its available capacity to provide the best result.

Agent Pattern

Use Cases for Agent Pattern:

• CSR agent needs to provide plan information to his customer who may be a MVNO business customer or can be an individual subscriber. The wholesale plans for MVNOs and retail plans for individual subscribers are maintained separately by different organizations groups. Intelligent Agent will understand input question / requirement and will use tools provided in its capacity to produce an optimal response.

•A telecom operator may maintain different base plans and some value-added services on top of base plans. Since the telecom provider may be interested in associating and de-associating value added plans on top of base plan, they would like to maintain them separately. An intelligent agent can help customer queries about products in plans.

B>Pattern: Sequential Chain

Executes a chain of activities in sequence where the output of one chain is input to next chain. Each individual chain can have its own LLM based on the nature of activity to be performed by the chain.

Sequential Chain Pattern

Use Cases for Sequential Chain

Multiple actions to be executed by a telecom CSR agent for a customer question and resolution.

>Summarization of interaction between CSR and customer about telecom product issues to which customer is subscribed to.

>Extract Intent / Entities

>Provide an NBA

C>Pattern: Transformation Chain

Transformation chain executes a custom function to modify an input prompt.

Executes Transformation chain as a part of sequential chain.

Transformation Chain Pattern

Use Cases for Transformation Chain

Augment input prompts with information from knowledge base. This information can be pre-pended or appended to input prompts to add more contextual information to LLM. Telecom Agent assist / CSR based use cases can be benefitted.

>Pattern: Few shot prompts.

This pattern sets a conversation pattern with LLM. It consists of the following:

>System Message: This sets the tone of conversation. This can be greeting, instructions.

>Human Message: This refers to message sent by human actor by text-based interface which may take any form like questions, statements, request for information etc.

>AI Message: AI messages are generated based on the AI model’s training data, algorithms, and the specific context of the conversation.

Few shot prompts provide a capability to provide an additional context of a collection of examples (input and output) alongside the prompt to enable LLM respond in a contextual manner.

Use Cases for Few Shots Prompts

A MVNO can have partnership which various MNOs to subscribe MVNO retail customers in MNO platform. So the retail MVNO plans need to be mapped to wholesale MNO plans. So classification of MVNO plans into MNO plans will be require examples to be passed to LLM to receive contextualized response. This may be an alternative to LLM tuning and RAG pattern.

E>Pattern: Dynamic Routing

The Router is powered with LLM to determine a target chain based on input prompt. Every destination chain is a container of a prompt and a LLM. Based on the interaction with router, router invokes a chain from a collection of destination chains.

Use Case for Dynamic Routing

The CSR agent may go through a chat-based communication with a telecom customer and based on the conversation, the agent may require a summarization of the conversation or getting next best action. This pattern can evaluate the dynamic needs of the CSR agent and provide a response .

--

--