Skip to content

fix: azure env variable names for judgeLLM#129

Merged
asamal4 merged 2 commits intolightspeed-core:mainfrom
asamal4:fix-azure-env
Jan 7, 2026
Merged

fix: azure env variable names for judgeLLM#129
asamal4 merged 2 commits intolightspeed-core:mainfrom
asamal4:fix-azure-env

Conversation

@asamal4
Copy link
Collaborator

@asamal4 asamal4 commented Jan 6, 2026

Description

fix azure env variable names for judgeLLM

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Unit tests improvement

Tools used to create PR

Identify any AI code assistants used in this PR (for transparency and review context)

  • Assisted-by: (e.g., Claude, CodeRabbit, Ollama, etc., N/A if not used)
  • Generated by: (e.g., tool name and version; N/A if not used)

Related Tickets & Documents

  • Related Issue #
  • Closes #

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

Summary by CodeRabbit

  • Documentation

    • Enhanced Azure OpenAI integration setup documentation with environment variable configuration guidance.
  • Chores

    • Standardized Azure environment variable names for improved consistency across the codebase.
    • Updated internal tests to align with environment variable naming changes.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

Walkthrough

Standardizes Azure environment variable naming across the codebase by renaming AZURE_OPENAI_* variables to simplified AZURE_* names (AZURE_API_KEY, AZURE_API_BASE, AZURE_DEPLOYMENT_NAME) in documentation, source code, and tests.

Changes

Cohort / File(s) Summary
Documentation
README.md, lsc_agent_eval/README.md
Added Azure OpenAI integration notes and updated environment variable references to use new AZURE_API_KEY, AZURE_API_BASE, and AZURE_DEPLOYMENT_NAME naming convention
Azure Provider Logic
lsc_agent_eval/src/lsc_agent_eval/core/utils/judge.py, src/lightspeed_evaluation/core/llm/manager.py
Updated environment variable lookups and error messages to reference new Azure env var names; deployment name construction logic remains unchanged
Environment Validation
src/lightspeed_evaluation/core/system/env_validator.py
Updated Azure environment validation to expect AZURE_API_KEY and AZURE_API_BASE instead of legacy AZURE_OPENAI_* names
Test Suite
lsc_agent_eval/tests/core/utils/test_judge.py, tests/unit/core/llm/test_llm_manager.py, tests/unit/core/system/test_env_validator.py
Updated test environment variable mocking and assertions to use new AZURE_API_KEY, AZURE_API_BASE, and AZURE_DEPLOYMENT_NAME names

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • agent eval: verbose print and fixes #20: Modifies the same judge.py file (Azure provider handling); the related PR changes logging level while this PR renames Azure environment variables in the same area.

Suggested reviewers

  • tisnik

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: renaming Azure environment variables for judgeLLM throughout the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
lsc_agent_eval/README.md (1)

193-193: Document AZURE_API_VERSION if required.

The line mentions AZURE_API_BASE (with a placeholder value), but earlier context in the codebase and Azure OpenAI documentation often reference an optional AZURE_API_VERSION variable. If this variable is used by the LiteLLM integration for Azure, consider documenting it here for completeness.

README.md (1)

337-342: LGTM! Consider adding a migration note for existing users.

The Azure environment variable documentation is clear and accurate. Since this is a breaking change from previous AZURE_OPENAI_* variables, consider adding a note in release notes or a migration guide to help existing users update their configurations.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d4031ca and 88f145f.

📒 Files selected for processing (8)
  • README.md
  • lsc_agent_eval/README.md
  • lsc_agent_eval/src/lsc_agent_eval/core/utils/judge.py
  • lsc_agent_eval/tests/core/utils/test_judge.py
  • src/lightspeed_evaluation/core/llm/manager.py
  • src/lightspeed_evaluation/core/system/env_validator.py
  • tests/unit/core/llm/test_llm_manager.py
  • tests/unit/core/system/test_env_validator.py
🧰 Additional context used
📓 Path-based instructions (3)
**/test_*.py

📄 CodeRabbit inference engine (AGENTS.md)

Use pytest mocking (mocker fixture) instead of unittest.mock

Files:

  • lsc_agent_eval/tests/core/utils/test_judge.py
  • tests/unit/core/llm/test_llm_manager.py
  • tests/unit/core/system/test_env_validator.py
src/lightspeed_evaluation/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

src/lightspeed_evaluation/**/*.py: Provide type hints for all public functions and methods
Use Google-style docstrings for all public APIs
Use custom exceptions from core.system.exceptions for error handling
Use structured logging with appropriate levels in lightspeed_evaluation modules

Files:

  • src/lightspeed_evaluation/core/system/env_validator.py
  • src/lightspeed_evaluation/core/llm/manager.py
tests/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Mirror test structure to source code organization, with test files named test_.py and test functions/classes named test_ and Test*

Files:

  • tests/unit/core/llm/test_llm_manager.py
  • tests/unit/core/system/test_env_validator.py
🧠 Learnings (5)
📓 Common learnings
Learnt from: asamal4
Repo: lightspeed-core/lightspeed-evaluation PR: 47
File: src/lightspeed_evaluation/core/api/__init__.py:3-3
Timestamp: 2025-09-09T08:08:40.654Z
Learning: API_KEY and OPENAI_API_KEY are distinct environment variables with different purposes in the lightspeed-evaluation codebase - they should not be treated as interchangeable fallbacks.
Learnt from: asamal4
Repo: lightspeed-core/lightspeed-evaluation PR: 47
File: src/lightspeed_evaluation/core/output/generator.py:140-145
Timestamp: 2025-09-11T12:47:06.747Z
Learning: User asamal4 prefers that non-critical comments are sent when actual code changes are pushed, not on unrelated commits.
📚 Learning: 2025-12-11T10:05:06.422Z
Learnt from: CR
Repo: lightspeed-core/lightspeed-evaluation PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-11T10:05:06.422Z
Learning: Do not add new features to lsc_agent_eval/ directory - add to src/lightspeed_evaluation/ instead

