Closed alex-straw closed 10 months ago
looks good 👍 Can be merged
It looks like this conflicts with another PR. Please take a look and rectify. Let's get these fixes merged!
Merge conflicts resolved @daveshap & @RomanGoEmpire. I've also added in client = get_openai_client()
in a few more places where I spotted we were setting up clients.
Overview
I've refactored the OpenAI client initialisation into a single module to clean up the codebase and make it more DRY.
Following this (if people would like), I want to add a mock OpenAI client (which can be used if a specific env var is set). This addition will enable contributors to test the project more easily and without a valid API key. The centralised client setup change should make adding this mock client more straightforward.
PR Feedback
I've introduced pydantic-settings for environment variable management (suggsted by @gruckion - see commit: link). I'm open to any feedback or concerns regarding the introduction of this new library (requirements.txt soon?).
Pydantic-settings streamlines our setup and eases the addition of APIs like Pinecone in the future, a point @daveshap touched on in his recent video about enhancing agent communication.