This is the repository for the LinkedIn Learning course Developing with Nondeterministic APIs
. The full course is available from LinkedIn Learning.
AI APIs produce nondeterministic output meaning the same prompt may produce different results every time it’s run. This poses unique challenges to developers because traditional software development is based on the premise that systems produce consistent and therefore deterministic outputs. In this course you’ll learn strategies for how to mitigate these unique challenges to meld traditional software development with modern AI tools.
See the readme file in the main branch for updated instructions and information.
This repository provides basic examples of how to introduce greater determinism and consistency to the responses from the OpenAI API.
The examples are demonstrated in the course and provided as-is. They are not meant as a follow-along exercise but rather for reference and further experimentation.
The examples are named for the chapter and video number they appear in. Each example is stand-alone and runs in terminal.
To use these exercise files you need an OpenAI API key. You get that key at platform.openai.com
- Click the "Code" button and select "Codespaces."
- Create a new Codespace or open one you've already created.
- Create a new file named
.env
in the root folder. - Add
OPENAI_API_KEY=
followed by your OpenAI API key to.env
- Note
.env
is not tracked by GitHub so the file will only exist in this Codespace. - To run the Python example in terminal, use the
python [filename].py
command.
Morten Rand-Hendriksen
Developer and Senior Staff Instructor
Check out my other courses on LinkedIn Learning.