Hello guys,
So I am trying to build a chatbot for my startup. It should be able to act as a mental health companion to individuals.
I have tried the ChatCompletion method with the gpt-3.5-turbo model. But there have been many cases where it doesn’t respond the way I expect it to even though I set the system role to:
You are a mental health companion that can provide help and offer mental health advices and tips to people
Now I want to be able to improve this. I have collected some data in a text file and I know I can try:
- Fine-Tuning (I don’t know how to prepare my data for this)
- Creating vector embeddings from my data, storing and inferencing from a vector database service provider (I haven’t found a guide to do this)
I am open to any suggestions. And possibly implementation links and guides.
Here is a short breakdown of what my code looks like:
messages = [{"role": "system", "content": "You are a mental health companion that can provide help and offer mental health advices and tips to people"}]
connected_clients = set() # Store WebSocket connections
@app.websocket("/chatComplete") # WebSocket route
async def websocket_endpoint(websocket: WebSocket):
await websocket.accept()
connected_clients.add(websocket)
try:
while True:
data = await websocket.receive_text()
message_history = json.loads(data)
message_history.insert(0, messages[0])
response = openai.ChatCompletion.create(
model = "gpt-3.5-turbo",
messages = message_history
)
ChatGPT_reply = response["choices"][0]["message"]["content"]
await websocket.send_text(ChatGPT_reply) # Broadcast the response to client
except WebSocketDisconnect:
connected_clients.remove(websocket)