Skip to content

Conversation

@aksg87
Copy link
Collaborator

@aksg87 aksg87 commented Nov 18, 2025

fix: enforce dotenv override, warn on key conflict, and refactor factory

Description

Fixes API key loading issues and improves factory error handling.

Changes

  • Env Vars: Enforce dotenv.load_dotenv(override=True) in entry points to prioritize .env over system vars.
  • Warnings: Warn on conflicting API keys (e.g., GEMINI_API_KEY vs LANGEXTRACT_API_KEY).
  • Refactor: Extract _resolve_provider_class in factory.py to deduplicate code and fix ImportError handling in _create_model_with_schema.
  • Cleanup: Remove excessive comments in factory.py.

Verification

  • Verified tests/test_live_api.py and benchmarks/benchmark.py load keys correctly.
  • Verified warning triggers on conflict.
  • Passed tox (lint, format, tests).

Enforces dotenv override in entry points and warns on conflicting API keys. Also cleans up comments in factory.py.
@aksg87 aksg87 marked this pull request as ready for review November 19, 2025 02:33
@aksg87 aksg87 self-assigned this Nov 19, 2025
@aksg87 aksg87 merged commit 59e9ab8 into main Nov 19, 2025
15 checks passed
@aksg87 aksg87 deleted the fix/env-loading branch November 19, 2025 02:34
aksg87 added a commit to aksg87/langextract that referenced this pull request Nov 20, 2025
Enforces dotenv override in entry points and warns on conflicting API keys.
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