fix: load .env file in call_llm.py and support provider URL fallback - #202
Open
cyrillenguetoum wants to merge 2 commits into
Open
cyrillenguetoum wants to merge 2 commits into
cyrillenguetoum wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
.envautomatically:utils/call_llm.pyis documented inREADME.mdas the verification script to run (python utils/call_llm.py) after configuring credentials in.env. However,load_dotenvwas previously only invoked inmain.py, causing direct execution ofpython utils/call_llm.pyto fail withValueError: LLM_PROVIDER environment variable is required. This PR addsload_dotenv(find_dotenv() or ...)at script initialization so it works whether run from the project root or theutils/directory.<provider>_URL: Added fallback check forf"{provider}_URL"in addition tof"{provider}_BASE_URL"to match the example naming inREADME.md.genaiimport: Wrappedfrom google import genaiin a safe import check so environments using other providers (e.g., Ollama) do not fail at top-level import ifgoogle-genaiis not installed.Testing
python utils/call_llm.pyruns successfully and queries the configured provider from both the project root andutils/.