#GPT-3 API Twitch Chatbot

42 messages ยท Page 1 of 1 (latest)

oak wedge
#

I am developing a Twitch Chatbot that integrates the GPT-3 API with the Twitch API.

Our goal is to eventually incorporate the chat gpt API once it becomes publicly available.

We would appreciate it if you could try out the chatbot and see if you can find any issues or areas for improvement.

Here is a link to the chatbot on Twitch: https://www.twitch.tv/all_in_89

Thanks!

Twitch

Have fun with Artificial Intillegence

โ–ถ Play video
#

GPT-3 API Twitch Chatbot

scenic night
#

I would like to use this for a YouTube video.. how would I implement this?

oak wedge
#

this is specifically coded for Twitch but I am sure there is a way to code it to respond to youtube comments. You would have to use google's API

north ivy
#

kinda fun ๐Ÿ˜‰ if the answer is too long, twich doesn't display all the text

oak wedge
#

@north ivy I fixed this!

north ivy
oak wedge
north ivy
#

Do you think the answers of the IA will be related with previous answers provided to others people?

oak wedge
#

no, the davinci text model that the api currently offers does not remember prevoius responses

I hope to incorporate chatgpt into the bot when they realease and api for it, and when they do i am sure there will be documentation as to how to work the memory

north ivy
#

Okey ^^ i find it interesting because i want to do a discord bot where people can chat with the bot

#

Kinda the same concept you made but for discord

oak wedge
#

im sure that can be done

oak wedge
#

bump

rare crag
oak wedge
#

thats an interesting concept. what would be the best syntax to pass a "recent conversation" to davinci?

#

@rare crag

rare crag
oak wedge
#

gotcha thanks

rare crag
#

Might wanna use the Twitch API to check for "reply" messages IN those previous 5 messages, as they may not be in a 5 message range, but they may be more useful to the conversation.

oak wedge
#

I just created a dictionary and concatenated the query and the OpenAI API response into the value of the dictionary. then I limited the dictionary to 1000 characters

#

has_before = previous_response.get(user)
if has_before is None:
previous_response[user] = 'A: {} B: {}'.format(text3, chat_response2)
else:
new_string = '{} A: {} B: {}'.format(previous_response[user], text3, chat_response2)
previous_response[user] = new_string
# Check if the string is over 1000 characters
if len(previous_response[user]) > 1000:
# Truncate the string to the last Query characters
index = previous_response[user].rfind('A:')
previous_response[user] = previous_response[user][index:]
print(previous_response)

#

@rare crag

rare crag
#

Hmmm, I'd consider doing your character check while building the dict, that way you can decide to truncate an entire message, rather than just chopping off the dict at an arbitrary length and sending some data from a a partial response that doesn't make much sense

oak wedge
#

it doesnt truncate at an arbitrary length

#

it truncates at the last query

rare crag
#

ahh ok, I misread that last part

oak wedge
#

index = previous_response[user].rfind('A:')

rare crag
#

Just be sure to include somewhere in the final prompt that the messages prior to the new one are part of the original conversation. Otherwise it may respond with something that considers the whole thing as one new prompt instead of a history + new prompt.

oak wedge
#

im using this:

query2 = "{}\n The text above is from the previous conversation, please refer to it when responding to the "
"next sentence below. \n {} do not include \n in your response".format(previous_response[user], query)

rare crag
#

There ya go

#

Lemme know how it works out, if at all ๐Ÿ™‚

oak wedge
rare crag
#

Ahh sweet ๐Ÿ™‚

#

I'll pop in and give a tinkle ๐Ÿ™‚

oak wedge
#

thanks!

rare crag
#

Hmm, it thinks I'm it's new boss apparently xD

oak wedge
#

lol i saw

#

i might have to work on the prompt engineering better

rare crag
#

You have a git?

#

maybe dm me?

oak wedge
#

Updated with new prompts for better interaction as well as the ability to add to multiple channels.