Skip to main content

StreamWish: A Retrieval-Augmented Generation (RAG) library optimized for small context windows using graph traversal.

Project description

StreamWish 🌠

StreamWish is a "Streaming Graph RAG" library designed for Small Language Models (SLMs) and high-velocity data streams. It solves the "Small Context Window" problem using a Conveyor-Belt Graph and a Token Auctioneer.

Features

  • Conveyor-Belt Graph: Manages a sliding window of knowledge nodes.
Stream: [Chunk 1] -> [Chunk 2] -> [Chunk 3]
                   |
Graph:       (Node A) --[rel]--> (Node B)
                   |
Auctioneer: [ Slot 1: Query  ]
            [ Slot 2: Node A ] <-- Highest Bidder
            [ Slot 3: Path X ]
  • Token Auctioneer: Smartly allocates limited context slots to the most valuable information (Query, Summary, Neighborhood, Path).
  • Context Distillation: Automatically shrinks incoming data chunks using LLM summarization.
  • Pluggable Backends: Works with OpenAI, Gemini, or local models via LLMBackend.
  • Generic Ingestion: Supports .txt, .pdf, .xlsx, and Google Drive/GCP.

Why StreamWish? (VS The Big Players)

1. The "10-Slot" Philosophy Most RAG libraries (LangChain, LlamaIndex, Graphiti) optimize for finding the right answer assuming you have a 128k+ context window to fit it all in. StreamWish is built for the Edge / SLM era. It assumes you can only "see" 10 items at a time. It uses a Token Auctioneer to ruthlessly prioritize what gets into that tiny window.

2. Streaming vs. Batch "Graph RAG" (like Microsoft's implementation) usually requires processing all your documents at once to build community clusters. This is slow and expensive. StreamWish is stateful and streaming. It builds the graph node-by-node as data flows in (like a conveyor belt), making it perfect for real-time feeds, chat logs, or live sensor data.

Installation

pip install streamwish

Quick Start

from streamwish.manager import SlotManager
from streamwish.llm_interface import OpenAIAdapter

# 1. Initialize
llm = OpenAIAdapter(api_key="your-key")
manager = SlotManager(llm_client=llm)

# 2. Ingest Data
manager.ingest_stream([
    "StreamWish optimizes context for small models.",
    "It uses a graph traversal algorithm."
])

# 3. Query
response = manager.process_query("How does StreamWish handle small context?")
print(response)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamwish-0.1.1.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamwish-0.1.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file streamwish-0.1.1.tar.gz.

File metadata

  • Download URL: streamwish-0.1.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for streamwish-0.1.1.tar.gz
Algorithm Hash digest
SHA256 aa293f913e0a4ca6bb70271cd3d5e73c1110643723f7c3f80a08e59c65fe126f
MD5 79ddd8bcd0e43d04a6e21d146950aec9
BLAKE2b-256 90a24a2a8c8495b1049d4db97c832c43e176b76c596eb76094a07e7cc690f6c3

See more details on using hashes here.

File details

Details for the file streamwish-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: streamwish-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for streamwish-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60a9e37aee7ffb905bd01e3d1c8938601cea9e748908511e71436ebdc3085ba6
MD5 9ed97b7ac66c33159fec5b26e0198244
BLAKE2b-256 296b13b6da481827be100a5ccd1edc05ffe71ffbd3cd6dba1091e6c251312729

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page