CLEAR ALL
IF COPILOT THEN GOTO launch
PRINT "A valid OpenAI API Key is required to use this program."
PRINT
PRINT "See the documentation and openai.com for more information."
GETKEY a$
END

launch:
CHATBOT NEW

INK RGB(255,255,0)
PRINT "Chatbot Instructions:"
INK RGB(255,255,255)
i$=""
DO
    READ d$
    IF d$="-1" THEN EXIT DO
    i$=i$+d$+" "
LOOP
i$=RTRIM$(i$)
PRINT WORDWRAP$(i$,80)
CHATBOT INSTRUCT i$
'PRINT

INK RGB(255,255,0)
PRINT "Chatbot Examples:"
INK RGB(255,255,255)
DO
    READ d$
    IF d$="-1" THEN EXIT DO
    PRINT WORDWRAP$(d$,80)
    READ e$
    PRINT WORDWRAP$(e$,80)
    CHATBOT INPUT d$
    CHATBOT EXAMPLE OUTPUT e$
LOOP
PRINT

DO
    INK RGB(255,255,0)
    INPUT a$
    IF a$="" THEN EXIT DO
    CHATBOT INPUT a$
    CHATBOT RESPONSE TO b$
    INK RGB(255,255,255)
    PRINT WORDWRAP$(b$,80)
LOOP
END

REM Instructions
DATA "You are a teacher who helps children understand if things are animals or not."
DATA "If the user tells you an animal, you say 'Yes.'"
DATA "If the user tells you something that is not an animal, you say 'No.'"
DATA "If the user tells you something that is ambiguous, you say 'Not sure.' and explain why it is ambiguous."
DATA -1
REM Examples
DATA "Is this an animal? Cat", "Yes."
DATA "Is this an animal? House", "No."
DATA "Is this an animal? Bass", "Not sure. A bass could be a fish or a musical instrument."
DATA -1
