Gen-AI Developer Classroom notes 12/Aug/2025

Interacting with LargeLanguageModels – OpenAI

  • To interact with openai via api using python, we need to create an api key Refer Here
  • Create an api key and store it

  • Lets create a new python project by create a new folder

  • Ensure uv is installed Refer Here. Install using winget or homebrew
  • in the new folder execute the following commands
uv venv .venv
# activate virtual environment
uv init .
  • Now open the folder using vscode code .
  • Activate virtual environment Ctrl+shift+p => Select interpreter => .venv
  • Lets add two packages as dependencies
uv add openai
uv add python-dotenv
  • Create a file called as .env with contents
OPENAI_API_KEY=<your api key>
  • Refer Here for selecting developer environment
  • Refer Here for api reference of openai
  • Refer Here
  • Challenge:
    • Writing specific code for llm into our agents/RAGs might not be a good idea as we have loose coupling.
  • LangChain is an opensource framework which helps us solve this problem.

By continuous learner

enthusiastic technology learner

Leave a comment