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()

 

Leave a comment