You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

As mentioned in this section, OpenAI provides several models that we can use in order to achieve our specific tasks.

In this section, we'll dive deeper into:

  • The available models
  • The API Limitation
  • How to test this API & get an API Key
  • What would be the best Model to use & pricing to follow
  • The number of tokens that should be used in our prompt to prevent errors


GPT : Generative Pre-trained Transformer 

  • Latest model
  • With broad general knowledge and domain expertise, GPT-4 can follow complex instructions in natural language and solve difficult problems with with greater accuracy.
  • is more creative and collaborative than ever before. It can generate, edit, and iterate with users on creative and technical writing tasks, such as composing songs, writing screenplays, or learning a user’s writing style.

  • Following the research path from GPT, GPT-2, and GPT-3, the deep learning approach leverages more data and more computation to create increasingly sophisticated and capable language models
  • 6 months were spent making GPT-4 safer and more aligned.

  • GPT-4 is 82% less likely to respond to requests for disallowed content and 40% more likely to produce factual responses than GPT-3.5 on our internal evaluations.

  • Price list for GPT-4  (Multiple models, each with different capabilities and price points. Prices are per 1,000 tokens. You can think of tokens as pieces of words, where 1,000 tokens is about 750 words.)

    ModelPromptCompletion
    8K context$0.03 / 1K tokens$0.06 / 1K tokens
    32K context$0.06 / 1K tokens$0.12 / 1K tokens
  • GPT-4 models

    LATEST MODELDESCRIPTIONMAX TOKENSTRAINING DATA
    gpt-4More capable than any GPT-3.5 model, able to do more complex tasks, and optimized for chat. Will be updated with our latest model iteration.8,192 tokensUp to Sep 2021
    gpt-4-0314Snapshot of gpt-4 from March 14th 2023. Unlike gpt-4, this model will not receive updates, and will only be supported for a three month period ending on June 14th 2023.8,192 tokensUp to Sep 2021
    gpt-4-32kSame capabilities as the base gpt-4 mode but with 4x the context length. Will be updated with our latest model iteration.32,768 tokensUp to Sep 2021
    gpt-4-32k-0314Snapshot of gpt-4-32 from March 14th 2023. Unlike gpt-4-32k, this model will not receive updates, and will only be supported for a three month period ending on June 14th 2023.32,768 tokensUp to Sep 2021


    For many basic tasks, the difference between GPT-4 and GPT-3.5 models is not significant. However, in more complex reasoning situations, GPT-4 is much more capable than any of our previous models.

  • Limitation:

          GPT-4 is currently in a limited beta and only accessible to those who have been granted access. In order to use this API we need to join the waitlist to get access when capacity is available.

GPT-3.5 models can understand and generate natural language or code. Our most capable and cost effective model in the GPT-3.5 family is gpt-3.5-turbo which has been optimized for chat but works well for traditional completions tasks as well.

LATEST MODELDESCRIPTIONMAX TOKENSTRAINING DATA
gpt-3.5-turboMost capable GPT-3.5 model and optimized for chat at 1/10th the cost of text-davinci-003. Will be updated with our latest model iteration.4,096 tokensUp to Sep 2021
gpt-3.5-turbo-0301Snapshot of gpt-3.5-turbo from March 1st 2023. Unlike gpt-3.5-turbo, this model will not receive updates, and will only be supported for a three month period ending on June 1st 2023.4,096 tokensUp to Sep 2021
text-davinci-003
  • Can do any language task with better quality, longer output, and consistent instruction-following than the curie, babbage, or ada models. Also supports inserting completions within text.
4,097 tokensUp to Jun 2021
text-davinci-002Similar capabilities to text-davinci-003 but trained with supervised fine-tuning instead of reinforcement learning4,097 tokensUp to Jun 2021
code-davinci-002

Optimized for code-completion tasks

Now deprecated

8,001 tokensUp to Jun 2021

Recommendation to use gpt-3.5-turbo over the other GPT-3.5 models because of its lower cost.

Experimenting with gpt-3.5-turbo is a great way to find out what the API is capable of doing. After you have an idea of what you want to accomplish, you can stay with gpt-3.5-turbo or another model and try to optimize around its capabilities.

