Skip to content

Commit 681e2d9

Browse files
authored
fix(genapi): remove file redundant annotations in comments
1 parent 555e6fc commit 681e2d9

File tree

1 file changed

+2
-15
lines changed
  • tutorials/how-to-implement-rag-generativeapis

1 file changed

+2
-15
lines changed

tutorials/how-to-implement-rag-generativeapis/index.mdx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,9 @@ In this tutorial, you will learn how to implement RAG using LangChain, a leading
9595

9696
### Configure embeddings client
9797

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).
9999

100100
```python
101-
# embed.py
102-
103101
embeddings = OpenAIEmbeddings(
104102
openai_api_key=os.getenv("SCW_SECRET_KEY"),
105103
openai_api_base=os.getenv("SCW_GENERATIVE_APIs_ENDPOINT"),
@@ -110,11 +108,9 @@ embeddings = OpenAIEmbeddings(
110108

111109
### Configure vector store client
112110

113-
5. Configure connection to your Managed Database for PostgreSQL Instance storing vectors:
111+
5. Edit `embed.py` to configure connection to your Managed Database for PostgreSQL Instance storing vectors:
114112

115113
```python
116-
# embed.py
117-
118114
connection_string = f'postgresql+psycopg2://{os.getenv("SCW_DB_USER")}:{os.getenv("SCW_DB_PASSWORD")}@{os.getenv("SCW_DB_HOST")}:{os.getenv("SCW_DB_PORT")}/{os.getenv("SCW_DB_NAME")}'
119115
vector_store = PGVector(connection=connection_string, embeddings=embeddings)
120116
```
@@ -135,8 +131,6 @@ Then, we will embed them as vectors and store these vectors in your PostgreSQL d
135131
7. Edit the beginning of `embed.py` to import `S3DirectoryLoader` and `RecursiveCharacterTextSplitter`:
136132

137133
```python
138-
#embed.py
139-
140134
from langchain_community.document_loaders import S3DirectoryLoader
141135
from langchain.text_splitter import RecursiveCharacterTextSplitter
142136

@@ -147,8 +141,6 @@ Then, we will embed them as vectors and store these vectors in your PostgreSQL d
147141
8. Edit `embed.py` to list objects:
148142

149143
```python
150-
# embed.py
151-
152144
session = boto3.session.Session()
153145
client_s3 = session.client(
154146
service_name='s3',
@@ -165,8 +157,6 @@ Then, we will embed them as vectors and store these vectors in your PostgreSQL d
165157
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`.
166158

167159
```python
168-
# embed.py
169-
170160
text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=0, add_start_index=True, length_function=len, is_separator_regex=False)
171161
file_loader = S3DirectoryLoader(
172162
bucket=os.getenv("SCW_BUCKET_NAME", ""),
@@ -224,7 +214,6 @@ Then, we will embed them as vectors and store these vectors in your PostgreSQL d
224214
2. Edit `rag.py` to load `.env` file, and configure Embeddings format and Vector store:
225215

226216
```python
227-
228217
load_dotenv()
229218

230219
embeddings = OpenAIEmbeddings(
@@ -247,8 +236,6 @@ Then, we will embed them as vectors and store these vectors in your PostgreSQL d
247236
3. Edit `rag.py` to configure LLM client using `ChatOpenAI` and create a simple RAG pipeline:
248237

249238
```python
250-
#rag.py
251-
252239
llm = ChatOpenAI(
253240
base_url=os.getenv("SCW_GENERATIVE_APIs_ENDPOINT"),
254241
api_key=os.getenv("SCW_SECRET_KEY"),

0 commit comments

Comments
 (0)