From 36336234c5a5a93726f8cfdc7527082d11a6ad2b Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Mon, 4 Mar 2024 11:11:41 -0500 Subject: [PATCH] claude-sonnet modified: README.rst modified: app.py --- README.rst | 4 +--- app.py | 28 +++++++++++++++++----------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/README.rst b/README.rst index 900b0f1..95e5cdb 100644 --- a/README.rst +++ b/README.rst @@ -10,8 +10,6 @@ To view a short video of the chat in action click this screenshot: :target: https://www.youtube.com/watch?v=pd3shNtSojY :align: center - - Features -------- @@ -96,7 +94,7 @@ To interact with the various language models, you can use the following commands - For GPT-3, send a message with ``gpt-3`` and include your prompt. - For GPT-4, send a message with ``gpt-4`` and include your prompt. -- For Claude-v1, send a message with ``claude-v1`` and include your prompt. +- For Claude-sonnet, send a message with ``claude-sonnet`` and include your prompt. - For Claude-v2, send a message with ``claude-v2`` and include your prompt. - For Mistral-tiny, send a message with ``mistral-tiny`` and include your prompt. - For Mistral-small, send a message with ``mistral-small`` and include your prompt. diff --git a/app.py b/app.py index 54b088b..be82491 100644 --- a/app.py +++ b/app.py @@ -27,8 +27,8 @@ socketio = SocketIO(app, async_mode="eventlet") cancellation_requests = {} system_users = [ - "anthropic.claude-v1", "anthropic.claude-v2", + "anthropic.claude-sonnet", "gpt-3.5-turbo", "gpt-4", "gpt-4-1106-preview", @@ -247,25 +247,27 @@ def handle_message(data): ) if ( - "claude-v1" in data["message"] - or "claude-v2" in data["message"] - or "gpt-3" in data["message"] - or "gpt-4" in data["message"] + "claude-" in data["message"] + or "gpt-" in data["message"] or "mistral-" in data["message"] or "together/" in data["message"] or "localhost/" in data["message"] or "vllm/" in data["message"] or "groq/" in data["message"] ): - # Emit a temporary message indicating that llm is processing + # Emit a temporary message indicating that the llm is processing emit( "message", {"id": None, "content": "Processing..."}, room=room.name, ) - if "claude-v1" in data["message"]: - eventlet.spawn(chat_claude, data["username"], room.name) + if "claude-sonnet" in data["message"]: + eventlet.spawn( + chat_claude, + data["username"], + room.name + ) if "claude-v2" in data["message"]: eventlet.spawn( chat_claude, @@ -274,7 +276,11 @@ def handle_message(data): model_name="anthropic.claude-v2", ) if "gpt-3" in data["message"]: - eventlet.spawn(chat_gpt, data["username"], room.name) + eventlet.spawn( + chat_gpt, + data["username"], + room.name + ) if "gpt-4" in data["message"]: eventlet.spawn( chat_gpt, @@ -431,10 +437,10 @@ def handle_update_message(data): ) -def chat_claude(username, room_name, model_name="anthropic.claude-v1"): +def chat_claude(username, room_name, model_name="anthropic.claude-sonnet"): with app.app_context(): room = get_room(room_name) - # claude has a 100,000 token context window for prompts. + # claude has a 200,000 token context window for prompts. all_messages = ( Message.query.filter_by(room_id=room.id).order_by(Message.id.desc()).all() )