<div align="center">
<h1>Ragbits</h1>
*Building blocks for rapid development of GenAI applications*
[Documentation](https://ragbits.deepsense.ai) | [Contact](https://deepsense.ai/contact/)
[![PyPI - License](https://img.shields.io/pypi/l/ragbits)](https://pypi.org/project/ragbits)
[![PyPI - Version](https://img.shields.io/pypi/v/ragbits)](https://pypi.org/project/ragbits)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ragbits)](https://pypi.org/project/ragbits)
</div>
---
## What's Included?
- [X] **[Core](packages/ragbits-core)** - Fundamental tools for working with prompts and LLMs.
- [X] **[Document Search](packages/ragbits-document-search)** - Handles vector search to retrieve relevant documents.
- [X] **[CLI](packages/ragbits-cli)** - The `ragbits` shell command, enabling tools such as GUI prompt management.
- [x] **[Guardrails](packages/ragbits-guardrails)** - Ensures response safety and relevance.
- [x] **[Evaluation](packages/ragbits-evaluate)** - 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:
```sh
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:
```python
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:
```python
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:
```python
response = await llm.generate(prompt)
print(f"Generated dog name: {response}")
```
<!--
TODO:
Add links to quickstart guides for individual packages, demonstrating how to extend this with their functionality.
Add a link to the full tutorial.
-->
## License
Ragbits is licensed under the [MIT License](LICENSE).
## Contributing
We welcome contributions! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
Raw data
{
"_id": null,
"home_page": null,
"name": "ragbits",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "GenAI, Generative AI, LLMs, Large Language Models, Prompt Management, RAG, Retrieval Augmented Generation",
"author": null,
"author_email": "\"deepsense.ai\" <ragbits@deepsense.ai>",
"download_url": "https://files.pythonhosted.org/packages/5b/6c/2d83a70f0ba56e20bf8d2a6bc49f113832e06ad6b71b3f9301eb9afb259f/ragbits-0.3.0.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n\n<h1>Ragbits</h1>\n\n*Building blocks for rapid development of GenAI applications*\n\n[Documentation](https://ragbits.deepsense.ai) | [Contact](https://deepsense.ai/contact/)\n\n[![PyPI - License](https://img.shields.io/pypi/l/ragbits)](https://pypi.org/project/ragbits)\n[![PyPI - Version](https://img.shields.io/pypi/v/ragbits)](https://pypi.org/project/ragbits)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ragbits)](https://pypi.org/project/ragbits)\n\n</div>\n\n---\n\n## What's Included?\n\n- [X] **[Core](packages/ragbits-core)** - Fundamental tools for working with prompts and LLMs.\n- [X] **[Document Search](packages/ragbits-document-search)** - Handles vector search to retrieve relevant documents.\n- [X] **[CLI](packages/ragbits-cli)** - The `ragbits` shell command, enabling tools such as GUI prompt management.\n- [x] **[Guardrails](packages/ragbits-guardrails)** - Ensures response safety and relevance.\n- [x] **[Evaluation](packages/ragbits-evaluate)** - Unified evaluation framework for Ragbits components.\n- [ ] **Flow Controls** - Manages multi-stage chat flows for performing advanced actions *(coming soon)*.\n- [ ] **Structured Querying** - Queries structured data sources in a predictable manner *(coming soon)*.\n- [ ] **Caching** - Adds a caching layer to reduce costs and response times *(coming soon)*.\n\n## Installation\n\nTo use the complete Ragbits stack, install the `ragbits` package:\n\n```sh\npip install ragbits\n```\n\nAlternatively, you can use individual components of the stack by installing their respective packages: `ragbits-core`, `ragbits-document-search`, `ragbits-cli`.\n\n## Quickstart\n\nFirst, create a prompt and a model for the data used in the prompt:\n\n```python\nfrom pydantic import BaseModel\nfrom ragbits.core.prompt import Prompt\n\nclass Dog(BaseModel):\n breed: str\n age: int\n temperament: str\n\nclass DogNamePrompt(Prompt[Dog, str]):\n system_prompt = \"\"\"\n You are a dog name generator. You come up with funny names for dogs given the dog details.\n \"\"\"\n\n user_prompt = \"\"\"\n The dog is a {breed} breed, {age} years old, and has a {temperament} temperament.\n \"\"\"\n```\n\nNext, create an instance of the LLM and the prompt:\n\n```python\nfrom ragbits.core.llms.litellm import LiteLLM\n\nllm = LiteLLM(\"gpt-4o\")\nexample_dog = Dog(breed=\"Golden Retriever\", age=3, temperament=\"friendly\")\nprompt = DogNamePrompt(example_dog)\n```\n\nFinally, generate a response from the LLM using the prompt:\n\n```python\nresponse = await llm.generate(prompt)\nprint(f\"Generated dog name: {response}\")\n```\n\n<!--\nTODO:\nAdd links to quickstart guides for individual packages, demonstrating how to extend this with their functionality.\nAdd a link to the full tutorial.\n-->\n\n## License\n\nRagbits is licensed under the [MIT License](LICENSE).\n\n## Contributing\n\nWe welcome contributions! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for more information.\n",
"bugtrack_url": null,
"license": null,
"summary": "Building blocks for rapid development of GenAI applications",
"version": "0.3.0",
"project_urls": null,
"split_keywords": [
"genai",
" generative ai",
" llms",
" large language models",
" prompt management",
" rag",
" retrieval augmented generation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "deac0d494d78f4f2679709d810a16c58d487712f927f8bee3895c64432b70cff",
"md5": "26985debbdbec4a3206a509e001e4638",
"sha256": "aaefc3ef84a80e3e7f81f4b4012d70efd345697712153412943c437b353d8eb5"
},
"downloads": -1,
"filename": "ragbits-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "26985debbdbec4a3206a509e001e4638",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 2426,
"upload_time": "2024-11-06T16:24:36",
"upload_time_iso_8601": "2024-11-06T16:24:36.048917Z",
"url": "https://files.pythonhosted.org/packages/de/ac/0d494d78f4f2679709d810a16c58d487712f927f8bee3895c64432b70cff/ragbits-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5b6c2d83a70f0ba56e20bf8d2a6bc49f113832e06ad6b71b3f9301eb9afb259f",
"md5": "9a1da2347559392f58c75a731b76a985",
"sha256": "8c9067c8355f1bb7c234c27e3a87963070af99b09c3ec40daee73a3ce849f03b"
},
"downloads": -1,
"filename": "ragbits-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "9a1da2347559392f58c75a731b76a985",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 3930,
"upload_time": "2024-11-06T16:24:37",
"upload_time_iso_8601": "2024-11-06T16:24:37.914960Z",
"url": "https://files.pythonhosted.org/packages/5b/6c/2d83a70f0ba56e20bf8d2a6bc49f113832e06ad6b71b3f9301eb9afb259f/ragbits-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-06 16:24:37",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "ragbits"
}