Open
Conversation
…ault_generation_config, added a local extract_response_content() function since it's not provided by the package, updated error messages to reference the correct package name”
…IMEOUT); added retry logic: up to 3 retries for timeout/connection errors with exponential backoff; handle these errors: TimeoutError, requests.exceptions.Timeout, ReadTimeout, ConnectionError
…ed from the LLM or response received but decision could not be extracted (None); exponential backoff between retries
Introduces a full ablation analysis pipeline to quantify how demographic variables influence LLM surgical recommendations. Supports per-variable and grouped demographic exclusions, token-aware case filtering, robust retry logic, incremental CSV flushing with resume, and stratified sampling. Includes utilities to compare ablations against baseline decisions with flip-rate, confidence-shift, and optional ground-truth accuracy analysis.
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.
Refactor LLM Integration to Use
securellm_adapter⚙️ Release Notes
securellm_adapter.pyinstead of direct OpenAI calls. Here's a summary of the changes:Files modified
1.
llm_query/securellm_adapter.pyAdded new functions and classes for compatibility:
-
llm_chat()— supports multi-turn conversations with system messages-
query_llm()— convenience function for simple queries with system message-
SecureLLMClient— drop-in replacement class for the OpenAI client pattern2.
llm_query/LLM_analysis.py- Removed openai import, added securellm_adapter imports
-
query_openai()now wraps query_llm() from the adapter- api_key parameter is now optional (kept for backward compatibility)
3.
llm_query/ent_surgical_llm_analysis.py- Same changes as LLM_analysis.py
- Updated all functions to use SecureLLM
4.
batch_query/batch_query.py- Removed openai import, added securellm_adapter imports
- parallel_process_llm_cases() now uses query_llm() directly
- api_key parameters made optional
5.
training/training_LLM.py- Updated imports to use securellm_adapter
- ConversationalLLMAnalyzer class now uses llm_chat() instead of OpenAI client
- All api_key parameters made optional
6.
pyproject.toml- Removed openai dependency (no longer directly used)
- Added python-dotenv dependency (used by securellm_adapter)
Usage
Instead of passing an api_key, set the
VAULT_SECRET_KEYenvironment variable:export VAULT_SECRET_KEY="your-vault-key"All existing function calls remain backward compatible — the api_key parameter is still accepted but ignored.
I've created a CLI entrypoint for the ENT-LLM project.
cli.py- CLI entrypoint with the following features:All the available models can be found in the securellm repo.
Usage
python cli.py --list-modelspython cli.py --model apim:claude-3.7python cli.py --model apim:llama-3.3-70b --input cases.csv --output results.csvpython cli.py --model apim:gemini-2.5-pro-preview-05-06 --interactiveAfter installing the package (pip install -e .)
ent-llm --model apim:gpt-4.1 --input cases.csvOptions
📝 Code of Conduct & Contributing Guidelines
By submitting this pull request, you agree to follow our Coding Guidelines: