Diagraph
Diagraph represents Large Language Model (LLM) interactions as a graph, which makes it easy to build, edit, and re-execute a chain of structured dialogues.
Key features:
- Cache & Replay: Rerun starting from specific interactions. Save time and money.
- Edits: Edit interactions - prompts, results, functions - on the fly.
- Dependencies: Specify a function's dependencies as parameters for clean, readable, refactorable code.
- Functions: Use any LLM or set of tools you want. Diagraph operates on top of plain Python functions.
- Visualizations: Get a straightforward view of your graph with a built-in Jupyter visualization tool.
- Concurrency: Diagraph takes care of deciding when to run your functions so that all dependencies are satisfied. Get concurrency for free.
Requirements
Python 3.10+
Installation
pip install diagraph
Quickstart
from diagraph import Diagraph, Depends, prompt, llm
openai.api_key = 'sk-<OPENAI_TOKEN>'
@prompt
def tell_me_a_joke():
return 'Computer! Tell me a joke about tomatoes.'
@prompt
def explanation(joke: str = Depends(tell_me_a_joke)) -> str:
return f'Explain why the joke "{joke}" is funny.'
dg = Diagraph(explanation).run()
print(dg.result) # 'The joke is a play on words and concepts. There are two main ideas that make it humorous...
dg
Usage
License
Metadata
Release files for diagraph 0.4.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| diagraph-0.4.7.tar.gz | 718.7 kB | Without provenance | Details for diagraph-0.4.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| diagraph-0.4.7-py3-none-any.whl | Python 3 | none | any | Details for diagraph-0.4.7-py3-none-any.whl |
Total release size: 1.5 MB
Release files / diagraph-0.4.7.tar.gz
| Download URL | diagraph-0.4.7.tar.gz |
|---|---|
| Size | 718.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3830970431aaae8156a4e2d69513818abae171d15f0b4c8ed0c5a87d54af9ae8
|
|
BLAKE2b-256 checksum How to use checksums |
b0905786aab81ac72a65b67aebad51f600b24ff45501a613b0110e72f202ba43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.9
|
Release files / diagraph-0.4.7-py3-none-any.whl
| Download URL | diagraph-0.4.7-py3-none-any.whl |
|---|---|
| Size | 739.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a3acb09e041a121b6c116600dcb4e938548fef839266e4e3740bc5cb7316ef4
|
|
BLAKE2b-256 checksum How to use checksums |
78f29456facc9784d14d415982fd67f57997d1a362babb5d537c99680394f90a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.9
|
Security for diagraph 0.4.7
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.