geekyrakshit commited on
Commit
04b1ee4
·
1 Parent(s): 6ab614d

fix: evaluation UI

Browse files
Files changed (1) hide show
  1. application_pages/evaluation_app.py +22 -0
application_pages/evaluation_app.py CHANGED
@@ -49,6 +49,8 @@ def initialize_session_state():
49
  st.session_state.evaluation_call_manager = None
50
  if "call_id" not in st.session_state:
51
  st.session_state.call_id = None
 
 
52
 
53
 
54
  def initialize_guardrail():
@@ -81,6 +83,26 @@ def initialize_guardrail():
81
  guardrail_name,
82
  )(model_name=classifier_model_name)
83
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  st.session_state.guardrails = guardrails
85
  st.session_state.guardrail_manager = GuardrailManager(guardrails=guardrails)
86
 
 
49
  st.session_state.evaluation_call_manager = None
50
  if "call_id" not in st.session_state:
51
  st.session_state.call_id = None
52
+ if "llama_guardrail_checkpoint" not in st.session_state:
53
+ st.session_state.llama_guardrail_checkpoint = None
54
 
55
 
56
  def initialize_guardrail():
 
83
  guardrail_name,
84
  )(model_name=classifier_model_name)
85
  )
86
+ elif guardrail_name == "PromptInjectionLlamaGuardrail":
87
+ llama_guardrail_checkpoint = st.sidebar.text_input(
88
+ "Llama Guardrail Checkpoint",
89
+ value=None,
90
+ )
91
+ st.session_state.llama_guardrail_checkpoint = llama_guardrail_checkpoint
92
+ if st.session_state.llama_guardrail_checkpoint is not None:
93
+ st.session_state.guardrails.append(
94
+ getattr(
95
+ import_module("guardrails_genie.guardrails"),
96
+ guardrail_name,
97
+ )(checkpoint=st.session_state.llama_guardrail_checkpoint)
98
+ )
99
+ else:
100
+ st.session_state.guardrails.append(
101
+ getattr(
102
+ import_module("guardrails_genie.guardrails"),
103
+ guardrail_name,
104
+ )()
105
+ )
106
  st.session_state.guardrails = guardrails
107
  st.session_state.guardrail_manager = GuardrailManager(guardrails=guardrails)
108