Giter Site home page Giter Site logo

gpt3-example's Introduction

A simple example of using GPT-3

Installation

First, find the secret OpenAI API key from this page.

Then, create a text file named API_KEYS in this folder and put your OpenAI API key for access to GPT-3 models:

export OPENAI_API_KEY=<your OpenAI API key>

This file is in .gitignore since it is important that you do not accidentally commit your key. Install the python packages specified in requirements.txt:

pip install -r requirements.txt

Running the example

This example reads partial conversations from a text file (partial_dialogs.txt) and uses GPT-3 to generate continuations for them. It then classfies each new utterance based on being related/unrelated to the topic of "pets". This demonstrates bothe generation and classification capabilities of GPT-3.

Run the following command. The input variables are optional and if not provided, will assume their default values.

make self-chat engine=text-davinci-002 temperature=0.8

Please read through the Makefil and follow the Python code. Make sure you understand how the code works before using it for your project. The NeuralWorker class is at the center of this example, and is meant to be reusable for text generation and classfication tasks. IT calls openai.Completion.create() from the openai Python library. In order to understand what this function does, read the Create completion documentation.

gpt3-example's People

Contributors

s-jse avatar

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.