LLM Interaction Framework
Project description
Flexible LLM library for code and agents
Rigging is a lightweight LLM framework to make using language models in production code as simple and effective as possible. Here are the highlights:
- Structured Pydantic models can be used interchangeably with unstructured text output.
- LiteLLM as the default generator giving you instant access to a huge array of models.
- Define prompts as python functions with type hints and docstrings.
- Simple tool use, even for models which don't support them at the API.
- Store different models and configs as simple connection strings just like databases.
- Integrated tracing support with Logfire.
- Chat templating, forking, continuations, generation parameter overloads, stripping segments, etc.
- Async batching and fast iterations for large scale generation.
- Metadata, callbacks, and data format conversions.
- Modern python with type hints, async support, pydantic validation, serialization, etc.
import rigging as rg
@rg.prompt(generator_id="gpt-4")
async def get_authors(count: int = 3) -> list[str]:
"""Provide famous authors."""
print(await get_authors())
# ['William Shakespeare', 'J.K. Rowling', 'Jane Austen']
Rigging is built by dreadnode where we use it daily.
Installation
We publish every version to Pypi:
pip install rigging
If you want to build from source:
cd rigging/
poetry install
Supported LLMs
Rigging will run just about any language model:
- Any model from LiteLLM
- Any model from vLLM
- Any model from transformers
API Keys
Pass the api_key in an generator id or use standard environment variables.
rg.get_generator("gpt-4-turbo,api_key=...")
export OPENAI_API_KEY=...
export MISTRAL_API_KEY=...
export ANTHROPIC_API_KEY=...
...
Check out the docs for more.
Getting Started
Check out the guide in the docs
- Get a generator using a connection string.
- Build a chat or completion pipeline
- Run the pipeline and get the output.
import rigging as rg
import asyncio
async def main():
# 1 - Get a generator
generator = rg.get_generator("claude-3-sonnet-20240229")
# 2 - Build a chat pipeline
pipeline = generator.chat(
[
{"role": "system", "content": "Talk like a pirate."},
{"role": "user", "content": "Say hello!"},
]
)
# 3 - Run the pipeline
chat = await pipeline.run()
print(chat.conversation)
# Run the main function
asyncio.run(main())
# [system]: Talk like a pirate.
# [user]: Say hello!
# [assistant]: Ahoy, matey! Here be the salty sea dog ready to trade greetings wit' ye. Arrr!
Want more?
- Use structured pydantic parsing
- Check out raw completions
- Give the LLM access to tools
- Track behavior with tracing
- Play with generation params
- Use callbacks in the pipeline
- Scale up with iterating and batching
- Save your work with serialization
Examples
- Basic interactive chat: chat.py
- Jupyter code interpreter: jupyter.py
- OverTheWire Bandit Agent: bandit.py
- Damn Vulnerable Restaurant Agent: dvra.py
- RAG Pipeline: rag.py (from kyleavery)
- Integrating dreadnode-owned robopages as a tool server (basic nmap scan example): rigging_example.py
Documentation
docs.dreadnode.io has everything you need.
Star History
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rigging-3.3.5.tar.gz.
File metadata
- Download URL: rigging-3.3.5.tar.gz
- Upload date:
- Size: 112.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f24ef62155f1049f0d485cf24649b4ded70a2771e49410da71b6c3d0fd626b4
|
|
| MD5 |
c80bb440ac2dc334445dd5dc25cd612a
|
|
| BLAKE2b-256 |
5cb24deaacda6b4237d9c5f8324b3458929e98b51158ed3eb3e6574a3ee31fa6
|
Provenance
The following attestation bundles were made for rigging-3.3.5.tar.gz:
Publisher:
publish.yml on dreadnode/rigging
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rigging-3.3.5.tar.gz -
Subject digest:
3f24ef62155f1049f0d485cf24649b4ded70a2771e49410da71b6c3d0fd626b4 - Sigstore transparency entry: 700729722
- Sigstore integration time:
-
Permalink:
dreadnode/rigging@9a93406a3799fccb62a741a11a56d76eadc1153f -
Branch / Tag:
refs/tags/v3.3.5 - Owner: https://github.com/dreadnode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9a93406a3799fccb62a741a11a56d76eadc1153f -
Trigger Event:
push
-
Statement type:
File details
Details for the file rigging-3.3.5-py3-none-any.whl.
File metadata
- Download URL: rigging-3.3.5-py3-none-any.whl
- Upload date:
- Size: 130.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3cba9dca540488b71ded5e491ecdea1037b76e6e0501145079885aafc7a2bbf
|
|
| MD5 |
ad9c5793097020dce8e8946dca6ca49f
|
|
| BLAKE2b-256 |
978235c80126ba849b0c06529e2184e6e7c7a6bf6b0887ff95f041a7d7758554
|
Provenance
The following attestation bundles were made for rigging-3.3.5-py3-none-any.whl:
Publisher:
publish.yml on dreadnode/rigging
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rigging-3.3.5-py3-none-any.whl -
Subject digest:
e3cba9dca540488b71ded5e491ecdea1037b76e6e0501145079885aafc7a2bbf - Sigstore transparency entry: 700729728
- Sigstore integration time:
-
Permalink:
dreadnode/rigging@9a93406a3799fccb62a741a11a56d76eadc1153f -
Branch / Tag:
refs/tags/v3.3.5 - Owner: https://github.com/dreadnode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9a93406a3799fccb62a741a11a56d76eadc1153f -
Trigger Event:
push
-
Statement type: