GithubHelp home page GithubHelp logo

joethemanhowie / pyai Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 17 KB

Module implementing practial use cases of OpenAI

License: GNU General Public License v3.0

Python 100.00%
module openai-api python3 machine-learning

pyai's Introduction

pyai

pyai is a simple module that provides a simple way to run and save content produced by openai. This module is based off the tutorial notebook in the OpenAI repo here. For a detailed walk through of the classes used in this module consult those notebook tutorials.

Overview:

We have three main use cases for the (openai python api)[https://beta.openai.com/docs/api-reference/introduction]: text Completion, Image generation, and Code creation. See notebook tutorials for details.

Here we have three Classes that allow for easy use of the create methods for any of the three use cases.

  1. TextCompletion
  2. ImageGeneration

Each with similar api's, which allow you to: run prompts through the models, save the output, and display the generated result.

Setting up API key:

There are two ways to set up the api key for openai. In the Getting started tutorial notebooks we maually enter the key every time. That method becomes impractical after prolonged use. We recommend that users set these keys in their bash profiles (if you are on Linux/MacOS). I have not tested on windows yet on setting up the OPEN_API_KEY. If someone using the python API has done this feel free to comment or contribute and let me know :)

  1. Open/Create .profile in your home directory (if you are on a M1(2020) or newer Mac, this is now called .zprofile because of zsh is used on these machine instead of bash).
  2. Then include the following to lines: OPENAI_API_KEY="your-key", and export OPENAI_API_KEY
  3. Finally, restart the terminal or run the command source .zprofile to apply the change to the file

TextCompletion:

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.