<div align="center">
<h1>Ragbits</h1>
*Building blocks for rapid development of GenAI applications*
[Documentation](https://ragbits.deepsense.ai) | [Contact](https://deepsense.ai/contact/)
[](https://pypi.org/project/ragbits)
[](https://pypi.org/project/ragbits)
[](https://pypi.org/project/ragbits)
</div>
---
## What's Included?
- [X] **[Core](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-core)** - Fundamental tools for working with prompts and LLMs.
- [X] **[Document Search](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-document-search)** - Handles vector search to retrieve relevant documents.
- [X] **[CLI](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-cli)** - The `ragbits` shell command, enabling tools such as GUI prompt management.
- [x] **[Guardrails](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-guardrails)** - Ensures response safety and relevance.
- [x] **[Evaluation](https://github.com/deepsense-ai/ragbits/tree/main/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](https://github.com/deepsense-ai/ragbits/tree/main/LICENSE).
## Contributing
We welcome contributions! Please read [CONTRIBUTING.md](https://github.com/deepsense-ai/ragbits/tree/main/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/2c/74/402fa559a3a8cd52fd52c0e3db820cca7789a62d58436f7fb347a3284dbd/ragbits-0.5.1.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[](https://pypi.org/project/ragbits)\n[](https://pypi.org/project/ragbits)\n[](https://pypi.org/project/ragbits)\n\n</div>\n\n---\n\n## What's Included?\n\n- [X] **[Core](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-core)** - Fundamental tools for working with prompts and LLMs.\n- [X] **[Document Search](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-document-search)** - Handles vector search to retrieve relevant documents.\n- [X] **[CLI](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-cli)** - The `ragbits` shell command, enabling tools such as GUI prompt management.\n- [x] **[Guardrails](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-guardrails)** - Ensures response safety and relevance.\n- [x] **[Evaluation](https://github.com/deepsense-ai/ragbits/tree/main/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](https://github.com/deepsense-ai/ragbits/tree/main/LICENSE).\n\n## Contributing\n\nWe welcome contributions! Please read [CONTRIBUTING.md](https://github.com/deepsense-ai/ragbits/tree/main/CONTRIBUTING.md) for more information.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Building blocks for rapid development of GenAI applications",
"version": "0.5.1",
"project_urls": {
"Bug Reports": "https://github.com/deepsense-ai/ragbits/issues",
"Documentation": "https://ragbits.deepsense.ai/",
"Homepage": "https://github.com/deepsense-ai/ragbits",
"Source": "https://github.com/deepsense-ai/ragbits"
},
"split_keywords": [
"genai",
" generative ai",
" llms",
" large language models",
" prompt management",
" rag",
" retrieval augmented generation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a2355c1356da13ef3d7814039888fdea82ab61d8a846e8c5adb0aab3593d3dfe",
"md5": "1bc23343994a333c05a1f650a873b947",
"sha256": "4a44e5defc25afb35e3775d7caed0e55f5e3998bfa8bbd27e8a89c0cc699d5b4"
},
"downloads": -1,
"filename": "ragbits-0.5.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1bc23343994a333c05a1f650a873b947",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 2816,
"upload_time": "2024-12-09T13:49:36",
"upload_time_iso_8601": "2024-12-09T13:49:36.215574Z",
"url": "https://files.pythonhosted.org/packages/a2/35/5c1356da13ef3d7814039888fdea82ab61d8a846e8c5adb0aab3593d3dfe/ragbits-0.5.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2c74402fa559a3a8cd52fd52c0e3db820cca7789a62d58436f7fb347a3284dbd",
"md5": "90749bf3858a519df792993b829bbe63",
"sha256": "30ad81eb2deebdb162ed6b88379f74ad00cb0246ee74a37ddad6ad1911fab458"
},
"downloads": -1,
"filename": "ragbits-0.5.1.tar.gz",
"has_sig": false,
"md5_digest": "90749bf3858a519df792993b829bbe63",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 4880,
"upload_time": "2024-12-09T13:49:44",
"upload_time_iso_8601": "2024-12-09T13:49:44.877599Z",
"url": "https://files.pythonhosted.org/packages/2c/74/402fa559a3a8cd52fd52c0e3db820cca7789a62d58436f7fb347a3284dbd/ragbits-0.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-09 13:49:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "deepsense-ai",
"github_project": "ragbits",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ragbits"
}