LogoLogo
Home
  • Introduction
  • Quickstart
    • Starter guide
    • Core Concepts
      • Stack Type
      • Data Loader
      • Inputs/Outputs
      • Text Splitters
      • Embedding Model
      • Vector Store
      • Large Language Model
      • Memory
      • Chain
    • Testing Stack
    • Deployment
    • Knowledge Base
    • Organization and Teams
    • Secret Keys
    • Logs
  • Components
    • Inputs
    • Outputs
    • Document Loaders
    • Prompts
    • Text Splitters
    • Embeddings
    • Vector Store
    • Retrievers
    • Multi Modals
    • Agents
    • Large Language Models
    • Memories
    • Chains
    • Output Parsers
  • Customization
    • Writing Custom Components in GenAI Stack
    • Build your own custom component
    • Define parameters used for required components
  • Usecases
    • Simple QA using Open Source Large Language Models
    • Multilingual Indic Language Translation
    • Document Search and Chat
    • Chat with Multiple Documents
  • Terminologies
    • RAG - Retrieval Augmented Generation
    • Hybrid Search - Ensemble Retriever
  • REST APIs
    • GenAI Stack REST APIs
    • Chat API Reference
    • Text Generation API Reference
    • Rate Limiting and Sleep Mode
  • Troubleshooting
    • How to verify what is loaded and chunked from the loader?
  • Acknowledgements
    • Special Mentions
Powered by GitBook
On this page
  • Step 1- Define your prompt
  • Step 2- Define your LLM
  • Step 3- Build Chain with Memory
  • Step 4- How to use Chat Interface for multiple prompts

Was this helpful?

  1. Usecases

Multilingual Indic Language Translation

In this use case, we aim to establish a language translation system from English to six prominent Indian languages: Hindi, Kannada, Telugu, Tamil, Punjabi, and Gujarati.

PreviousSimple QA using Open Source Large Language ModelsNextDocument Search and Chat

Last updated 1 year ago

Was this helpful?

Let's build the stack

Step 1- Define your prompt

The initial component involves writing a prompt where the user input query and the desired language translation are specified. This component is invaluable as it ensures that the model understands the desired task on what language it need to generate accurate responses.

Prompt template, edit the template :

Translate the given TEXT into the given LANGUAGE. You are the only Indic language translator, you only support Hindi, Kannada, Telugu, Tamil, Punjabi and Gujarati LANGUAGE. If the LANGUAGE is not among languages, give a feedback to a user saying LANGUAGE is not supported. 

TEXT: {text}
LANGUAGE: {lang}

As you look in the stack, we get lang and text as input variables that need to be entered by the user.

Know more about Prompts:

Step 2- Define your LLM

Based on our requirements, we must determine the most suitable Large Language Model for our needs. Given that our use case involves developing a Multilingual Indic bot that must comprehend the language aligned with the prompt instructions, GPT models excel in this aspect. Hence, we have opted for the Azure ChatOpenAI model for this particular use case.

Note: Several Multilingual fine-tuned models are available on the HuggingFace Hub, providing an alternative option for utilizing open source Large Language Models in this use case.

Step 3- Build Chain with Memory

In order to connect the prompt with LLM, we need a chain, this is where we use LLMChain. Just connect your Prompt Template, LLM directly to the LLM Chain along with the memory component being optional. This LLM Chain ensures your prompt is added as in-context learning to the LLM model so that it can return reasonable response.

Step 4- How to use Chat Interface for multiple prompts

Given that our prompt template comprises two input variables, it is crucial to specify the user input correctly. The Chat Interface defaults to selecting the first input variable as the user query, but this may not always be accurate. To address this, enter the language value under the "lang" input variable and utilize the text entry box to input your query.

NOTICE: In the above image, we write the language name under the lang input variable and then enable text as the chat input. Please make sure that we enter the language name and disable the chat input for lang.

Know more about LLM:

Know more about Chains: and Memory:

Check out how to use Chat Interface:

https://docs.aiplanet.com/components/large-language-models
https://docs.aiplanet.com/components/chains
https://docs.aiplanet.com/components/memories
https://docs.aiplanet.com/quickstart/chat-interface-genai-stack-chat
https://docs.aiplanet.com/components/prompts