geekyrakshit commited on
Commit
abfa06d
·
1 Parent(s): c0fd1af

update: chat app

Browse files
Files changed (1) hide show
  1. application_pages/chat_app.py +9 -1
application_pages/chat_app.py CHANGED
@@ -12,7 +12,8 @@ from guardrails_genie.llm import OpenAIModel
12
  def initialize_session_state():
13
  load_dotenv()
14
  weave.init(project_name=os.getenv("WEAVE_PROJECT"))
15
-
 
16
  if "guardrails" not in st.session_state:
17
  st.session_state.guardrails = []
18
  if "guardrail_names" not in st.session_state:
@@ -123,6 +124,13 @@ def initialize_guardrails():
123
  initialize_session_state()
124
  st.title(":material/robot: Guardrails Genie Playground")
125
 
 
 
 
 
 
 
 
126
  openai_model = st.sidebar.selectbox(
127
  "OpenAI LLM for Chat", ["", "gpt-4o-mini", "gpt-4o"]
128
  )
 
12
  def initialize_session_state():
13
  load_dotenv()
14
  weave.init(project_name=os.getenv("WEAVE_PROJECT"))
15
+ if "weave_project_name" not in st.session_state:
16
+ st.session_state.weave_project_name = "guardrails-genie"
17
  if "guardrails" not in st.session_state:
18
  st.session_state.guardrails = []
19
  if "guardrail_names" not in st.session_state:
 
124
  initialize_session_state()
125
  st.title(":material/robot: Guardrails Genie Playground")
126
 
127
+ weave_project_name = st.sidebar.text_input(
128
+ "Weave project name", value=st.session_state.weave_project_name
129
+ )
130
+ st.session_state.weave_project_name = weave_project_name
131
+ if st.session_state.weave_project_name != "":
132
+ weave.init(project_name=st.session_state.weave_project_name)
133
+
134
  openai_model = st.sidebar.selectbox(
135
  "OpenAI LLM for Chat", ["", "gpt-4o-mini", "gpt-4o"]
136
  )