Skip to content

condenses/subnet-organic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



condenses-organic

Organic serving for text compression. Powered by Bittensor.

Installation

pip install git+https://github.com/condenses/subnet-organic.git

Serving (for validators)

Prerequisites

Environment Setup

export TAOSTATS_API_KEY=your_api_key_here
export NODE_MANAGING__BASE_URL=http://localhost:9101
export WALLET_NAME=default
export WALLET_HOTKEY=default
export WALLET_PATH=~/.bittensor/wallets
export API_KEY=your_api_key_here

Starting the Server

Standard start:

python -m uvicorn condenses_organic.server:app --host 0.0.0.0 --port 8080

Using PM2 for persistence:

pm2 start "python -m uvicorn condenses_organic.server:app --host 0.0.0.0 --port 8080" --name "condenses-organic"

API Usage

Text Compression

Compress a single text string:

curl -X POST "http://localhost:8080/api/compress/text" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer your_api_key_here" \
     -d '{
           "text": "This is a longer piece of text that I would like to compress using the API.",
           "top_node_performance": 0.1
         }'

Parameters:

  • text: The text to compress
  • top_node_performance: Fraction of top-performing nodes to consider (0.1 = top 10%)

Response:

{
  "compressed_text": "Text to compress using API."
}

Conversation Compression

Compress messages in a conversation:

curl -X POST "http://localhost:8080/api/compress/messages" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer your_api_key_here" \
     -d '{
           "messages": [
             {"role": "system", "content": "You are a helpful assistant."},
             {"role": "user", "content": "Can you explain how text compression works?"},
             {"role": "assistant", "content": "Text compression works by identifying and eliminating redundancies in data. Common techniques include removing repetitive patterns, using shorter codes for frequent characters, and employing algorithms like Huffman coding or LZ77. These methods reduce file size while preserving essential information for later decompression."}
           ],
           "compress_user": true,
           "compress_assistant": true,
           "top_node_performance": 0.1
         }'

Parameters:

  • messages: Array of message objects, each with role and content fields
  • compress_user: Whether to compress messages with "user" role (default: true)
  • compress_assistant: Whether to compress messages with "assistant" role (default: true)
  • top_node_performance: Fraction of top-performing nodes to consider (0.1 = top 10%)

Response:

{
  "compressed_messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Explain text compression?"},
    {"role": "assistant", "content": "Text compression removes redundancies using methods like Huffman coding and LZ77 to reduce size while preserving key information."}
  ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages