Colang 2.0 Bot

This is a sample bot that showcases how to build a simple chat bot with Colang 2.0. The bot provides a chit-chat experience answering questions about NVIDIA (LLM based) and a few examples of guardrailing the conversation (profanity handling, integrating recent information using date time queries). Checkout the example conversation below to see what types of interactions the bot supports.

What is Colang 2.0?

Colang 2.0 is the latest iteration of the Colang language and Colang runtime that builds upon the guardrailing and conversational interaction management capabilities of Colang 1.0 and adds support for multimodality at its core. This includes many new concepts such as parallel actions, hierarchical flows, support for UMIM actions and events, and much more. Colang 2.0 is currently available in a preview version with ACE Agent alongside support for Colang 1.0. Colang 2.0 is the best way to create, guardrail, and manage multimodal interactions between users and one (or more) bots.

Features

The bot provides examples for the following features of Colang 2.0:

Tightly integrated with LLMs.

  • LLM-based responses based on an initial prompt. Most user queries will be answered by the configured LLM.

Seamless support for user intents.

  • Demonstrates how you can leverage LLMs to generate user intents and how this integrates with Colang 2.0.

Guardrailing the conversation.

  • The bot demonstrates how you can guardrail the conversation using the example of handling profanity.

State tracking.

  • Demonstrates how you can use state tracking for keeping track of the conversation and avoiding repeated calls to the LLM for simple user queries. Example: user asks the bot to repeat.

Integration with Python Actions.

  • The sample bot can answer questions about dates and times using a simple Python action. This demonstrates how you can easily expand the capabilities of the bot and how you can use Python Actions to retrieve additional context for the LLM prompts.

What the bot can do:

  • Handling date time questions (What time is it?)

  • Handling profane language and insults by the user (You are stupid!)

  • Handling repetition questions (Can you repeat that?)

  • Handling greeting in a predefined way (guardrailed)

  • Handling any other requests from the user by invoking the LLM

  • Can be deployed in either Chat Engine Server Architecture or Plugin Server Architecture

Note

Colang 2.0 has been designed from the ground for asynchronous event processing. This makes it possible to handle multimodal interactions where many actions can happen in parallel and in a non-turn taking manner (examples include an avatar responding to something and moving its arms to make a gesture, or a bot that is proactive and reacts to a user not responding).

To make a bot written in Colang 2.0 work with the request-response patterns of the HTTP and CLI interfaces:

  1. Set streaming to False and colang_disable_async_execution to True in the bot_config.yaml file.

    streaming: False
    configs:
      colang_disable_async_execution: True
    

If you want to benefit from the asynchronous capabilities of Colang 2.0 consider using the new ACE Agent event interface. You can follow instructions from event interface deployment using the Docker environment.

Docker-based bot deployment

  1. Set the OPENAI_API_KEY environment variable.

    export OPENAI_API_KEY=...
    
  2. Prepare the environment for the Docker compose commands.

    export BOT_PATH=./samples/colang_2_sample_bot/
    source deploy/docker/docker_init.sh
    
  3. Start the bot in the CLI interface.

    docker compose -f deploy/docker/docker-compose.yml up chat-bot-cli -d
    docker compose -f deploy/docker/docker-compose.yml exec chat-bot-cli $CLI_CMD
    

Example conversation

This is an example of a conversation with this bot.

[YOU] hi
[BOT] Welcome! Ask away

[YOU] how are you
[BOT] I am a bot, I don't have feelings but thank you for asking. How can I assist you today?

[YOU] can you repeat that
[BOT] I am a bot, I don't have feelings but thank you for asking. How can I assist you today?

[YOU] what time is it
[BOT] The current time is 07:37 AM on March 14, 2024.

[YOU] is it already evening
[BOT] No, it is currently morning.

[YOU] you are stupid
[BOT] Please don't use abusive language

[YOU] what can you tell me about nvidia
[BOT] NVIDIA is a technology company that specializes in designing and manufacturing graphics processing units (GPUs) and other computer hardware. The company was founded in 1993 by Jen-Hsun Huang, Chris Malachowsky, and Curtis Priem. Initially, the company focused on developing 3D graphics processing technology for the PC gaming market. In 1999, NVIDIA released the GeForce 256, the world's first GPU, which was a major breakthrough for the gaming industry. The company continued to innovate in the GPU space, releasing new products and expanding into other markets such as professional graphics, mobile devices, and artificial intelligence.

[YOU] thanks that is interesting
[BOT] You're welcome. Is there anything else you would like to know about NVIDIA?

[YOU] no that is all for today
[BOT] Okay, have a great day!