Alans Classrooms

Lots of Useful Information

Installing the OpenAI Library on Python

11/8/2023

First Step - Open Visual Studio Code

Then I opened the my 'pythonapps' folder. It happens to be in this location: C:\Users\alanh\Dropbox\_Personal\My Software\Visual Studio Code\pythonapps

I verify things are working by typing:
python --version

Now I install openai by typing
pip install openai




Check to See if it Installed Correctly

type:
python

type
import openai


If you don't get an error, it installed correctly.

Type ctrl-Z to exit python.


This Installed Correctly




Upgraded the Software in CMD Command Prompt




Pip List Shows Python Libraries Installed in Your Current Environment




Setup OpenAI API Key






To Permanently Set The API Key




Running openai-test.py Produced An Error

It looks like I GOT NO CREDIT......



So I Loaded Up Some Money by 'Add to credit balance'

Now I have 5 bucks to spend. Now let's see what it says.



Success!

After what felt like an eternity (probably like 20 seconds), this showed up:

My first interaction with ChatGPT with Code.



"In the realm of code, where mysteries reside,\nThere lies a concept, both humble and wide.\nRecursion it's called, a loop like no other,\nA dance with itself, a cycle that doesn't smother.\n\nImagine a function, oh, brilliant and grand,\nThat calls upon itself, hand in hand.\nIt ventures forward, then looks back with grace,\nAn enchanting rhythm, like a waltz in space.\n\nThe journey begins with a single call,\nA problem to solve, both big and small.\nWith an eagle eye and a heart keen,\nThe function sets out, in the realm unseen.\n\nThrough iterations, in steps so precise,\nRecursion unravels, like threads intertwined.\nExamining each piece, with diligent measure,\nUnlocking the secrets, revealing hidden treasure.\n\nYet caution is key, for without a base,\nRecursion would wander endlessly, no trace.\nA condition to break, to find its way home,\nA safety net woven, in splendid chromes.\n\nLike a mirrored hall, reflections abound,\nRecursion traverses, dimensions profound.\nDown the rabbit hole, it spirals and twirls,\nA never-ending tale, where logic unfurls.\n\nFactoring numbers, like petals to the sun,\nRecursion peels layers, until the task is done.\nDivide and conquer, it chants with each stride,\nTaming complexity, with code as its guide.\n\nAnd so, dear programmers, let recursion inspire,\nEmbrace its elegance, let its spirit transpire.\nFor in the heart of code, where logic takes flight,\nRecursion dances, oh, what a marvelous sight!"

Hello and Welcome!

Here is some information about me:

Programmer - I have been programming since 1982. Some was for work as an Electrical Engineer, but of my programming has been as a hobby and for some entrepreneurial endeavors.

Business Owner - I have an MBA and have worked in and have managed small businesses for over 33 years.