LostOxygen / llm_chat

Visualize Chat Interactions between several LLMs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LLM Chat Visualization

Visualize Chat Interactions between several LLMs.

Installation:

python -m pip install -r requirements.txt

Usage:

Start the chat server with:

python run.py

To add chat messages in the chat history just import

from llm_chat.api import ChatAPI

and use the add_message static method to add a message to the chat history:

ChatAPI.add_message("<user_name>", "<message>")

The users are added automatically to the left side of the chat history when they send a message using their usernames as keys.

When messages are sent using the GUI interface, the messages are appended to the /tmp/llm_chat/chat_input_log.txt. It is either possible to directly read the files content to process the messages or to use the build-in ChatAPI methods to retreive the messages:

first_message: str = ChatAPI.get_first_message()

get_first_message() returns the first (oldest) message as a plain string from the chat and removes it from the file.

all_messages: List[str] = ChatAPI.get_all_messages()

get_all_messages() returns all messages as a list of plain strings from the chat and removes them from the file.

Example Output:

LLM Chat Screenshot

About

Visualize Chat Interactions between several LLMs.


Languages

Language:Python 87.3%Language:CSS 12.7%