Building blocks for rapid development of GenAI applications
Project description
What's Included?
- Core - Fundamental tools for working with prompts and LLMs.
- Document Search - Handles vector search to retrieve relevant documents.
- CLI - The
ragbits
shell command, enabling tools such as GUI prompt management. - Guardrails - Ensures response safety and relevance.
- Evaluation - Unified evaluation framework for Ragbits components.
- Flow Controls - Manages multi-stage chat flows for performing advanced actions (coming soon).
- Structured Querying - Queries structured data sources in a predictable manner (coming soon).
- Caching - Adds a caching layer to reduce costs and response times (coming soon).
Installation
To use the complete Ragbits stack, install the ragbits
package:
pip install ragbits
Alternatively, you can use individual components of the stack by installing their respective packages: ragbits-core
, ragbits-document-search
, ragbits-cli
.
Quickstart
First, create a prompt and a model for the data used in the prompt:
from pydantic import BaseModel
from ragbits.core.prompt import Prompt
class Dog(BaseModel):
breed: str
age: int
temperament: str
class DogNamePrompt(Prompt[Dog, str]):
system_prompt = """
You are a dog name generator. You come up with funny names for dogs given the dog details.
"""
user_prompt = """
The dog is a {breed} breed, {age} years old, and has a {temperament} temperament.
"""
Next, create an instance of the LLM and the prompt:
from ragbits.core.llms.litellm import LiteLLM
llm = LiteLLM("gpt-4o")
example_dog = Dog(breed="Golden Retriever", age=3, temperament="friendly")
prompt = DogNamePrompt(example_dog)
Finally, generate a response from the LLM using the prompt:
response = await llm.generate(prompt)
print(f"Generated dog name: {response}")
License
Ragbits is licensed under the MIT License.
Contributing
We welcome contributions! Please read CONTRIBUTING.md for more information.
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
Built Distribution
File details
Details for the file ragbits-0.3.0.tar.gz
.
File metadata
- Download URL: ragbits-0.3.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c9067c8355f1bb7c234c27e3a87963070af99b09c3ec40daee73a3ce849f03b |
|
MD5 | 9a1da2347559392f58c75a731b76a985 |
|
BLAKE2b-256 | 5b6c2d83a70f0ba56e20bf8d2a6bc49f113832e06ad6b71b3f9301eb9afb259f |
File details
Details for the file ragbits-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: ragbits-0.3.0-py3-none-any.whl
- Upload date:
- Size: 2.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aaefc3ef84a80e3e7f81f4b4012d70efd345697712153412943c437b353d8eb5 |
|
MD5 | 26985debbdbec4a3206a509e001e4638 |
|
BLAKE2b-256 | deac0d494d78f4f2679709d810a16c58d487712f927f8bee3895c64432b70cff |