Skip to main content

ChatSorter

Memory processing system for chat applications with automatic fact extraction, summarization, and intelligent memory retrieval.

Installation

From PyPI

pip install chatsorter

From Source (Development)

git clone https://github.com/yourusername/chatsorter.git
cd chatsorter
pip install -e .

Quick Start

Python API

from chatsorter import ChatSorter

# Initialize with your API key
cs = ChatSorter(api_key="cs_demo_xxxx")

# Remember a message
cs.remember(chat_id="user123", message="Hi, I'm John from Boston working at TechCorp")

# Recall memories
memories = cs.recall(chat_id="user123", query="where does John work?")
print(memories['memories'])  # Related memories from conversation history

Command Line

# Remember a message
chatsorter --api-key cs_demo_xxxx "Hi, I'm John from Boston" --chat-id user123

# Recall memories
chatsorter --api-key cs_demo_xxxx --recall "where does John work" --chat-id user123

# Check API health
chatsorter --api-key cs_demo_xxxx --health

Command Line Interface

# Process a message
chatsorter "Hello, my name is Alice" --chat-id alice_chat

# Search memories
chatsorter --search "what is my name" --chat-id alice_chat

# Show all facts
chatsorter --facts --chat-id alice_chat

# Clear chat
chatsorter --clear --chat-id alice_chat

Features

  • Automatic Fact Extraction: Extracts names, locations, jobs, preferences, and more
  • Memory Summarization: Creates narrative summaries of conversations
  • Intelligent Search: Vector-based semantic search through conversation history
  • Importance Scoring: Rates message importance for better memory management
  • Multi-Chat Support: Handle multiple conversations simultaneously
  • Background Processing: Asynchronous extraction and summarization

API Reference

ChatSorter Class

__init__(data_dir="data", api_key=None, company_id=None, user_id="default_user")

Initialize ChatSorter instance.

process(message, chat_id, retrieve_memories=True, clear_chat=False)

Process a message and return extracted information.

Returns:

{
    "facts": {...},        # Extracted facts
    "importance": 0.0,     # Importance score
    "memories": [...],     # Related memories
    "response": "...",     # Processing status
    "analysis": {...}      # Additional metadata
}

search(query, chat_id, max_results=5)

Search for memories related to a query.

get_facts(chat_id)

Get all extracted facts for a conversation.

clear_chat(chat_id)

Clear all memories and facts for a conversation.

Configuration

Set these environment variables:

  • OPENAI_API_KEY: Your OpenAI API key (for LLM-powered features)
  • OLLAMA_BASE_URL: Ollama server URL (optional, for local LLM)

Development

Local Development

pip install -r requirements.txt
python api.py  # Start API server

Testing

python example.py  # Run example script
python quicktest.py  # Run diagnostic tests

Building Package

python -m build
pip install dist/chatsorter-0.1.0.tar.gz

License

MIT License

Metadata

Release files for chatsorter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chatsorter 0.1.0
File Size Uploaded Provenance Actions
chatsorter-0.1.0.tar.gz 119.5 kB Without provenance Details for chatsorter-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chatsorter 0.1.0
File Interpreter ABI Platform Actions
chatsorter-0.1.0-py3-none-any.whl Python 3 none any Details for chatsorter-0.1.0-py3-none-any.whl

Total release size: 262.5 kB

Release files / chatsorter-0.1.0.tar.gz

Download URL chatsorter-0.1.0.tar.gz
Size 119.5 kB
Tags Source
SHA-256 checksum
How to use checksums
533dd0ee927a33135e9703a5debd396f2a4d82e167e46a0ec64079416b8fe104
BLAKE2b-256 checksum
How to use checksums
8dae241b9b64873b1d66d8e8ae7cfa3298d137dc254f1a15b774958c25bd97f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / chatsorter-0.1.0-py3-none-any.whl

Download URL chatsorter-0.1.0-py3-none-any.whl
Size 143.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f56a9dfce1e6cbd332d4b22298f9f2568d1eab5c585525887c1db90d077442b7
BLAKE2b-256 checksum
How to use checksums
132e53925e6c7e2dae4c323b20c0076bb4daeeb98d3dc10e51222bb8c547eb37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for chatsorter 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page