KingNish commited on
Commit
ae15b65
·
verified ·
1 Parent(s): 7e473f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -159,10 +159,13 @@ def respond(
159
  client_llama = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct")
160
  generate_kwargs = dict( max_new_tokens=2000, do_sample=True, stream=True, details=True, return_full_text=False )
161
  question_history = ""
162
- for msg in history:
163
- question_history += f"{str(msg[0])}/n"
 
 
 
164
 
165
- messages.append({"role": "user", "content": f'[SYSTEM]You are a helpful assistant with access to the following functions: \n {str(functions_metadata)}\n\nTo use these functions respond with:\n<functioncall> {{ "name": "function_name", "arguments": {{ "arg_1": "value_1", "arg_1": "value_1", ... }} }} </functioncall> Choose functions wisely and Also reply wisely, reply with just functioncall only as tell you before, Make function while learning from Prev Questions But make sure to create function call only for Current Question not for prev. [PREV_QUESTIONS] {question_history} [CURRENT_QUESTION] {message_text} '})
166
 
167
  response = client.chat_completion( messages, max_tokens=150)
168
  response = str(response)
 
159
  client_llama = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct")
160
  generate_kwargs = dict( max_new_tokens=2000, do_sample=True, stream=True, details=True, return_full_text=False )
161
  question_history = ""
162
+ system_message = f'You are a helpful assistant with access to the following functions: \n {str(functions_metadata)}\n\nTo use these functions respond with:\n<functioncall> {{ "name": "function_name", "arguments": {{ "arg_1": "value_1", "arg_1": "value_1", ... }} }} </functioncall> Choose functions wisely and Also reply wisely, reply with just functioncall only as tell you before, Make function while learning from Prev Questions But make sure to create function call only for Curent Question.'
163
+ messages = [{"role": "system", "content": system_message}]
164
+ for val in history:
165
+ if val[0]:
166
+ messages.append({"role": "user", "content": f"{str(val[0])}"})
167
 
168
+ messages.append({"role": "user", "content": message_text})
169
 
170
  response = client.chat_completion( messages, max_tokens=150)
171
  response = str(response)