Skip to content

Commit 15bc63e

Browse files
authored
docs: update readme (#575)
1 parent b1e8cfb commit 15bc63e

File tree

2 files changed

+259
-72
lines changed

2 files changed

+259
-72
lines changed

README.md

Lines changed: 125 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<div align="center">
22

3-
<h1>Ragbits</h1>
3+
<h1>🐰 Ragbits</h1>
44

55
*Building blocks for rapid development of GenAI applications*
66

7-
[Documentation](https://ragbits.deepsense.ai) | [Contact](https://deepsense.ai/contact/)
7+
[Homepage](https://deepsense.ai/rd-hub/ragbits/) | [Documentation](https://ragbits.deepsense.ai) | [Contact](https://deepsense.ai/contact/)
88

99
[![PyPI - License](https://img.shields.io/pypi/l/ragbits)](https://pypi.org/project/ragbits)
1010
[![PyPI - Version](https://img.shields.io/pypi/v/ragbits)](https://pypi.org/project/ragbits)
@@ -17,98 +17,181 @@
1717
## Features
1818

1919
### 🔨 Build Reliable & Scalable GenAI Apps
20+
2021
- **Swap LLMs anytime** – Switch between [100+ LLMs via LiteLLM](https://ragbits.deepsense.ai/how-to/llms/use_llms/) or run [local models](https://ragbits.deepsense.ai/how-to/llms/use_local_llms/).
2122
- **Type-safe LLM calls** – Use Python generics to [enforce strict type safety](https://ragbits.deepsense.ai/how-to/prompts/use_prompting/#how-to-configure-prompts-output-data-type) in model interactions.
2223
- **Bring your own vector store** – Connect to [Qdrant](https://ragbits.deepsense.ai/api_reference/core/vector-stores/#ragbits.core.vector_stores.qdrant.QdrantVectorStore), [PgVector](https://ragbits.deepsense.ai/api_reference/core/vector-stores/#ragbits.core.vector_stores.pgvector.PgVectorStore), and more with built-in support.
2324
- **Developer tools included**[Manage vector stores](https://ragbits.deepsense.ai/cli/main/#ragbits-vector-store), query pipelines, and [test prompts from your terminal](https://ragbits.deepsense.ai/quickstart/quickstart1_prompts/#testing-the-prompt-from-the-cli).
2425
- **Modular installation** – Install only what you need, reducing dependencies and improving performance.
2526

2627
### 📚 Fast & Flexible RAG Processing
27-
- **Ingest 20+ formats** – Process PDFs, HTML, spreadsheets, presentations, and more. Process data using [docling](https://github.com/docling-project/docling), [unstructured](https://github.com/Unstructured-IO/unstructured) or create a custom parser.
28+
29+
- **Ingest 20+ formats** – Process PDFs, HTML, spreadsheets, presentations, and more. Process data using [Docling](https://github.com/docling-project/docling), [Unstructured](https://github.com/Unstructured-IO/unstructured) or create a custom parser.
2830
- **Handle complex data** – Extract tables, images, and structured content with built-in VLMs support.
2931
- **Connect to any data source** – Use prebuilt connectors for S3, GCS, Azure, or implement your own.
3032
- **Scale ingestion** – Process large datasets quickly with [Ray-based parallel processing](https://ragbits.deepsense.ai/how-to/document_search/distributed_ingestion/#how-to-ingest-documents-in-a-distributed-fashion).
3133

3234
### 🚀 Deploy & Monitor with Confidence
35+
3336
- **Real-time observability** – Track performance with [OpenTelemetry](https://ragbits.deepsense.ai/how-to/project/use_tracing/#opentelemetry-trace-handler) and [CLI insights](https://ragbits.deepsense.ai/how-to/project/use_tracing/#cli-trace-handler).
3437
- **Built-in testing** – Validate prompts [with promptfoo](https://ragbits.deepsense.ai/how-to/prompts/promptfoo/) before deployment.
3538
- **Auto-optimization** – Continuously evaluate and refine model performance.
3639
- **Visual testing UI (Coming Soon)** – Test and optimize applications with a visual interface.
3740

38-
39-
## What's Included?
40-
41-
- [X] **[Core](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-core)** - Fundamental tools for working with prompts and LLMs.
42-
- [X] **[Document Search](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-document-search)** - Handles vector search to retrieve relevant documents.
43-
- [X] **[CLI](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-cli)** - The `ragbits` shell command, enabling tools such as GUI prompt management.
44-
- [x] **[Guardrails](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-guardrails)** - Ensures response safety and relevance.
45-
- [x] **[Evaluation](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-evaluate)** - Unified evaluation framework for Ragbits components.
46-
- [ ] **Flow Controls** - Manages multi-stage chat flows for performing advanced actions *(coming soon)*.
47-
- [ ] **Structured Querying** - Queries structured data sources in a predictable manner *(coming soon)*.
48-
- [ ] **Caching** - Adds a caching layer to reduce costs and response times *(coming soon)*.
49-
5041
## Installation
5142

52-
To use the complete Ragbits stack, install the `ragbits` package:
43+
To get started quickly, you can install with:
5344

5445
```sh
5546
pip install ragbits
5647
```
5748

58-
Alternatively, you can use individual components of the stack by installing their respective packages: `ragbits-core`, `ragbits-document-search`, `ragbits-cli`.
49+
This is a starter bundle of packages, containing:
50+
51+
- [`ragbits-core`](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-core) - fundamental tools for working with prompts, LLMs and vector databases.
52+
- [`ragbits-agents`](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-agents) - abstractions for building agentic systems.
53+
- [`ragbits-document-search`](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-document-search) - retrieval and ingestion piplines for knowledge bases.
54+
- [`ragbits-evaluate`](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-evaluate) - unified evaluation framework for Ragbits components.
55+
- [`ragbits-chat`](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-chat) - full-stack infrastructure for building conversational AI applications.
56+
- [`ragbits-cli`](https://github.com/deepsense-ai/ragbits/tree/main/packages/ragbits-cli) - `ragbits` shell command for interacting with Ragbits components.
57+
58+
Alternatively, you can use individual components of the stack by installing their respective packages.
5959

6060
## Quickstart
6161

62-
First, create a prompt and a model for the data used in the prompt:
62+
### Basics
63+
64+
To define a prompt and run LLM:
6365

6466
```python
67+
import asyncio
6568
from pydantic import BaseModel
69+
from ragbits.core.llms import LiteLLM
6670
from ragbits.core.prompt import Prompt
6771

68-
class Dog(BaseModel):
69-
breed: str
70-
age: int
71-
temperament: str
72+
class QuestionAnswerPromptInput(BaseModel):
73+
question: str
7274

73-
class DogNamePrompt(Prompt[Dog, str]):
75+
class QuestionAnswerPromptOutput(BaseModel):
76+
answer: str
77+
78+
class QuestionAnswerPrompt(Prompt[QuestionAnswerPromptInput, QuestionAnswerPromptOutput]):
7479
system_prompt = """
75-
You are a dog name generator. You come up with funny names for dogs given the dog details.
80+
You are a question answering agent. Answer the question to the best of your ability.
7681
"""
77-
7882
user_prompt = """
79-
The dog is a {breed} breed, {age} years old, and has a {temperament} temperament.
83+
Question: {{ question }}
8084
"""
85+
86+
llm = LiteLLM(model_name="gpt-4.1-nano", use_structured_output=True)
87+
88+
async def main() -> None:
89+
prompt = QuestionAnswerPrompt(QuestionAnswerPromptInput(question="What are high memory and low memory on linux?"))
90+
response = await llm.generate(prompt)
91+
print(response.answer)
92+
93+
if __name__ == "__main__":
94+
asyncio.run(main())
8195
```
8296

83-
Next, create an instance of the LLM and the prompt:
97+
### Document Search
8498

85-
```python
86-
from ragbits.core.llms.litellm import LiteLLM
99+
To build and query a simple vector store index:
87100

88-
llm = LiteLLM("gpt-4o")
89-
example_dog = Dog(breed="Golden Retriever", age=3, temperament="friendly")
90-
prompt = DogNamePrompt(example_dog)
101+
```python
102+
import asyncio
103+
from ragbits.core.embeddings import LiteLLMEmbedder
104+
from ragbits.core.vector_stores import InMemoryVectorStore
105+
from ragbits.document_search import DocumentSearch
106+
107+
embedder = LiteLLMEmbedder(model_name="text-embedding-3-small")
108+
vector_store = InMemoryVectorStore(embedder=embedder)
109+
document_search = DocumentSearch(vector_store=vector_store)
110+
111+
async def run() -> None:
112+
await document_search.ingest("web://https://arxiv.org/pdf/1706.03762")
113+
result = await document_search.search("What are the key findings presented in this paper?")
114+
print(result)
115+
116+
if __name__ == "__main__":
117+
asyncio.run(run())
91118
```
92119

93-
Finally, generate a response from the LLM using the prompt:
120+
### Retrieval-Augmented Generation
121+
122+
To build a simple RAG pipeline:
94123

95124
```python
96-
response = await llm.generate(prompt)
97-
print(f"Generated dog name: {response}")
125+
import asyncio
126+
from pydantic import BaseModel
127+
from ragbits.core.embeddings import LiteLLMEmbedder
128+
from ragbits.core.llms import LiteLLM
129+
from ragbits.core.prompt import Prompt
130+
from ragbits.core.vector_stores import InMemoryVectorStore
131+
from ragbits.document_search import DocumentSearch
132+
133+
class QuestionAnswerPromptInput(BaseModel):
134+
question: str
135+
context: list[str]
136+
137+
class QuestionAnswerPromptOutput(BaseModel):
138+
answer: str
139+
140+
class QuestionAnswerPrompt(Prompt[QuestionAnswerPromptInput, QuestionAnswerPromptOutput]):
141+
system_prompt = """
142+
You are a question answering agent. Answer the question that will be provided using context.
143+
If in the given context there is not enough information refuse to answer.
144+
"""
145+
user_prompt = """
146+
Question: {{ question }}
147+
Context: {% for item in context %}
148+
{{ item }}
149+
{%- endfor %}
150+
"""
151+
152+
embedder = LiteLLMEmbedder(model_name="text-embedding-3-small")
153+
vector_store = InMemoryVectorStore(embedder=embedder)
154+
document_search = DocumentSearch(vector_store=vector_store)
155+
llm = LiteLLM(model_name="gpt-4.1-nano", use_structured_output=True)
156+
157+
async def run() -> None:
158+
question = "What are the key findings presented in this paper?"
159+
160+
await document_search.ingest("web://https://arxiv.org/pdf/1706.03762")
161+
result = await document_search.search(question)
162+
163+
prompt = QuestionAnswerPrompt(QuestionAnswerPromptInput(
164+
question=question,
165+
context=[element.text_representation for element in result],
166+
))
167+
response = await llm.generate(prompt)
168+
print(response.answer)
169+
170+
if __name__ == "__main__":
171+
asyncio.run(run())
98172
```
99173

100-
## How Ragbits documentation is organized
174+
## Rapid development
101175

102-
- [Quickstart](https://ragbits.deepsense.ai/quickstart/quickstart1_prompts/) - Get started with Ragbits in a few minutes
103-
- [How-to guides](https://ragbits.deepsense.ai/how-to/prompts/use_prompting/) - Learn how to use Ragbits in your projects
104-
- [CLI](https://ragbits.deepsense.ai/cli/main/) - Learn how to run Ragbits in your terminal
105-
- [API reference](https://ragbits.deepsense.ai/api_reference/core/prompt/) - Explore the underlying API of Ragbits
176+
Create Ragbits projects from templates:
106177

178+
```sh
179+
uvx create-ragbits-app
180+
```
107181

108-
## License
182+
Explore `create-ragbits-app` repo [here](https://github.com/deepsense-ai/create-ragbits-app). If you have a new idea for a template, feel free to contribute!
109183

110-
Ragbits is licensed under the [MIT License](https://github.com/deepsense-ai/ragbits/tree/main/LICENSE).
184+
## Documentation
185+
186+
- [Quickstart](https://ragbits.deepsense.ai/quickstart/quickstart1_prompts/) - Get started with Ragbits in a few minutes
187+
- [How-to](https://ragbits.deepsense.ai/how-to/prompts/use_prompting/) - Learn how to use Ragbits in your projects
188+
- [CLI](https://ragbits.deepsense.ai/cli/main/) - Learn how to run Ragbits in your terminal
189+
- [API reference](https://ragbits.deepsense.ai/api_reference/core/prompt/) - Explore the underlying Ragbits API
111190

112191
## Contributing
113192

114193
We welcome contributions! Please read [CONTRIBUTING.md](https://github.com/deepsense-ai/ragbits/tree/main/CONTRIBUTING.md) for more information.
194+
195+
## License
196+
197+
Ragbits is licensed under the [MIT License](https://github.com/deepsense-ai/ragbits/tree/main/LICENSE).

0 commit comments

Comments
 (0)