Fix critical model name issue and validator warning
Critical fix for guarded_ai.py:
- Add MODEL_NAME_{n} environment variable support
- Fixes hard-coded "model" string that breaks Azure OpenAI and other endpoints
- Falls back to "model" if MODEL_NAME_{n} not specified
- Some endpoints require actual deployment name in model parameter
Validator improvement:
- Allow feedback_prompts as alternative to feedback_tokens_for_ai
- Prevents false warning when using metadata_feedback_filter with new prompt system
Documentation:
- Added MODEL_NAME_{n} examples to CLAUDE.md
- Documented that Azure and similar endpoints need this variable
All 8 activities validated: 0 errors, 0 warnings
This commit is contained in:
parent
82aeeab094
commit
0f06772afb
3 changed files with 11 additions and 5 deletions
|
|
@ -48,14 +48,15 @@ def get_openai_client_and_model(model_name=None):
|
|||
model_num = model_name.split("_")[1]
|
||||
endpoint_key = f"MODEL_ENDPOINT_{model_num}"
|
||||
api_key_key = f"MODEL_API_KEY_{model_num}"
|
||||
model_name_key = f"MODEL_NAME_{model_num}"
|
||||
|
||||
endpoint = os.getenv(endpoint_key)
|
||||
api_key = os.getenv(api_key_key)
|
||||
|
||||
if endpoint and api_key:
|
||||
client = get_client_for_endpoint(endpoint, api_key)
|
||||
# Use a simple default model name for the endpoint
|
||||
actual_model = "model" # Most endpoints use "model" or ignore this
|
||||
# Get the actual model name from environment, or use sensible default
|
||||
actual_model = os.getenv(model_name_key) or "model"
|
||||
return client, actual_model
|
||||
except Exception as e:
|
||||
print(f"Warning: Failed to load {model_name}: {e}, falling back to default")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue