
As I now have GPT4All perfectly suitable for writing fascinating stories about everything, why not to utilize it even more? Please welcome the new spin-off website, What's up, home? Generative AI Edition. A cronjob running on my What's up, home? environment will run itself every morning 7am Finnish time, generate a fresh new story based on active Zabbix alerts, and post it to the new website over Drupal API.
Why, oh why?
Just because I can. And, just because all this stupid play can be useful elsewhere. Imagine if you ask the little AI to write in a more formal manner, or filter alerts for you, or do anything that is actually useful in the business world, and soon enough you have Robin next to you (assuming you are Batman).
How?
For the alert gathering and storywriting part, look at my recent blog entry. For posting to Drupal, it's just Python's requests library.
data = {
"data": {
"type": "node--article",
"attributes":
{"title": str(blogtitle),
"body": { "value": str(response1),
"format": "plain_text"
}
}
}
}
headers = {'Content-type':'application/vnd.api+json',
'Accept':'application/vnd.api+json'}
r = requests.post("https://generativeai.whatsuphome.fi/jsonapi/node/article",data=json.dumps(data),headers=headers,auth=('myuser','mypassword'))
if r.status_code == 201:
print ("Success")
else:
print ("Fail")
Finally, I just have a cronjob scheduled to run every day at 7am.
0 7 * * * /path/to/my/script --title "Generate a blog post title based on the following Zabbix alerts" --question "Create an ongoing story based on the following Zabbix alerts" --title "Generate a title for a blog post based on following Zabbix alerts"
And it's done! Thanks to extremely rich toolset available for free for this kind of purposes makes AI really easy.
Future plans
I fear that with the same prompt used every morning things will get repetitive really soon. I'll let it run for now like that, but to make things more interesting, soon I'll try what happens if I ask GPT4All to generate a prompt for itself, and use that prompt to generate the story.
Add new comment