You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RAG (Retrieval-Augmented Generation) is a powerful approach for enhancing a model's knowledge by leveraging your own dataset.
13
-
Scaleway's robust infrastructure makes it easier than ever to implement RAG, as our products are fully compatible with LangChain, especially the OpenAI integration.
14
-
By utilizing our managed inference services, managed databases, and object storage, you can effortlessly build and deploy a customized model tailored to your specific needs.
12
+
Retrieval-Augmented Generation (RAG) enhances the power of language models by enabling them to retrieve relevant information from external datasets. In this tutorial, we’ll implement RAG using Scaleway’s Managed Inference, PostgreSQL, pgvector, and Scaleway’s Object Storage.
13
+
14
+
With Scaleway's fully managed services, integrating RAG becomes a streamlined process. You'll use a sentence transformer for embedding text, store embeddings in a PostgreSQL database with pgvector, and leverage object storage for scalable data management.
15
15
16
16
<Macroid="requirements" />
17
17
@@ -65,7 +65,7 @@ By utilizing our managed inference services, managed databases, and object stora
65
65
66
66
### Set Up Managed Database
67
67
68
-
1. Connect to your PostgreSQL instance and install the pg_vector extension.
68
+
1. Connect to your PostgreSQL instance and install the pgvector extension, which is used for storing high-dimensional embeddings.
69
69
70
70
```python
71
71
conn = psycopg2.connect(
@@ -89,3 +89,75 @@ By utilizing our managed inference services, managed databases, and object stora
89
89
conn.commit()
90
90
```
91
91
92
+
### Set Up Document Loaders for Object Storage
93
+
94
+
```python
95
+
document_loader = S3DirectoryLoader(
96
+
bucket=os.getenv('SCW_BUCKET_NAME'),
97
+
endpoint_url=os.getenv('SCW_BUCKET_ENDPOINT'),
98
+
aws_access_key_id=os.getenv("SCW_ACCESS_KEY"),
99
+
aws_secret_access_key=os.getenv("SCW_SECRET_KEY")
100
+
)
101
+
102
+
```
103
+
104
+
### Embeddings and Vector Store Setup
105
+
106
+
We will utilize the OpenAIEmbeddings class from LangChain and store the embeddings in PostgreSQL using the PGVector integration.
0 commit comments