rohankaran commited on
Commit
f53b61a
1 Parent(s): b0b900b

Refactor AI messaging and deactivate certain models

Browse files

The LLM method to get AI messages is refactored to simplify the process by going straight to the message content. Additionally, several AI models have been deactivated. The models with Llama Guard have been commented out of the model list to put them on hold. This is a temporary measure and these models might be reinstantiated in the future.

Files changed (1) hide show
  1. guardrails_models.py +19 -19
guardrails_models.py CHANGED
@@ -125,9 +125,9 @@ def gemini_pro(
125
  if ai:
126
  history_langchain_format.append(AIMessage(ai))
127
  try:
128
- ai_message = llm.stream(history_langchain_format)
129
- for message in ai_message:
130
- yield message.content
131
  except BlockedPromptException:
132
  yield "⚠️ I'm sorry, I cannot respond to that. (The input was blocked by the LLM)"
133
  except StopCandidateException:
@@ -420,22 +420,22 @@ def get_all_models():
420
  "name": "Gemini-Pro",
421
  "model": gemini_pro,
422
  },
423
- {
424
- "name": "gpt3.5-turbo-1106 + Llama Guard",
425
- "model": gpt35_turbo_llamaguard,
426
- },
427
- {
428
- "name": "Llama-2-70b-chat-hf + Llama Guard",
429
- "model": llama70B_llamaguard,
430
- },
431
- {
432
- "name": "Mixtral-8x7B-Instruct-v0.1 + Llama Guard",
433
- "model": mixtral7x8_llamaguard,
434
- },
435
- {
436
- "name": "Gemini-Pro + Llama Guard",
437
- "model": gemini_pro_llamaguard,
438
- },
439
  {
440
  "name": "gpt3.5-turbo-1106 + NeMo Guardrails",
441
  "model": gpt35_turbo_nemoguardrails,
 
125
  if ai:
126
  history_langchain_format.append(AIMessage(ai))
127
  try:
128
+ ai_message = llm(history_langchain_format)
129
+ for message in ai_message.content:
130
+ yield message
131
  except BlockedPromptException:
132
  yield "⚠️ I'm sorry, I cannot respond to that. (The input was blocked by the LLM)"
133
  except StopCandidateException:
 
420
  "name": "Gemini-Pro",
421
  "model": gemini_pro,
422
  },
423
+ # {
424
+ # "name": "gpt3.5-turbo-1106 + Llama Guard",
425
+ # "model": gpt35_turbo_llamaguard,
426
+ # },
427
+ # {
428
+ # "name": "Llama-2-70b-chat-hf + Llama Guard",
429
+ # "model": llama70B_llamaguard,
430
+ # },
431
+ # {
432
+ # "name": "Mixtral-8x7B-Instruct-v0.1 + Llama Guard",
433
+ # "model": mixtral7x8_llamaguard,
434
+ # },
435
+ # {
436
+ # "name": "Gemini-Pro + Llama Guard",
437
+ # "model": gemini_pro_llamaguard,
438
+ # },
439
  {
440
  "name": "gpt3.5-turbo-1106 + NeMo Guardrails",
441
  "model": gpt35_turbo_nemoguardrails,