LLM Interaction Framework
Project description
Simplify using LLMs in code
Rigging is a lightweight LLM framework built on Pydantic XML. The goal is to make leveraging language models in production code as simple and effective as possible. Here are the highlights:
- Structured Pydantic models can be used interchangably 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 calling abilities for models which don't natively support it.
- Store different models and configs as simple connection strings just like databases.
- 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
- 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)
Documentation
rigging.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
File details
Details for the file rigging-2.0.6.tar.gz
.
File metadata
- Download URL: rigging-2.0.6.tar.gz
- Upload date:
- Size: 59.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f00e9b99da94792c1f1f1b6d90c21cc9b1105ad6dc0f79223aa79012cd727790 |
|
MD5 | 6b165e6ffb32303973ae8bbeb0dc7f35 |
|
BLAKE2b-256 | 448c6a2afd4860a69284bfebf2579c279cbf0abdf052fe8f16b2488ec4021f1c |
Provenance
The following attestation bundles were made for rigging-2.0.6.tar.gz
:
Publisher:
publish.yml
on dreadnode/rigging
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
rigging-2.0.6.tar.gz
- Subject digest:
f00e9b99da94792c1f1f1b6d90c21cc9b1105ad6dc0f79223aa79012cd727790
- Sigstore transparency entry: 149135633
- Sigstore integration time:
- Predicate type:
File details
Details for the file rigging-2.0.6-py3-none-any.whl
.
File metadata
- Download URL: rigging-2.0.6-py3-none-any.whl
- Upload date:
- Size: 67.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f87f0451d1155f611707ed06b5b43a864da8600f8322dd4774847470534cf74c |
|
MD5 | 3396b3c25f9324d38cff2e233ff903ed |
|
BLAKE2b-256 | 2c3d972ee42e7b99c9daa59582b0585088461bfd2f0c64b1daae4bad7a84884c |
Provenance
The following attestation bundles were made for rigging-2.0.6-py3-none-any.whl
:
Publisher:
publish.yml
on dreadnode/rigging
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
rigging-2.0.6-py3-none-any.whl
- Subject digest:
f87f0451d1155f611707ed06b5b43a864da8600f8322dd4774847470534cf74c
- Sigstore transparency entry: 149135634
- Sigstore integration time:
- Predicate type: