Skip to content

Commit

Permalink
doc: added embedding recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisVLRT committed Jan 15, 2024
1 parent e9b20f2 commit 553615d
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is a starter kit to deploy a modularizable RAG locally or on the cloud (or

## Features

- A configurable RAG setup based around Langchain
- A configurable RAG setup based around Langchain ([Check out the configuration cookbook here](https://redesigned-umbrella-evz5np5.pages.github.io/cookbook/))
- `RAG` and `RagConfig` python classes to help you set things up
- A REST API based on FastAPI to provide easy access to the RAG as a web backend
- A demo Streamlit to serve as a basic working frontend (not production grade)
Expand Down Expand Up @@ -39,7 +39,7 @@ Start the frontend demo
python -m streamlit run frontend/app.py
```

You should than be able to login and chat to the bot:
You should then be able to login and chat to the bot:

![](docs/login_and_chat.gif)

Expand All @@ -54,7 +54,7 @@ The RAG now has access to thn information from your loaded documents:

## Documentation

To deep dive into under the hood, take a look at the documentation
To learn how to configure the RAG, take a look at the documentation

[On github pages](https://redesigned-umbrella-evz5np5.pages.github.io/)

Expand Down
7 changes: 6 additions & 1 deletion docs/cookbook.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
Here you will find a repository of configurations that proved to work.
Here you will find a repository of configurations that have proved to work.

- [LLM Configuration samples](recipe_llms_configs.md)
- [Embedding model Configuration samples](recipe_embedding_models_configs.md)
- [Vector Store Configuration samples](recipe_vector_stores_configs.md)
- [Database Configuration samples](recipe_databases_configs.md)
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is a starter kit to deploy a modularizable RAG locally or on the cloud (or

## Features

- A configurable RAG setup based around Langchain
- A configurable RAG setup based around Langchain ([Check out the configuration cookbook here](cookbook))
- `RAG` and `RagConfig` python classes to help you set things up
- A REST API based on FastAPI to provide easy access to the RAG as a web backend
- A demo Streamlit to serve as a basic working frontend (not production grade)
Expand Down Expand Up @@ -39,7 +39,7 @@ Start the frontend demo
python -m streamlit run frontend/app.py
```

You should than be able to login and chat to the bot:
You should then be able to login and chat to the bot:

![](login_and_chat.gif)

Expand Down
1 change: 1 addition & 0 deletions docs/recipe_databases_configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ As the database URL contains a username and password, we don't want to have it d

Instead, we have:
```yaml
# backend/config.yaml
DatabaseConfig: &DatabaseConfig
database_url: {{ DATABASE_URL }}
```
Expand Down
34 changes: 34 additions & 0 deletions docs/recipe_embedding_models_configs.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
## Locally hosted embedding model from Hugging Face

This will download the selected model from the HF hub and make embeddings on the machine the backend is running on.
```shell
pip install sentence_transformers
```

```yaml
# backend/config.yaml
EmbeddingModelConfig: &EmbeddingModelConfig
source: HuggingFaceEmbeddings
source_config:
model_name : 'BAAI/bge-base-en-v1.5'
```
## Artefact Azure-hosted embedding model
```yaml
# backend/config.yaml
EmbeddingModelConfig: &EmbeddingModelConfig
source: OpenAIEmbeddings
source_config:
Expand All @@ -10,3 +27,20 @@ EmbeddingModelConfig: &EmbeddingModelConfig
deployment: embeddings
chunk_size: 500
```
## AWS Bedrock
!!! info "You will first need to login to AWS"
```shell
pip install boto3
```
[Follow this guide to authenticate your machine](https://docs.aws.amazon.com/cli/latest/userguide/cli-authentication-user.html)

```yaml
# backend/config.yaml
EmbeddingModelConfig: &EmbeddingModelConfig
source: BedrockEmbeddings
source_config:
model_id: 'amazon.titan-embed-text-v1'
```
6 changes: 4 additions & 2 deletions docs/recipe_llms_configs.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Artefact Azure-hosted GPT4-turbo

```yaml
# backend/config.yaml
LLMConfig: &LLMConfig
source: AzureChatOpenAI
source_config:
Expand All @@ -24,6 +25,7 @@ LLMConfig: &LLMConfig
```

```yaml
# backend/config.yaml
LLMConfig: &LLMConfig
source: ChatOllama
source_config:
Expand All @@ -42,10 +44,10 @@ LLMConfig: &LLMConfig
```

!!! info ""

[Activate the Vertex APIs in your project](https://console.cloud.google.com/vertex-ai)
<a href="https://console.cloud.google.com/vertex-ai" target="_blank">Activate the Vertex APIs in your project</a>

```yaml
# backend/config.yaml
LLMConfig: &LLMConfig
source: ChatVertexAI
source_config:
Expand Down
2 changes: 2 additions & 0 deletions docs/recipe_vector_stores_configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pip install psycopg2-binary pgvector
```

```yaml
# backend/config.yaml
VectorStoreConfig: &VectorStoreConfig
source: PGVector
source_config:
Expand All @@ -32,6 +33,7 @@ VectorStoreConfig: &VectorStoreConfig
## Local Chroma

```yaml
# backend/config.yaml
VectorStoreConfig: &VectorStoreConfig
source: Chroma
source_config:
Expand Down

0 comments on commit 553615d

Please sign in to comment.