Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- ai_responses_demo.py +1 -2
ai_responses_demo.py
CHANGED
@@ -501,12 +501,11 @@ def rate_user_interaction(user_input, user_response):
|
|
501 |
# Initialize APIs with hardcoded keys
|
502 |
contextual_api = ContextualAPIUtils(api_key=ORACLE_API_KEY)
|
503 |
together_client = Together(api_key=TOGETHER_API_KEY)
|
504 |
-
openai_client = openai.OpenAI(api_key=OPENAI_API_KEY)
|
505 |
|
506 |
# Get ratings
|
507 |
llama_rating, llama_safety = get_llama_guard_rating(together_client, user_input, user_response)
|
508 |
contextual_rating, contextual_retrieval, contextual_safety = get_contextual_rating(contextual_api, user_input, user_response)
|
509 |
-
openai_rating, openai_safety = get_openai_moderation(
|
510 |
|
511 |
# Format responses carefully to avoid random line breaks
|
512 |
llama_rating = re.sub(r'\.(?=\s+[A-Z])', '.\n', llama_rating)
|
|
|
501 |
# Initialize APIs with hardcoded keys
|
502 |
contextual_api = ContextualAPIUtils(api_key=ORACLE_API_KEY)
|
503 |
together_client = Together(api_key=TOGETHER_API_KEY)
|
|
|
504 |
|
505 |
# Get ratings
|
506 |
llama_rating, llama_safety = get_llama_guard_rating(together_client, user_input, user_response)
|
507 |
contextual_rating, contextual_retrieval, contextual_safety = get_contextual_rating(contextual_api, user_input, user_response)
|
508 |
+
openai_rating, openai_safety = get_openai_moderation(OPENAI_CLIENT, user_input, user_response)
|
509 |
|
510 |
# Format responses carefully to avoid random line breaks
|
511 |
llama_rating = re.sub(r'\.(?=\s+[A-Z])', '.\n', llama_rating)
|