Learning of Open API

Hi All,

Could anyone of you pls help me with sample programs and documentation to use Open AI Api.

I am interested in development and app creation using Open API.

Best Regards,

Mayuresh

Hi Mayuresh,

One of the easiest ways to see how the API works is the ‘view code’ button in playground. These provide functional code snippets in Python or Javascript, requiring your API key set in your environment variables.

Here’s the output for a classification prompt in python.

import os
import openai

openai.api_key = os.getenv("OPENAI_API_KEY")

restart_sequence = "\n"

response = openai.Completion.create(
  model="text-davinci-002",
  prompt="The following is a list of companies and the categories they fall into:\n\nApple, Facebook, Fedex\n\nApple\nCategory:",
  temperature=0,
  max_tokens=6,
  top_p=1,
  frequency_penalty=0,
  presence_penalty=0,
  stop=["\n"]
)

How can I start writing code as Playground credits are exhausted and I don’t know how I can renew for practice.

Also, are there any commercial apps built on GPT 3 which i can use…?

Thank you

You’ll have to pay for more tokens, you can add your payment method and adjust some settings here.

As far as some commercial apps, I’m aware of CopySmith and MessageBird which are operational commercial apps that are powered by GPT-3

Otherwise the API docs will be your best friend when writing code to work with GPT-3. Answers to technical questions will more often then not be found here.

1 Like