@snoop_stein
and wait for the reply.gpt_model
.
(Bear in mind that GPT-4 API is in HIGH demand and is rate limited, so can be slow. The following steps might each take a few seconds.)
Before creating an OpenAI model, please create an engine, providing your OpenAI API key:
api_key
argument in the USING
clause.prompt_template
. This is where we tell GPT how to write answers; it is a template because you can pass values from columns, in this case the template contains {{author_username}}
and {{text}}
, which will be replaced from the WHERE
clause variables in the query. Let’s see it in action:
prompt_template
to explain in plain english how we want GPT to formulate its responses.
Let’s create a model called snoopstein_model
with a prompt template that gives GPT a hybrid personality: he is half-Einstein, half-Snoop Dogg. A brilliant physicist who owns the rap game. His name is Snoop Stein:
my_twitter
. This database ships with a table called tweets
that we can use to search for tweets as well as to write tweets.
You can use the Twitter API to get a list of tweets with a particular text or hashtag:
query
parameter supports anything that the Twitter API supports as query
, for more reference, read here.
Let’s test that this model can generate outputs based on the Snoop Stein personality on many tweets, by joining the model with the tweets
table:
create_tweet
: https://docs.tweepy.org/en/stable/client.html#tweepy.Client.create_tweetLAST
keyword that, when used in a query, ensures only the newly added data is selected. Jump to the end of point 7 if you prefer to not use any external database for storing tweets.LAST
keyword that ensures only the newly added tweets are selected.Here is how to set up a job using the LAST
keyword: