✔️Return to main page

The idea: Friendly Dalek

Inspired by the DoctorWho episode Victory of the Daleks, I was aiming to recreate the strange conversation with a polite and charming Dalek, offering tea and being helpful, which contradicts their usual behaviour in the sci-fi show.

At first I created a simple Python script, where the chatbot initiates the conversation asking for the name and if the user would like tea or coffee. As further options there is the choice to add milk or sugar.

Making use of the charater, is a fun way to playfully try out different ways of creating conversational chatbots while making use of different technologies.

First try: Python

# Asks for username
user = str(input("What is your name?"))

# Prints greeting with question # Inputs choice t/c
print("Hello", user, "Would you care for tea or coffee?")
choice = str(input("Please type 'c' for coffee or 't' for tea."))

# Prints thank you 
if choice == 'c':
    print("Thank you for ordering a coffee.")
elif choice == 't':
    print("Thank you for ordering a tea.")
else:
    print("Please choose between tea and coffee.")

def order(x):
    global order1
    if x == 'c':
        order1 = 'coffee'
    else:
        order1 = 'tea'

order(choice)
print("Would you like some milk with your " + order1 + "?")

# Input choice y/n
milk_option = str(input("Enter 'y' for a spot of milk or 'n' if you do not wish any milk."))

# If y Prints ... pouring milk 
def milk(m):
    global milk1
    if m == 'y':
        milk1 = 'milk'
        print("...pouring some milk in.")
    else:
        milk1 = "no milk"
milk(milk_option)
        
# Asks if the user would like sugar # Input choice y/n
sugar_option = str(input("Would you like some sugar, " + user + "? Please enter 'y' or 'n'"))

def sugar(s):
    global sugar1
    if s == 'y':
        sugar1 = 'sugar'
    else:
        sugar1 = "no sugar"
sugar(sugar_option)

# If y asks How many cubes # Input a number 

if sugar_option == 'y':
    spoons = int(input("How many spoons would you like? Please enter a number between '1' and '10'"))
i = 0
while i in range(spoons):
    i = i + 1
    print(int(i))
    
print("...stirring.")
    

# Prints Enjoy your t/c 
print("Here you are, " + user + ". Your " + order1 + " with " + milk1 + " and " + sugar1 + ". Enjoy.")

OpenAI Chatbot Project

For this project, I created an API key on the https://platform.openai.com/ , to allow me to connect to OpenAI from Google Colab.

Then, I Set up an assistant using the model gpt-3.5-turbo and uploaded the txt file containing the transcript of the episode downloaded from the following page The Doctor Who Transcripts - Victory of the Daleks (chakoteya.net).

002.png

On the Jupyter Notebook in Google Colab, I first imported OpenAI to create the client connection with the api key.

Then I uploaded the txt file containing the transcript of the episode.

uploaded_file = client.files.create(
    file = ("/content/Victory_of_the_Daleks.txt", 'rb'),
    purpose='assistants'
)

For the assistant, I modified tools for retrieval and added the model. I had to comment out file_ids, as it was not supported by the gpt-3.5-turbo.