3

Understanding Key Parameters and Their Impact on Generated Responses

In the previous chapter, we learned that the OpenAI API is not just one endpoint but also a collection of various endpoints. These endpoints are triggered with HTTP requests, which contain parameters in the corresponding request Body. For chat completions, the two required parameters are model and messages – and we’ve mainly seen how changing the messages parameter impacts the generated response. However, there is a vast collection of optional parameters that influence the behavior of the API, such as temperature, N, and the maximum number of tokens.

In this chapter, we will explore these optional key parameters and understand how they influence the generated response.

Get OpenAI API Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.