                    <div class="error">
                        <p>lessphp fatal error:  File `` not found. in style.less</p>
                    </div>
                    {"id":14229,"date":"2023-03-11T03:11:27","date_gmt":"2023-03-11T03:11:27","guid":{"rendered":"https:\/\/gptexpertise.com\/?post_type=docs&#038;p=14229"},"modified":"2023-03-11T04:54:53","modified_gmt":"2023-03-11T04:54:53","slug":"documentation","status":"publish","type":"docs","link":"https:\/\/gptexpertise.com\/ar\/docs\/documentation\/","title":{"rendered":"Documentation"},"content":{"rendered":"<p><a href=\"https:\/\/platform.openai.com\/docs\/introduction\/introduction\"><\/a><\/p>\n\n\n\n<h2><strong>Introduction<\/strong><\/h2>\n\n\n\n<h3><strong>Overview<\/strong><\/h3>\n\n\n\n<p>The GPT API can be applied to virtually any task that involves understanding or generating natural language or code. We offer a spectrum of&nbsp;models&nbsp;with different levels of power suitable for different tasks, as well as the ability to&nbsp;fine-tune&nbsp;your own custom models. These models can be used for everything from content generation to semantic search and classification.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3><strong>Key concepts<\/strong><\/h3>\n\n\n\n<p>We recommend completing our quick start tutorial to get acquainted with key concepts through a hands-on, interactive example.<\/p>\n\n\n\n<h3><strong>Quick start tutorial<\/strong><\/h3>\n\n\n\n<p>Learn by building a quick sample application!<\/p>\n\n\n\n<h3><strong>Prompts and completions.<\/strong><\/h3>\n\n\n\n<p>The&nbsp;completions&nbsp;endpoint is at the center of our API. It provides a simple interface to our models that is extremely flexible and powerful. You input some text as a&nbsp;<strong>prompt<\/strong>, and the model will generate a text&nbsp;<strong>completion<\/strong>&nbsp;that attempts to match whatever context or pattern you gave it. For example, if you give the API the prompt, \u201cWrite a tagline for an ice cream shop\u201d, it will return a completion like \u201cWe serve up smiles with every scoop!\u201d<\/p>\n\n\n\n<p>Designing your prompt&nbsp;is essentially how you \u201cprogram\u201d the model, usually by providing some instructions or a few examples. This is different from most other NLP services which are designed for a single task, such as sentiment classification or named entity recognition. Instead, the completions endpoint can be used for virtually any task including content or code generation, summarization, expansion, conversation, creative writing, style transfer, and more.<\/p>\n\n\n\n<h3><strong>Tokens<\/strong><\/h3>\n\n\n\n<p>Our models understand and process text by breaking it down into tokens. Tokens can be words or just chunks of characters. For example, the word \u201chamburger\u201d gets broken up into the token\u2019s \u201cham\u201d, \u201cbur\u201d and \u201cger\u201d, while a short and common word like \u201cpear\u201d is a single token. Many tokens start with a whitespace, for example \u201chello\u201d and \u201c bye\u201d.<\/p>\n\n\n\n<p>The number of tokens processed in a given API request depends on the length of both your inputs and outputs. As a rough rule of thumb, 1 token is approximately 4 characters or 0.75 words for English text. One limitation to keep in mind is that your text prompt and generated completion combined must be no more than the model&#8217;s maximum context length (for most models this is 2048 tokens, or about 1500 words). Check out our&nbsp;tokenizer tool&nbsp;to learn more about how text translates to tokens.<\/p>\n\n\n\n<h3><strong>Models<\/strong><\/h3>\n\n\n\n<p>The API is powered by a set of models with different capabilities and price points. Our base GPT-3 models are called Davinci, Curie, Babbage and Ada. Our Codex series is a descendant of GPT-3 that\u2019s been trained on both natural language and code. To learn more, visit our&nbsp;models documentation.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2><strong>Next steps<\/strong><\/h2>\n\n\n\n<ul>\n<li>Keep our&nbsp;usage policies&nbsp;in mind as you start building your application.<\/li>\n\n\n\n<li>Explore our&nbsp;examples library&nbsp;for inspiration.<\/li>\n\n\n\n<li>Jump into one of our guides to start building.<\/li>\n<\/ul>\n\n\n\n<h3><strong>Quick start<\/strong><\/h3>\n\n\n\n<p>GPT AI 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.<\/p>\n\n\n\n<p>In this quick start tutorial, you\u2019ll build a simple sample application. Along the way, you\u2019ll learn key concepts and techniques that are fundamental to using the API for any task, including:<\/p>\n\n\n\n<ul>\n<li>Content generation<\/li>\n\n\n\n<li>Summarization<\/li>\n\n\n\n<li>Classification, categorization, and sentiment analysis<\/li>\n\n\n\n<li>Data extraction<\/li>\n\n\n\n<li>Translation<\/li>\n\n\n\n<li>Many more!<\/li>\n<\/ul>\n\n\n\n<h2><strong>Introduction<\/strong><\/h2>\n\n\n\n<p>The&nbsp;completions&nbsp;endpoint is the core of our API and provides a simple interface that\u2019s extremely flexible and powerful. You input some text as a&nbsp;<strong>prompt<\/strong>, and the API will return a text&nbsp;<strong>completion<\/strong>&nbsp;that attempts to match whatever instructions or context you gave it.<\/p>\n\n\n\n<p>Prompt<\/p>\n\n\n\n<p>Write a tagline for an ice cream shop.<\/p>\n\n\n\n<h2>Completion<\/h2>\n\n\n\n<p>We serve up smiles with every scoop!<\/p>\n\n\n\n<p>You can think of this as a very advanced autocomplete \u2014 the model processes your text prompt and tries to predict what\u2019s most likely to come next.<\/p>\n\n\n\n<h3>1<strong>Start with an instruction<\/strong><\/h3>\n\n\n\n<p>Imagine you want to create a pet name generator. Coming up with names from scratch is hard!<\/p>\n\n\n\n<p>First, you\u2019ll need a prompt that makes it clear what you want. Let\u2019s start with an instruction.\u00a0<strong>Submit this prompt<\/strong>\u00a0to generate your first completion.<\/p>\n\n\n\n<p>Not bad! Now, try making your instructions more specific.<\/p>\n\n\n\n<p>As you can see, adding a simple adjective to our prompt changes the resulting completion. Designing your prompt is essentially how you \u201cprogram\u201d the model.<\/p>\n\n\n\n<h3>2<strong>Add some examples<\/strong><\/h3>\n\n\n\n<p>Crafting good instructions is important for getting good results, but sometimes they aren\u2019t enough. Let\u2019s try making your instruction even more complex.<\/p>\n\n\n\n<p>This completion isn&#8217;t quite what we want. These names are pretty generic, and it seems like the model didn&#8217;t pick up on the horse part of our instruction. Let\u2019s see if we can get it to come up with some more relevant suggestions.<\/p>\n\n\n\n<p>In many cases, it\u2019s helpful to both show\u00a0<em>and<\/em>\u00a0tell the model what you want. Adding examples to your prompt can help communicate patterns or nuances. Try submitting this prompt which includes a couple of examples.<\/p>\n\n\n\n<p>Nice! Adding examples of the output we\u2019d expect for a given input helped the model provide the types of names we were looking for.<\/p>\n\n\n\n<h3>3<strong>Adjust your settings<\/strong><\/h3>\n\n\n\n<p>Prompt design isn\u2019t the only tool you have at your disposal. You can also control completions by adjusting your settings. One of the most important settings is called&nbsp;<strong>temperature<\/strong>.<\/p>\n\n\n\n<p>You may have noticed that if you submitted the same prompt multiple times in the examples above, the model would always return identical or very similar completions. This is because your temperature was set to&nbsp;<strong>0<\/strong>.<\/p>\n\n\n\n<p>Try re-submitting the same prompt a few times with temperature set to&nbsp;<strong>1<\/strong>.<\/p>\n\n\n\n<p>\u200d<\/p>\n\n\n\n<p>Temperature<\/p>\n\n\n\n<p>See what happened? When temperature is above 0, submitting the same prompt results in different completions each time.<\/p>\n\n\n\n<p>Remember that the model predicts which text is most likely to follow the text preceding it. Temperature is a value between 0 and 1 that essentially lets you control how confident the model should be when making these predictions. Lowering temperature means it will take fewer risks, and completions will be more accurate and deterministic. Increasing temperature will result in more diverse completions.<\/p>\n\n\n\n<p><strong>DEEP DIVE<\/strong><\/p>\n\n\n\n<h2><strong>Understanding tokens and probabilities<\/strong><\/h2>\n\n\n\n<p>For your pet\u2019s name generator, you probably want to be able to generate a lot of name ideas. A moderate temperature of 0.6 should work well.<\/p>\n\n\n\n<h3>4<strong>Build your application<\/strong><\/h3>\n\n\n\n<p>NODE.JSPYTHON (FLASK)<\/p>\n\n\n\n<p>Now that you\u2019ve found a good prompt and settings, you\u2019re ready to build your pet name generator! We\u2019ve written some code to get you started \u2014 follow the instructions below to download the code and run the app.<\/p>\n\n\n\n<h3><strong>Setup<\/strong><\/h3>\n\n\n\n<p>If you don\u2019t have Node.js installed,&nbsp;install it from here. Then download the code by cloning&nbsp;this repository.<\/p>\n\n\n\n<p>If you prefer not to use git, you can alternatively download the code using&nbsp;this zip file.<\/p>\n\n\n\n<h3><strong>Understand the code<\/strong><\/h3>\n\n\n\n<p>Open&nbsp;generate.js&nbsp;in the&nbsp;GPT-quick start-node\/pages\/API&nbsp;folder. At the bottom, you\u2019ll see the function that generates the prompt that we were using above. Since users will be entering the type of animal their pet is, it dynamically swaps out the part of the prompt that specifies the animal.<\/p>\n\n\n\n<ul>\n<li>1 function generatePrompt(animal) {<\/li>\n\n\n\n<li>2 const capitalizedAnimal = animal[0].toUpperCase() + animal.slice(1).toLowerCase();<\/li>\n\n\n\n<li>3 return `Suggest three names for an animal that is a superhero.<\/li>\n\n\n\n<li>4 Animal: Cat<\/li>\n\n\n\n<li>5 Names: Captain Sharp claw, Agent Fluffball, The Incredible Feline<\/li>\n\n\n\n<li>6 Animal: Dog<\/li>\n\n\n\n<li>7 Names: Ruff the Protector, Wonder Canine, Sir Barks-a-Lot<\/li>\n\n\n\n<li>8 Animal: ${capitalizedAnimal}<\/li>\n\n\n\n<li>9 Names:`;<\/li>\n\n\n\n<li>10 \u00a0}<\/li>\n<\/ul>\n\n\n\n<p>11 On line 9 in&nbsp;generate.js, you\u2019ll see the code that sends the actual API request. As mentioned above, it uses the&nbsp;<a href=\"https:\/\/platform.openai.com\/docs\/api-reference\/completions\">completions<\/a>&nbsp;endpoint with a temperature of 0.6.<\/p>\n\n\n\n<ul>\n<li>1 const completion = await openai.createCompletion({<\/li>\n\n\n\n<li>2 \u00a0\u00a0model: &#8220;text-davinci-003&#8221;,<\/li>\n\n\n\n<li>3 prompt: generatePrompt(req.body.animal),<\/li>\n\n\n\n<li>4 \u00a0\u00a0temperature: 0.6,<\/li>\n\n\n\n<li>5 });\u00a0<\/li>\n<\/ul>\n\n\n\n<p>And that\u2019s it! You should now have a full understanding of how your (superhero) pet name generator uses the GPT API!<\/p>\n\n\n\n<h3><strong>Closing<\/strong><\/h3>\n\n\n\n<p>These concepts and techniques will go a long way in helping you build your own application. That said, this simple example demonstrates just a sliver of what\u2019s possible! The completions endpoint is flexible enough to solve virtually any language processing task, including content generation, summarization, semantic search, topic tagging, sentiment analysis, and so much more.<\/p>\n\n\n\n<p>One limitation to keep in mind is that, for most&nbsp;<strong>models<\/strong>, a single API request can only process up to 2,048 tokens (roughly 1,500 words) between your prompt and completion.<\/p>\n\n\n\n<p><strong>DEEP DIVE<\/strong><\/p>\n\n\n\n<h3><strong>Models and pricing<\/strong><\/h3>\n\n\n\n<p>For more advanced tasks, you might find yourself wishing you could provide more examples or context than you can fit in a single prompt. The&nbsp;fine-tuning API&nbsp;is a great option for more advanced tasks like this.&nbsp;<strong>Fine-tuning<\/strong>&nbsp;allows you to provide hundreds or even thousands of examples to customize a model for your specific use case.<\/p>\n\n\n\n<h3><strong>Next steps<\/strong><\/h3>\n\n\n\n<p>To get inspired and learn more about designing prompts for different tasks:<\/p>\n\n\n\n<ul>\n<li>Read our&nbsp;completion guide.<\/li>\n\n\n\n<li>Explore our library of&nbsp;example prompts.<\/li>\n\n\n\n<li>Start experimenting in the&nbsp;Playground.<\/li>\n\n\n\n<li>Keep our&nbsp;usage policies&nbsp;in mind as you start building.<\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Introduction Overview The GPT API can be applied to virtually any task that involves understanding or generating natural language or code. We offer a spectrum of&nbsp;models&nbsp;with different levels of power suitable for different tasks, as well as the ability to&nbsp;fine-tune&nbsp;your own custom models. These models can be used for everything from content generation to semantic [&hellip;]<\/p>","protected":false},"author":1,"featured_media":0,"parent":0,"comment_status":"open","ping_status":"closed","template":"","meta":[],"doc_category":[],"doc_tag":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/gptexpertise.com\/ar\/wp-json\/wp\/v2\/docs\/14229"}],"collection":[{"href":"https:\/\/gptexpertise.com\/ar\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/gptexpertise.com\/ar\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/gptexpertise.com\/ar\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gptexpertise.com\/ar\/wp-json\/wp\/v2\/comments?post=14229"}],"version-history":[{"count":9,"href":"https:\/\/gptexpertise.com\/ar\/wp-json\/wp\/v2\/docs\/14229\/revisions"}],"predecessor-version":[{"id":14252,"href":"https:\/\/gptexpertise.com\/ar\/wp-json\/wp\/v2\/docs\/14229\/revisions\/14252"}],"wp:attachment":[{"href":"https:\/\/gptexpertise.com\/ar\/wp-json\/wp\/v2\/media?parent=14229"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/gptexpertise.com\/ar\/wp-json\/wp\/v2\/doc_category?post=14229"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/gptexpertise.com\/ar\/wp-json\/wp\/v2\/doc_tag?post=14229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}