Abhaykoul commited on
Commit
e3fa3f1
1 Parent(s): 0d81362

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -1,12 +1,9 @@
1
  from flask import Flask, jsonify, request
2
  from webscout import AsyncWEBS, WEBS
3
  from webscout.LLM import LLM
4
- import AI
5
 
6
  app = Flask(__name__)
7
 
8
- # Initialize the OPENGPT instance
9
- opengpt = AI.OPENGPT(max_tokens=8000, timeout=30)
10
 
11
  @app.route('/search', methods=['POST'])
12
  def WEBScout2_search_search():
@@ -110,13 +107,13 @@ def WEBScout_translate():
110
  return jsonify(translation)
111
 
112
  @app.route('/chat', methods=['POST'])
113
- def chat_opengpt():
114
  user_input = request.json.get('message')
115
  if user_input is None:
116
  return jsonify({'error': 'Message parameter missing'})
117
- # Use the opengpt instance to process the chat message
118
- response_str = opengpt.chat(user_input)
119
- return jsonify({"response": response_str})
120
 
121
  if __name__ == '__main__':
122
  app.run(debug=True)
 
1
  from flask import Flask, jsonify, request
2
  from webscout import AsyncWEBS, WEBS
3
  from webscout.LLM import LLM
 
4
 
5
  app = Flask(__name__)
6
 
 
 
7
 
8
  @app.route('/search', methods=['POST'])
9
  def WEBScout2_search_search():
 
107
  return jsonify(translation)
108
 
109
  @app.route('/chat', methods=['POST'])
110
+ def chat_gpt():
111
  user_input = request.json.get('message')
112
  if user_input is None:
113
  return jsonify({'error': 'Message parameter missing'})
114
+ llm = LLM("mistralai/Mixtral-8x7B-Instruct-v0.1") # Initialize the LLM class with a model
115
+ response = llm.mistral_chat([{"role": "user", "content": user_input}]) # Call the mistral_chat method
116
+ return jsonify({"response": response})
117
 
118
  if __name__ == '__main__':
119
  app.run(debug=True)