drmasad commited on
Commit
82753c5
·
verified ·
1 Parent(s): 8555d76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -102,15 +102,21 @@ if prompt := st.chat_input(f"Hi I'm {selected_model}, ask me a question"):
102
  # Add user message to chat history
103
  st.session_state.messages.append({"role": "user", "content": prompt})
104
 
 
 
 
 
 
 
105
  # Display assistant response in chat message container
106
  with st.chat_message("assistant"):
107
  stream = client.chat.completions.create(
108
  model=model_links[selected_model],
109
  messages=[
110
- {"role": m["role"], "content": m["content"]}
111
  for m in st.session_state.messages
112
  ],
113
- temperature=temp_values, # 0.5,
114
  stream=True,
115
  max_tokens=1024,
116
  )
@@ -118,3 +124,4 @@ if prompt := st.chat_input(f"Hi I'm {selected_model}, ask me a question"):
118
  response = st.write_stream(stream)
119
  st.session_state.messages.append(
120
  {"role": "assistant", "content": response})
 
 
102
  # Add user message to chat history
103
  st.session_state.messages.append({"role": "user", "content": prompt})
104
 
105
+ # Define instructions for the model
106
+ instructions = "Respond as an expert doctor in diabetes. Ensure the response is informative and directly answers the user's question."
107
+
108
+ # Create the full prompt with instructions
109
+ full_prompt = f"<s>[INST] {instructions} [Q] {prompt} [/Q] [/INST]</s>"
110
+
111
  # Display assistant response in chat message container
112
  with st.chat_message("assistant"):
113
  stream = client.chat.completions.create(
114
  model=model_links[selected_model],
115
  messages=[
116
+ {"role": "m["role"], "content": m["content"]}
117
  for m in st.session_state.messages
118
  ],
119
+ temperature=temp_values,
120
  stream=True,
121
  max_tokens=1024,
122
  )
 
124
  response = st.write_stream(stream)
125
  st.session_state.messages.append(
126
  {"role": "assistant", "content": response})
127
+