Nuno CamposandGitHub 3b56d062c7 Merge pull request #11 from langchain-ai/nc/channel-docs
Add doc strings for all channels, small update to names/semantics
2023-10-23 14:18:44 +01:00
2023-10-23 14:17:16 +01:00
2023-08-09 19:50:50 +01:00
2023-08-09 19:50:50 +01:00
2023-10-23 10:39:37 +01:00
2023-10-22 17:16:22 +01:00
2023-08-09 19:50:50 +01:00
2023-10-23 10:39:37 +01:00

permchain

Get started

pip install permchain

Usage

from permchain import Pregel, channels

grow_value = (
    Pregel.subscribe_to("value")
    | (lambda x: x + x)
    | Pregel.write_to(value=lambda x: x if len(x) < 10 else None)
)

app = Pregel(
    chains={"grow_value": grow_value},
    channels={"value": channels.LastValue(str)},
    input="value",
    output="value",
)

assert app.invoke("a") == "aaaaaaaa"

Check examples for more examples.

Near-term Roadmap

  • Iterate on API
    • do we want api to receive output from multiple channels in invoke()
    • do we want api to send input to multiple channels in invoke()
    • Finish updating tests to new API
  • Implement input_schema and output_schema in Pregel
  • More tests
    • Test different input and output types (str, str sequence)
    • Add tests for Stream, UniqueInbox
    • Add tests for subscribe_to_each().join()
  • Add optional debug logging
  • Implement checkpointing
    • Save checkpoints at end of each step
    • Load checkpoint at start of invocation
    • API to specify storage backend and save key
  • Add more examples
    • human in the loop
    • combine documents
    • agent executor
    • run over dataset
  • Fault tolerance
    • Retry individual processes in a step
    • Retry entire step?
  • Pregel.stream_log to contain additional keys specific to Pregel
    • tasks: inputs of each chain in each step, keyed by {name}:{step}
    • task_results: same as above but outputs
    • channels: channel values at end of each step, keyed by {name}:{step}
Languages
Python 99.6%
Makefile 0.2%
TypeScript 0.1%