Configuration to not use local LLM calls #455
Closed
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.
Pull Request Description
What and why?
This PR adds a configuration option to disable local LLM calls and route all LLM requests through the ValidMind server. This is useful for environments where OpenAI access is blocked locally or when organizations want to ensure all LLM calls go through ValidMind's infrastructure.
Before: The SDK would attempt to use local OpenAI API keys (
OPENAI_API_KEYorAZURE_OPENAI_KEY) for LLM operations like generating test result descriptions and running prompt validation tests. If these keys weren't available, operations would fail.After: Users can now enable server-only mode via:
use_server_llm_onlyparameter invm.init(use_server_llm_only=True)VALIDMIND_USE_SERVER_LLM_ONLYenvironment variable (set to"1"or"True")When enabled:
is_configured()checks ValidMind API credentials instead of local OpenAI configurationHow to test
The test suite covers:
is_configured()functionWhat needs special review?
Error messages: Please review the error messages for clarity and user-friendliness, especially:
get_client_and_model()that explains server-side routingcall_model()for prompt validation testsEnvironment variable handling: The implementation treats
"1","True","true","TRUE"as enabled and"0","False","false","FALSE"as disabled. Verify this matches expected behavior.Backward compatibility: Ensure that existing code without this configuration continues to work as before (local LLM calls should work normally when the flag is not set).
Integration points: Review how
is_configured()now behaves differently in server-only mode - it checks ValidMind API credentials instead of attempting a local OpenAI ping.Dependencies, breaking changes, and deployment notes
Dependencies: None
Breaking changes: None - this is a new optional feature that doesn't change existing behavior when not enabled.
Deployment notes:
VALIDMIND_USE_SERVER_LLM_ONLYshould be documented in deployment/environment configuration guidesRelease notes
New Feature: Server-Only LLM Mode
Added support for disabling local LLM calls and routing all LLM requests through the ValidMind server. This is useful for environments where OpenAI access is blocked locally or when organizations want centralized LLM usage.
Enable server-only mode by:
use_server_llm_only=Trueinvm.init()VALIDMIND_USE_SERVER_LLM_ONLYenvironment variable to"1"or"True"When enabled, test result descriptions continue to work via server-side calls. Prompt validation tests that require judge LLM will provide guidance on contacting support for server-side judge LLM support.
Checklist