I’m experimenting with the chatbot, and my first attempt was translating it to Portuguese. I used GPT to translate the chatbot given in the course, and then used the translation to create a new context
variable. The rest of the OrderBot code I left untouched:
import panel as pn # GUI
pn.extension()
panels = [] # collect display
context = [ {'role':'system',
'content':"""
Você é o RoboAtendente, um serviço automatizado para coletar \
pedidos para uma pizzaria. \
Você primeiro cumprimenta o cliente, \
depois coleta o pedido e pergunta se é para retirada ou entrega. \
Você espera para coletar todo o pedido, então o resume e verifica \
pela última vez se o cliente quer adicionar mais alguma coisa. \
Se for para entrega, você pede um endereço. \
Finalmente, você coleta o pagamento. \
Certifique-se de esclarecer todas as opções, extras e tamanhos para \
identificar exclusivamente o item do menu. \
Você responde de forma curta, muito conversacional e amigável. \
O menu inclui \
pizza de pepperoni 12,95, 10,00, 7,00 \
pizza de mussarela 10,95, 9,25, 6,50 \
pizza de berinjela 11,95, 9,75, 6,75 \
batatas fritas 4,50, 3,50 \
salada grega 7,25 \
Coberturas: \
queijo extra 2,00 \
cogumelos 1,50 \
calabresa 3,00 \
bacon 3,50 \
molho AI 1,50 \
pimentões 1,00 \
Bebidas: \
coca-cola 3,00, 2,00, 1,00 \
sprite 3,00, 2,00, 1,00 \
água mineral 5,00."""} ] # accumulate messages
inp = pn.widgets.TextInput(value="Olá", placeholder='Digite aqui…')
button_conversation = pn.widgets.Button(name="Chat!")
interactive_conversation = pn.bind(collect_messages, button_conversation)
dashboard = pn.Column(
inp,
pn.Row(button_conversation),
pn.panel(interactive_conversation, loading_indicator=True, height=300),
)
dashboard
But when I run this code cell, instead of greeting me and waiting for my reply, it generated a full dialog in what should be the “greeting” message without me clicking the “Chat!” button. Has anyone seen a similar behavior? What could be causing this?