Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add project-level README #103

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Installation

## Build from source

To build and run Ragbits from the source code:

1. Requirements: [**uv**](https://docs.astral.sh/uv/getting-started/installation/) & [**python**](https://docs.astral.sh/uv/guides/install-python/) 3.10 or higher
2. Install dependencies and run venv in editable mode:

```bash
$ source ./setup_dev_env.sh
```

## Install pre-commit

To ensure code quality we use pre-commit hook with several checks. Setup it by:

```
pre-commit install
```

All updated files will be reformatted and linted before the commit.

To reformat and lint all files in the project, use:

`pre-commit run --all-files`

The used linters are configured in `.pre-commit-config.yaml`. You can use `pre-commit autoupdate` to bump tools to the latest versions.
90 changes: 74 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,90 @@
# Ragbits
<div align="center">

Repository for internal experiment with our upcoming LLM framework.
<h1>Ragbits</h1>

# Installation
*Building blocks for rapid development of GenAI applications*

## Build from source
[Documentation](https://ragbits.deepsense.ai) | [Contact](https://deepsense.ai/contact/)

To build and run Ragbits from the source code:
[![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)

1. Requirements: [**uv**](https://docs.astral.sh/uv/getting-started/installation/) & [**python**](https://docs.astral.sh/uv/guides/install-python/) 3.10 or higher
2. Install dependencies and run venv in editable mode:
</div>

```bash
$ source ./setup_dev_env.sh
---

## 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.
- [ ] **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)*.
- [ ] **Observability & Audit** - Tracks user queries and events for easier troubleshooting *(coming soon)*.
- [ ] **Guardrails** - Ensures response safety and relevance *(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`.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add maybe one more command snippet with pip install ragbits-... for each package with a comment "Adjust to your needs" or something like that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it. You want a separate snippet for each package? We will have a lot of packages soon, so I don't think that would be a good idea

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking more of something like this:

pip install ragbits-cli
pip install ragbits-core
pip install ragbits-document-search

other packages as needed...

We don't really need to update this list, but only show the user an alternative way of installation. But I don't have strong preference here, we can skip it.

Copy link
Collaborator Author

@ludwiktrammer ludwiktrammer Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that each package will have its own package-specific readme (linked from the list of packages above) and the package-specific installation instructions will be there. Does this sounds ok to you?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great

## 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.
"""
```

## Install pre-commit
Next, create an instance of the LLM and the prompt:

To ensure code quality we use pre-commit hook with several checks. Setup it by:
```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)
```
pre-commit install

Finally, generate a response from the LLM using the prompt:

```python
response = await llm.generate(prompt)
print(f"Generated dog name: {response}")
```

All updated files will be reformatted and linted before the commit.
<!--
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

To reformat and lint all files in the project, use:
Ragbits is licensed under the [MIT License](LICENSE).

`pre-commit run --all-files`
## Contributing

The used linters are configured in `.pre-commit-config.yaml`. You can use `pre-commit autoupdate` to bump tools to the latest versions.
We welcome contributions! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
Loading