Longchain, Langchaaaaain, etc.
Project description
permchain
Get started
pip install permchain
Usage
from permchain import InMemoryPubSubConnection, PubSub, Topic
topic_one = Topic("one")
chain_one = Topic.IN.subscribe() | (lambda x: x + 'b') | topic_one.publish()
chain_two = topic_one.subscribe() | (lambda x: x + 'c') | Topic.OUT.publish()
conn = InMemoryPubSubConnection()
pubsub = PubSub(processes=(chain_one, chain_two), connection=conn)
assert pubsub.invoke('a') == ['abc']
Check tests
and examples
for more examples.
Roadmap
- Add initial retry support (pending changes in
langchain
) - Detect cycles (aka. infinite loops) and throw an error
- Allow user to catch that error (by subcribing to an error topic?)
- Replace Queue data structure with a Log data structure (this will enable checking the status of the readers, etc.)
- eg. https://anyio.readthedocs.io/en/3.x/streams.html
- Implement IN and OUT topics as regular topics
- Enable resuming PubSub from the "middle" of the computation
- Add Redis-backed Connection implementation
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
permchain-0.0.1.tar.gz
(6.2 kB
view hashes)
Built Distribution
Close
Hashes for permchain-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f440c8dc1117264f1f8164f0417c0b0aad2201d57192bbd18d69247d189763d7 |
|
MD5 | 18b2296f825a40dbebd0cb52c4e2c1cf |
|
BLAKE2b-256 | 628ad02bf49d4e178e020038e228c328d6603471a7df03a16388313d33615e1b |