Skip to content

fix: load .env file in call_llm.py and support provider URL fallback - #202

Open
cyrillenguetoum wants to merge 2 commits into
The-Pocket:mainfrom
cyrillenguetoum:fix/load-dotenv-in-call-llm
Open

cyrillenguetoum wants to merge 2 commits into
The-Pocket:mainfrom
cyrillenguetoum:fix/load-dotenv-in-call-llm

Conversation

@cyrillenguetoum

@cyrillenguetoum cyrillenguetoum commented Sep 25, 2026 •

Copy link
Copy Markdown

Summary of Changes

  • Load .env automatically: utils/call_llm.py is documented in README.md as the verification script to run (python utils/call_llm.py) after configuring credentials in .env. However, load_dotenv was previously only invoked in main.py, causing direct execution of python utils/call_llm.py to fail with ValueError: LLM_PROVIDER environment variable is required. This PR adds load_dotenv(find_dotenv() or ...) at script initialization so it works whether run from the project root or the utils/ directory.
  • Support <provider>_URL: Added fallback check for f"{provider}_URL" in addition to f"{provider}_BASE_URL" to match the example naming in README.md.
  • Resilient genai import: Wrapped from google import genai in a safe import check so environments using other providers (e.g., Ollama) do not fail at top-level import if google-genai is not installed.

Testing

  • Verified python utils/call_llm.py runs successfully and queries the configured provider from both the project root and utils/.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant