Giter Site home page Giter Site logo

mstewgt / ai-musings Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 11 KB

Twitter bot that generates and posts random musings using the OpenAI API @ https://beta.openai.com/

Home Page: https://twitter.com/AI_Musings

Python 100.00%
ai artificial-intelligence twitter-api twitter-bot python openai

ai-musings's Introduction

AI Musings

A Python Twitter bot that generates and posts random musings using a series of APIs.

Random word generator

The script first gets a couple of random words by making calls to an API @ https://random-word-api.herokuapp.com. It then inserts these words into a predetermined prompt which will be fed to the AI.

Sumbit input to AI

The script then calls the Davinci Completion API at https://beta.openai.com/ using the constructed input prompt.

Output cleanup

Next the script extracts the 'text' property from the json return of the AI API and cuts off anything after the last period to try and account for any sentences the AI might not have been able to finish in the provided token length. This was set to try and keep the AI's response within the character limiation of a standard Tweet.

Tweet submission

Finally, the script uses the Tweepy library to authenticate to the Twitter account and make a post using the generated content.

Necessary packages

  • python-decouple
  • requests
  • openai
  • tweepy

ai-musings's People

Contributors

mstewgt avatar

Stargazers

 avatar

Watchers

 avatar  avatar

ai-musings's Issues

Randomize the prompt type

Current prompt works well but I think it would be fun for it to choose a random prompt each time from a list.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.