-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d73e9d0
commit b8cd737
Showing
25 changed files
with
762 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
uv sync --only-dev | ||
|
||
echo $GCP_KEY | base64 -d >> gcp_creds.json | ||
gcloud auth activate-service-account --key-file gcp_creds.json | ||
gcloud config set project ds-internal-db-ally | ||
|
||
# Build the documentation | ||
uv run mkdocs build | ||
|
||
# Upload built docs to a bucket | ||
gcloud storage cp -r site/* gs://ragbits-documentation | ||
|
||
# Invalidate cached content in the CDN | ||
gcloud compute url-maps invalidate-cdn-cache ragbits-documentation-lb \ | ||
--path "/*" --async |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Deploy documentation | ||
|
||
on: | ||
release: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
container: gcr.io/google.com/cloudsdktool/google-cloud-cli:latest | ||
environment: documentation | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v2 | ||
with: | ||
version: "0.4.10" | ||
- name: Cache Dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/uv | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Deploy docs | ||
run: ./.github/scripts/deploy_docs.sh | ||
env: | ||
GCP_KEY: ${{ secrets.GCP_KEY }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Embeddings | ||
|
||
::: ragbits.core.embeddings.Embeddings | ||
|
||
::: ragbits.core.embeddings.LocalEmbeddings | ||
|
||
::: ragbits.core.embeddings.LiteLLMEmbeddings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# LLMs | ||
|
||
::: ragbits.core.llms.LLM | ||
|
||
::: ragbits.core.llms.LocalLLM | ||
|
||
::: ragbits.core.llms.LiteLLM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Prompt | ||
|
||
::: ragbits.core.prompt.Prompt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Vector Store | ||
|
||
::: ragbits.core.vector_store.VectorDBEntry | ||
|
||
::: ragbits.core.vector_store.VectorStore | ||
|
||
::: ragbits.core.vector_store.InMemoryVectorStore | ||
|
||
::: ragbits.core.vector_store.ChromaDBStore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Documents and Elements | ||
|
||
::: ragbits.document_search.documents.document.Document | ||
|
||
::: ragbits.document_search.documents.element.Element | ||
|
||
::: ragbits.document_search.documents.sources.Source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Document Search | ||
|
||
::: ragbits.document_search.DocumentSearch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Document Processing | ||
|
||
::: ragbits.document_search.ingestion.document_processor.DocumentProcessorRouter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
hide: | ||
- navigation | ||
--- | ||
|
||
# ragbits docs | ||
|
||
<style> | ||
.md-content .md-typeset h1 { display: none; } | ||
</style> | ||
|
||
<div align="center" markdown="span"> | ||
![ragbits logo](./assets/ragbits.png#only-light){ width="50%" } | ||
![ragbits logo](./assets/ragbits.png#only-dark){ width="50%" } | ||
</div> | ||
|
||
<p align="center"> | ||
<em size="">Building blocks for rapid development of GenAI applications.</em> | ||
</p> | ||
|
||
<div align="center"> | ||
|
||
<a href="https://pypi.org/project/ragbits" target="_blank"> | ||
<img alt="PyPI - License" src="https://img.shields.io/pypi/l/ragbits"> | ||
</a> | ||
|
||
<a href="https://pypi.org/project/ragbits" target="_blank"> | ||
<img alt="PyPI - Version" src="https://img.shields.io/pypi/v/ragbits"> | ||
</a> | ||
|
||
<a href="https://pypi.org/project/ragbits" target="_blank"> | ||
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/ragbits"> | ||
</a> | ||
|
||
</div> | ||
--- | ||
|
||
**ragbits** is a Python package that offers essential "bits" for building powerful Retrieval-Augmented Generation (RAG) | ||
applications. | ||
|
||
**ragbits** prioritizes an exceptional developer experience by providing a simple and intuitive API. | ||
It also includes a comprehensive set of tools for seamlessly building, testing, and deploying your RAG applications | ||
efficiently. | ||
|
||
## Installation | ||
|
||
You can install the latest version of **ragbits** using pip: | ||
|
||
```bash | ||
pip install ragbits | ||
``` | ||
|
||
Additionally, you can install one of the extensions to **ragbits**: | ||
|
||
- `ragbits[document-search]` - provides tools for building document search applications. | ||
|
||
## Quickstart | ||
|
||
To build the simplest documents search, you can use the following code snippet: | ||
|
||
```python | ||
import asyncio | ||
|
||
from ragbits.core.embeddings import LiteLLMEmbeddings | ||
from ragbits.core.vector_store import InMemoryVectorStore | ||
from ragbits.document_search import DocumentSearch | ||
from ragbits.document_search.documents.document import DocumentMeta | ||
|
||
documents = [ | ||
DocumentMeta.create_text_document_from_literal("RIP boiled water. You will be mist."), | ||
DocumentMeta.create_text_document_from_literal( | ||
"Why doesn't James Bond fart in bed? Because it would blow his cover." | ||
), | ||
DocumentMeta.create_text_document_from_literal( | ||
"Why programmers don't like to swim? Because they're scared of the floating points." | ||
), | ||
] | ||
|
||
|
||
async def main(): | ||
document_search = DocumentSearch(embedder=LiteLLMEmbeddings(), vector_store=InMemoryVectorStore()) | ||
|
||
for document in documents: | ||
await document_search.ingest_document(document) | ||
|
||
return await document_search.search("I'm boiling my water and I need a joke") | ||
|
||
|
||
if __name__ == "__main__": | ||
print(asyncio.run(main())) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## Promptfoo Integration | ||
|
||
Ragbits' `Prompt` abstraction can be seamlessly integrated with the `promptfoo` tool. After installing `promptfoo` as | ||
specified in the [promptfoo documentation](https://www.promptfoo.dev/docs/installation/), you can generate promptfoo | ||
configuration files for all the prompts discovered by our autodiscover mechanism by running the following command: | ||
|
||
```bash | ||
rbts prompts generate-promptfoo-configs | ||
``` | ||
|
||
This command will generate a YAML files in the directory specified by `--target-path` (`promptfooconfigs` by | ||
default). The generated file should look like this: | ||
|
||
```yaml | ||
prompts: | ||
- file:///path/to/your/prompt:PromptClass.to_promptfoo | ||
``` | ||
You can then edit the generated file to add your custom `promptfoo` configurations. Once your `promptfoo` configuration | ||
file is ready, you can run `promptfoo` with the following command: | ||
|
||
```bash | ||
promptfoo -c /path/to/generated/promptfoo-config.yaml eval | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
:root { | ||
--md-primary-fg-color: #00b0e0; | ||
} | ||
|
||
.md-header__title { | ||
margin-left: 0.5rem !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
site_name: ragbits docs | ||
site_description: Library for fast RAG application development | ||
site_url: https://ragbits.deepsense.ai | ||
repo_name: deepsense-ai/ragbits | ||
repo_url: https://github.com/deepsense-ai/ragbits | ||
copyright: Copyright © 2024 deepsense.ai | ||
nav: | ||
- rabgbits: index.md | ||
- How-to Guides: | ||
- integrations/promptfoo.md | ||
- API Reference: | ||
- Core: | ||
- api_reference/core/prompt.md | ||
- api_reference/core/llms.md | ||
- api_reference/core/embeddings.md | ||
- api_reference/core/vector_store.md | ||
- Document Search: | ||
- api_reference/document_search/index.md | ||
- api_reference/document_search/documents.md | ||
- api_reference/document_search/ingestion.md | ||
|
||
theme: | ||
name: material | ||
icon: | ||
repo: fontawesome/brands/github | ||
palette: | ||
- media: "(prefers-color-scheme)" | ||
toggle: | ||
icon: material/lightbulb-auto | ||
name: Switch to light mode | ||
- media: '(prefers-color-scheme: light)' | ||
scheme: default | ||
primary: primary | ||
toggle: | ||
icon: material/lightbulb | ||
name: Switch to dark mode | ||
- media: '(prefers-color-scheme: dark)' | ||
scheme: slate | ||
primary: primary | ||
toggle: | ||
icon: material/lightbulb-outline | ||
name: Switch to system preference | ||
features: | ||
- navigation.footer | ||
- navigation.tabs | ||
- navigation.tabs.sticky | ||
- navigation.top | ||
- content.code.annotate | ||
- content.code.copy | ||
extra_css: | ||
- stylesheets/extra.css | ||
markdown_extensions: | ||
- pymdownx.highlight: | ||
anchor_linenums: true | ||
line_spans: __span | ||
pygments_lang_class: true | ||
- pymdownx.superfences: | ||
custom_fences: | ||
- name: mermaid | ||
class: mermaid | ||
- admonition | ||
- pymdownx.superfences | ||
- pymdownx.snippets | ||
- pymdownx.inlinehilite | ||
- attr_list | ||
- md_in_html | ||
- pymdownx.details | ||
- def_list | ||
- pymdownx.tasklist: | ||
custom_checkbox: true | ||
- pymdownx.tabbed: | ||
alternate_style: true | ||
- toc: | ||
permalink: "#" | ||
plugins: | ||
- search | ||
- autorefs: | ||
enable: true | ||
- mkdocstrings: | ||
handlers: | ||
python: | ||
options: | ||
show_root_heading: true | ||
show_if_no_docstring: true | ||
inherited_members: true | ||
members_order: source | ||
separate_signature: true | ||
unwrap_annotated: true | ||
filters: | ||
- "!^_" | ||
merge_init_into_class: true | ||
docstring_section_style: spacy | ||
signature_crossrefs: true | ||
show_symbol_type_heading: true | ||
show_symbol_type_toc: true | ||
show_signature_annotations: true | ||
extra: | ||
social: | ||
- icon: fontawesome/brands/github | ||
link: https://github.com/deepsense-ai | ||
- icon: fontawesome/brands/x-twitter | ||
link: https://x.com/deepsense_ai | ||
- icon: fontawesome/brands/linkedin | ||
link: https://linkedin.com/company/deepsense-ai | ||
- icon: fontawesome/brands/youtube | ||
link: https://youtube.com/@deepsenseai | ||
- icon: fontawesome/brands/medium | ||
link: https://medium.com/deepsense-ai | ||
- icon: fontawesome/solid/globe | ||
link: https://deepsense.ai |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from .base import Embeddings | ||
from .litellm import LiteLLMEmbeddings | ||
from .local import LocalEmbeddings | ||
|
||
__all__ = ["Embeddings", "LiteLLMEmbeddings", "LocalEmbeddings"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from .base import VectorDBEntry, VectorStore | ||
from .chromadb_store import ChromaDBStore | ||
from .in_memory import InMemoryVectorStore | ||
|
||
__all__ = ["VectorStore", "VectorDBEntry", "InMemoryVectorStore", "ChromaDBStore"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.