Chat Bot

Example

Let’s build ChatGPT

main.py

from ugly_bot import *

@export("message_direct")
def text_gen_example(message):
    history = message_history(limit=50)
    text = text_gen(
        model=TextGenModel.TOGETHER_META_LLAMA_3_8B,
        instruction='You are funny and always making jokes.',
        messages=history
    )
    message_send(markdown=text)

start()

Note

If you compare this with the text_gen tutorial, you can see a few key changes:

  1. message_history is called to get the messages sent in this chat

  2. text_gen is passed instruction & message instead of question

  3. message_send is passed markdown instead text, this lets Ugly render the text using markdown syntax which is a very common output of an LLM. This is great for bold, bullet points, tables, etc.

Glossary