25.8.14
This website uses cookies to ensure you get the best experience on our website. Learn more

Using OpenAI APIs: Accessing OpenAI APIs from Python

Mohlomi Pholoana

Skillsoft issued completion badges are earned based on viewing the percentage required or receiving a passing score when assessment is required. OpenAI application programming interfaces (APIs) represent a groundbreaking leap in the accessibility of state-of-the-art natural language processing (NLP) capabilities. These APIs provide developers with a powerful toolset to integrate advanced language models seamlessly into their applications, products, and services. You will start this course by engaging with OpenAI through the command-line, utilizing the OpenAI APIs. You will learn how to authenticate yourself using API keys when programmatically accessing API endpoints using cURL commands. You will explore how to configure context for past interactions with the model and access both chat completions and legacy completions APIs via their respective endpoints. Moving onto Python, you will install the OpenAI library to create a client object for endpoint access. You will configure the API key and send requests to the chat completions endpoint with prompts in the JSON format. You will also explore the legacy completions API using the same client object. You will be introduced to the diverse range of model offerings from OpenAI and learn how to use those models. Finally, you will configure model parameters to adjust the response from the model. You will learn about the seed parameter to receive deterministic responses and how the system fingerprint helps track infrastructure changes on the server. You will explore various parameters, including Top P and Temperature for controlling creativity, max length, and stop sequences for response length, and frequency and presence penalty for word and topic repetition.

Issued on

October 1, 2024

Expires on

Does not expire