Applied to files:

  • lsc_agent_eval/README.md
📚 Learning: 2025-09-09T08:08:40.654Z
Learnt from: asamal4
Repo: lightspeed-core/lightspeed-evaluation PR: 47
File: src/lightspeed_evaluation/core/api/__init__.py:3-3
Timestamp: 2025-09-09T08:08:40.654Z
Learning: API_KEY and OPENAI_API_KEY are distinct environment variables with different purposes in the lightspeed-evaluation codebase - they should not be treated as interchangeable fallbacks.

Applied to files:

  • lsc_agent_eval/README.md
  • lsc_agent_eval/tests/core/utils/test_judge.py
  • src/lightspeed_evaluation/core/system/env_validator.py
  • tests/unit/core/system/test_env_validator.py
  • README.md
  • lsc_agent_eval/src/lsc_agent_eval/core/utils/judge.py
📚 Learning: 2025-09-18T23:59:37.026Z
Learnt from: asamal4
Repo: lightspeed-core/lightspeed-evaluation PR: 55
File: src/lightspeed_evaluation/core/system/validator.py:146-155
Timestamp: 2025-09-18T23:59:37.026Z
Learning: In the lightspeed-evaluation project, the DataValidator in `src/lightspeed_evaluation/core/system/validator.py` is intentionally designed to validate only explicitly provided user evaluation data, not resolved metrics that include system defaults. When turn_metrics is None, the system falls back to system config defaults, and this validation separation is by design.

Applied to files:

  • src/lightspeed_evaluation/core/system/env_validator.py
📚 Learning: 2025-07-16T12:07:29.169Z
Learnt from: asamal4
Repo: lightspeed-core/lightspeed-evaluation PR: 19
File: lsc_agent_eval/tests/core/agent_goal_eval/test_script_runner.py:0-0
Timestamp: 2025-07-16T12:07:29.169Z
Learning: In the lsc_agent_eval package, the ScriptRunner class was modified to use absolute paths internally rather than documenting path normalization behavior, providing more predictable and consistent path handling.

Applied to files:

  • lsc_agent_eval/src/lsc_agent_eval/core/utils/judge.py
🧬 Code graph analysis (1)
lsc_agent_eval/src/lsc_agent_eval/core/utils/judge.py (1)
lsc_agent_eval/src/lsc_agent_eval/core/utils/exceptions.py (1)
  • JudgeModelError (20-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: tests (3.13)
🔇 Additional comments (9)
src/lightspeed_evaluation/core/system/env_validator.py (1)

27-27: LGTM! Azure environment variable validation updated correctly.

The required Azure environment variables have been updated to use the simplified naming convention (AZURE_API_KEY, AZURE_API_BASE). Note that AZURE_DEPLOYMENT_NAME is intentionally not validated here since it has a fallback to config.model in the manager (line 63 of manager.py).

src/lightspeed_evaluation/core/llm/manager.py (1)

63-63: LGTM! Azure deployment name handling updated correctly.

The code now reads from AZURE_DEPLOYMENT_NAME instead of AZURE_OPENAI_DEPLOYMENT_NAME, maintaining the same fallback logic to self.config.model when the environment variable is not set.

lsc_agent_eval/tests/core/utils/test_judge.py (1)

38-40: LGTM! Azure environment variables updated correctly in test.

All three Azure environment variable names have been updated to use the simplified naming convention:

  • AZURE_API_KEY (was AZURE_OPENAI_API_KEY)
  • AZURE_API_BASE (was AZURE_OPENAI_ENDPOINT)
  • AZURE_DEPLOYMENT_NAME (was AZURE_OPENAI_DEPLOYMENT_NAME)

The test correctly validates that the JudgeModelManager constructs the model name as azure/gpt-4-deployment.

tests/unit/core/llm/test_llm_manager.py (1)

56-56: Test correctly updated for new Azure environment variable.

The test now uses AZURE_DEPLOYMENT_NAME instead of AZURE_OPENAI_DEPLOYMENT_NAME, which aligns with the changes in the manager code at src/lightspeed_evaluation/core/llm/manager.py:63. All old Azure environment variable references (AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_DEPLOYMENT_NAME) have been completely removed from the codebase. The test correctly uses the mocker fixture for patching.

lsc_agent_eval/src/lsc_agent_eval/core/utils/judge.py (2)

54-54: LGTM!

Error message correctly updated to reflect the new environment variable names.


48-50: The variable renaming is correct and fully compatible with LiteLLM. LiteLLM explicitly supports AZURE_API_KEY and AZURE_API_BASE for Azure OpenAI configuration, and these simplified names are consistently used throughout the lightspeed-evaluation codebase (env_validator, llm manager, and tests). This is an intentional migration to LiteLLM-standard naming conventions.

README.md (1)

344-344: LGTM!

Helpful clarification that the model field should contain the Azure deployment name rather than the model name. This addresses a common source of confusion with Azure OpenAI configurations.

tests/unit/core/system/test_env_validator.py (2)

41-42: LGTM!

Test correctly updated to use the new Azure environment variable names. The test structure and coverage remain intact.


172-173: LGTM!

Provider dispatcher test correctly updated with the new Azure environment variable names, ensuring complete test coverage of the validation flow.

Copy link
Contributor

@VladimirKadlec VladimirKadlec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@asamal4 asamal4 merged commit 7da827d into lightspeed-core:main Jan 7, 2026
15 checks passed
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.

2 participants