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/index.mdx
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ In this comprehensive guide, you will learn how to implement RAG using LangChain
17
17
LangChain simplifies the process of enhancing language models with retrieval capabilities, allowing developers to build scalable, intelligent applications that access external datasets effortlessly. By leveraging LangChain’s modular design and Scaleway’s cloud services, you can unlock the full potential of Retrieval-Augmented Generation.
18
18
19
19
## What you will learn
20
-
- How to embed text using a sentence transformer using***Scaleway Manage Inference***
20
+
- How to embed text using a sentence transformer with***Scaleway Manage Inference***
21
21
- How to store and query embeddings using ***Scaleway’s Managed PostgreSQL Database*** with pgvector
22
22
- How to manage large datasets efficiently with ***Scaleway Object Storage***
23
23
@@ -26,10 +26,10 @@ LangChain simplifies the process of enhancing language models with retrieval cap
26
26
- A Scaleway account logged into the [console](https://console.scaleway.com)
27
27
-[Owner](/identity-and-access-management/iam/concepts/#owner) status or [IAM permissions](/identity-and-access-management/iam/concepts/#permission) allowing you to perform actions in the intended Organization
28
28
- A valid [API key](/identity-and-access-management/iam/how-to/create-api-keys/)
29
-
-[Inference Deployment](/ai-data/managed-inference/how-to/create-deployment/): Set up an inference deployment using [sentence-transformers/sentence-t5-xxl](/ai-data/managed-inference/reference-content/sentence-t5-xxl/) on an L4 instance to efficiently process embeddings.
30
-
-[Inference Deployment](/ai-data/managed-inference/how-to/create-deployment/) with the large language model of your choice.
31
-
-[Object Storage Bucket](/storage/object/how-to/create-a-bucket/) to store all the data you want to inject into your LLM model.
32
-
-[Managed Database](/managed-databases/postgresql-and-mysql/how-to/create-a-database/) to securely store all your embeddings.
29
+
-An [Inference Deployment](/ai-data/managed-inference/how-to/create-deployment/): set it up using [sentence-transformers/sentence-t5-xxl](/ai-data/managed-inference/reference-content/sentence-t5-xxl/) on an L4 instance to efficiently process embeddings.
30
+
-An [Inference Deployment](/ai-data/managed-inference/how-to/create-deployment/) with the large language model of your choice.
31
+
-An [Object Storage Bucket](/storage/object/how-to/create-a-bucket/) to store all the data you want to inject into your LLM model.
32
+
-A [Managed Database](/managed-databases/postgresql-and-mysql/how-to/create-a-database/) to securely store all your embeddings.
33
33
34
34
## Configure your development environment
35
35
@@ -311,7 +311,7 @@ for r in rag_chain.stream("Your question"):
311
311
312
312
- Query execution: Finally, we stream the output of the RAG chain for a specified question, printing each response with a slight delay for better readability.
313
313
314
-
### Query the RAG system with you own prompt template
314
+
### Query the RAG system with your own prompt template
315
315
316
316
Personalizing your prompt template allows you to tailor the responses from your RAG (Retrieval-Augmented Generation) system to better fit your specific needs. This can significantly improve the relevance and tone of the answers you receive. Below is a detailed guide on how to create a custom prompt for querying the system.
317
317
@@ -327,7 +327,7 @@ llm = ChatOpenAI(
327
327
api_key=os.getenv("SCW_SECRET_KEY"),
328
328
model=deployment.model_name,
329
329
)
330
-
prompt ="""Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. Always finish your answer by "Thank you for asking". {context} Question: {question} Helpful Answer:"""
330
+
prompt ="""Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. Always finish your answer with "Thank you for asking". {context} Question: {question} Helpful Answer:"""
@@ -362,6 +362,6 @@ In this tutorial, we explored essential techniques for efficiently processing an
362
362
363
363
Furthermore, you can continually enhance your RAG system by implementing mechanisms to retain chat history. Keeping track of past interactions allows for more contextually aware responses, fostering a more engaging user experience. This historical data can be used to refine your prompts, adapt to user preferences, and improve the overall accuracy of responses.
364
364
365
-
By integrating Scaleway’s Managed Object Storage, PostgreSQL with pgvector, and LangChain’s embedding tools, you have the foundation to build a powerful RAG system that scales with your data while offering robust information retrieval capabilities. This approach equips you with the tools necessary to handle complex queries and deliver accurate, relevant results efficiently.
365
+
By integrating ScalewayObject Storage, Managed Database for PostgreSQL with pgvector, and LangChain’s embedding tools, you have the foundation to build a powerful RAG system that scales with your data while offering robust information retrieval capabilities. This approach equips you with the tools necessary to handle complex queries and deliver accurate, relevant results efficiently.
366
366
367
367
With ongoing refinement and adaptation, your RAG system can evolve to meet the changing needs of your users, ensuring that it remains a valuable asset in your AI toolkit.
0 commit comments