ChatGPT API tutorial

来源: 2023-02-08 06:21:47 [旧帖] [给我悄悄话] 本文已被阅读:

OpenAI has trained cutting-edge language models that are very good at understanding and generating text. Our API provides access to these models and can be used to solve virtually any task that involves processing language.

In this quickstart tutorial, you’ll build a simple sample application. Along the way, you’ll learn key concepts and techniques that are fundamental to using the API for any task, including:

  • Content generation
  • Summarization
  • Classification, categorization, and sentiment analysis
  • Data extraction
  • Translation
  • Many more!

The completions endpoint is the core of our API and provides a simple interface that’s extremely flexible and powerful. You input some text as a prompt, and the API will return a text completion that attempts to match whatever instructions or context you gave it.

Prompt
Write a tagline for an ice cream shop.
 
 
Completion
We serve up smiles with every scoop!

You can think of this as a very advanced autocomplete — the model processes your text prompt and tries to predict what’s most likely to come next.

 

---Coding my very first ChatGPT program.