Note: OpenAI models are non-deterministic, meaning that identical inputs can yield different outputs. Setting temperature to 0 will make the outputs mostly deterministic, but a small amount of variability may remain.

  • GPT-3 models can understand and generate natural language.
  • These models were superceded by the more powerful GPT-3.5 generation models.
  • However, the original GPT-3 base models (davinci, curie, ada, and babbage) are current the only models that are available to fine-tune.
  • Fine-tuning mean to build and train our own data from one of GPT-3 Models

 Comparative Table:   

 


As a language model based on the GPT-3 architecture, the GPT-3 API has some limitations, including:

  • Limited control over outputs: While the GPT-3 API can generate high-quality text, it may not always produce the output you want. It can be difficult to control the direction of the text or ensure that it stays on topic.
  • Expensive pricing: The GPT-3 API can be quite expensive to use, especially for large-scale projects. This can be a limiting factor for individuals or small businesses who want to use the API but don't have the resources to do so.
  • Limited access: Currently, the GPT-3 API is only available to selected partners and developers. This means that not everyone has access to the API, which can limit its usefulness in certain contexts.
  • Bias and fairness issues: As with any AI system, the GPT-3 API is not immune to bias and fairness issues. These issues can affect the accuracy and usefulness of the model, particularly in sensitive areas such as healthcare or criminal justice.
  • Lack of transparency: The GPT-3 API is a proprietary system, and its inner workings are not transparent to the public. This can make it difficult to assess the model's accuracy and potential biases.
  • We can use the GPT comparison tool that lets us run different models side-by-side to compare outputs, settings, and response times and then download the data into an Excel spreadsheet.
  • Under the examples section, we can benefit from examples to choose what we want
  • For example we can use text-davinci-003 for SQL Translation

         

         

  • Other example we can benefit from, to reduce the email content, before sending it in the prompt:  using text-davinci-003

          For sure we need to test how limited the # of tokens in this example prompt itself

                                                            or                   

                                                        

  • For retrieving data from the email we can try one of these examples: using text-davinci-003

                                     or                     

                                                         

  • Use cases
    • Classification
    • Translation
    • Copywriting
    • Summarization
    • Parsing unstructured text

In order to test the API we need to get an API Key:

  • OpenAI provides a free tier for the GPT-3 API that allows developers to experiment with the API and build small-scale applications without incurring any costs.

  • The free tier provides access to a limited number of API requests per month, after which you will need to upgrade to a paid plan to continue using the API.
  • It's important to note that the availability and terms of these resources may change over time, so it's best to check with OpenAI directly for the most up-to-date information on their programs and offerings.
  • Supported languages: it provides several SDKs and libraries to use the API in different programming languages, including Python, Node.js, Java, Ruby, C#
  • I've found 2 ways to get an API Key:
    • Steps: 

      Note that in the new documentation we can't find GPT-3 we find GPT-4

      • Go to the OpenAI website: Visit the OpenAI website at https://openai.com/.
      • Click on "Products": From the OpenAI homepage, click on the "Products" tab located in the top navigation menu.
      • Click on "GPT-3": From the Products page, click on the "GPT-3" option to learn more about the API.
      • Click on "Apply for Access": Once you have reviewed the information about the GPT-3 API, click on the "Apply for Access" button located on the GPT-3 page.
      • Fill out the application form: Fill out the application form with your personal and project information. You will need to provide information about your intended use of the API, as well as your technical expertise and experience.
      • Agree to the terms: Read and agree to the terms of the GPT-3 API access agreement.
      • Submit your application: Once you have completed the application form and agreed to the terms, submit your application for review.
      • Wait for approval: The review process can take several weeks, and not all applications are approved. If your application is approved, you will receive an email with instructions on how to set up your account and obtain an API key.
      • Set up your account: Follow the instructions in the email to set up your OpenAI account. You will need to create a password and verify your email address.
      • Obtain your API key: Once your account is set up, log in to the OpenAI developer dashboard (https://beta.openai.com/login/) and navigate to the API keys section. Here you will find your API key, which you can copy and use in your application.
      1. Go to the OpenAI website at https://openai.com/.
      2. Click on the "Get Started for Free" button in the top right corner of the page.
      3. Sign up for an OpenAI account by providing your email address and a password.
      4. Once you've signed up, log in to your OpenAI account.
      5. Navigate to the API Keys section of your account dashboard.
      6. Create a new API key by clicking the "New API Key" button.
      7. Select the text-davinci-003 model from the dropdown menu of available models.
      8. Give your API key a name and description, if desired.
      9. Click the "Create API Key" button to generate your new API key.
  • No labels