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
Copy file name to clipboardExpand all lines: tutorials/how-to-implement-rag-generativeapis/index.mdx
+2-15Lines changed: 2 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,11 +95,9 @@ In this tutorial, you will learn how to implement RAG using LangChain, a leading
95
95
96
96
### Configure embeddings client
97
97
98
-
4.Configure[OpenAIEmbeddings](https://api.python.langchain.com/en/latest/embeddings/langchain_openai.embeddings.base.OpenAIEmbeddings.html) class from LangChain to use your API Secret Key, Generative APIs Endpoint URL and a supported model (`bge-multilingual-gemma2` in our example).
98
+
4.Edit `embed.py` to configure[OpenAIEmbeddings](https://api.python.langchain.com/en/latest/embeddings/langchain_openai.embeddings.base.OpenAIEmbeddings.html) class from LangChain to use your API Secret Key, Generative APIs Endpoint URL and a supported model (`bge-multilingual-gemma2` in our example).
@@ -135,8 +131,6 @@ Then, we will embed them as vectors and store these vectors in your PostgreSQL d
135
131
7. Edit the beginning of `embed.py` to import `S3DirectoryLoader` and `RecursiveCharacterTextSplitter`:
136
132
137
133
```python
138
-
#embed.py
139
-
140
134
from langchain_community.document_loaders import S3DirectoryLoader
141
135
from langchain.text_splitter import RecursiveCharacterTextSplitter
142
136
@@ -147,8 +141,6 @@ Then, we will embed them as vectors and store these vectors in your PostgreSQL d
147
141
8. Edit `embed.py` to list objects:
148
142
149
143
```python
150
-
# embed.py
151
-
152
144
session = boto3.session.Session()
153
145
client_s3 = session.client(
154
146
service_name='s3',
@@ -165,8 +157,6 @@ Then, we will embed them as vectors and store these vectors in your PostgreSQL d
165
157
9. Edit `embed.py` to load all files in your bucket using `S3DirectoryLoader`, split them into chunks of 500 characters using `RecursiveCharacterTextSplitter` and embed them and store them into your PostgreSQL database using `PGVector`.
0 commit comments