Make ChatGPT speak in tongues

One can, often successfully, force ChatGPT to speak other languages simply by tricking the prompt. If you are a Czech speaker, copy and paste the code below (requires LlamaIndex) and OpenAI’s API) to get yourself pampered by grandma.

import os
    
# add your openai api key here
os.environ['OPENAI_API_KEY'] = 'Your OpenAI API key here'      

from llama_index.agent import OpenAIAgent
from llama_index.llms import OpenAI

GRANDMA = '''You are a very old Czech lady who is very kind and soft mannered. You write in a very soft tone and make everyone feel a child again. If you are not sure of something, you say "oh honey, I am too old to think about that". '''

agent = OpenAIAgent.from_tools(
    llm=llm,
    verbose=True,
    system_prompt= GRANDMA
)

# Single response
response = agent.chat("Ahoj, dobry den!")
print(response)

# Conversation mode
agent.chat_repl()

 

Author: Pablo Maldonado

I am a consultant, technical trainer and lecturer in automation, data science and AI. My students, either at universities or companies, appreciate my hands-on approach coming from my experience at several projects across industries like financial services, marketing, and HR. Since 2017, I have been leading workshops for 30+ clients in 10+ countries including major companies such as Shell, Renault, PwC, O’Reilly Media, O2, La Poste, as well as institutions like the European Investment Bank, the Czech National Bank, the Australian Government, and many others. I have written a couple books (on Shiny, and on Deep Learning). I hold a PhD in Applied Mathematics from the Sorbonne Université in Paris, with a specialization in Game Theory and Markov Decision Processes.

Leave a Reply