KingNish commited on
Commit
5d14293
1 Parent(s): 397998c

Update chatbot.py

Browse files
Files changed (1) hide show
  1. chatbot.py +3 -2
chatbot.py CHANGED
@@ -210,6 +210,7 @@ def llava(user_prompt, chat_history):
210
  client_gemma = InferenceClient("mistralai/Mistral-7B-Instruct-v0.3")
211
  client_mixtral = InferenceClient("NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO")
212
  client_llama = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct")
 
213
 
214
  @spaces.GPU(duration=60, queue=False)
215
  def model_inference( user_prompt, chat_history):
@@ -246,7 +247,7 @@ def model_inference( user_prompt, chat_history):
246
  message_text = message["text"]
247
  func_caller.append({"role": "user", "content": f'[SYSTEM]You are a helpful assistant. You have 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> [USER] {message_text}'})
248
 
249
- response = client_gemma.chat_completion(func_caller, max_tokens=200)
250
  response = str(response)
251
  try:
252
  response = response[response.find("{"):response.index("</")]
@@ -262,7 +263,7 @@ def model_inference( user_prompt, chat_history):
262
  json_data = json.loads(str(response))
263
  if json_data["name"] == "web_search":
264
  query = json_data["arguments"]["query"]
265
-
266
  gr.Info("Searching Web")
267
  yield "Searching Web"
268
  web_results = search(query)
 
210
  client_gemma = InferenceClient("mistralai/Mistral-7B-Instruct-v0.3")
211
  client_mixtral = InferenceClient("NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO")
212
  client_llama = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct")
213
+ client_mistral_nemo = InferenceClient("mistralai/Mistral-Nemo-Instruct-2407")
214
 
215
  @spaces.GPU(duration=60, queue=False)
216
  def model_inference( user_prompt, chat_history):
 
247
  message_text = message["text"]
248
  func_caller.append({"role": "user", "content": f'[SYSTEM]You are a helpful assistant. You have 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> [USER] {message_text}'})
249
 
250
+ response = client_mistral_nemo.chat_completion(func_caller, max_tokens=200)
251
  response = str(response)
252
  try:
253
  response = response[response.find("{"):response.index("</")]
 
263
  json_data = json.loads(str(response))
264
  if json_data["name"] == "web_search":
265
  query = json_data["arguments"]["query"]
266
+ client_mistral_nemo
267
  gr.Info("Searching Web")
268
  yield "Searching Web"
269
  web_results = search(query)