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: content/learning-paths/servers-and-cloud-computing/milvus-rag/_index.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1
---
2
-
title: Use Milvus/Zilliz to build RAGon Arm Architecture
2
+
title: Build a Retrieval-Augmented Generation (RAG) application using Zilliz Cloud on Arm servers
3
3
4
4
minutes_to_complete: 20
5
5
6
-
who_is_this_for: This is an introductory topic for engineers who want to create a RAG application on Arm machines.
6
+
who_is_this_for: This is an introductory topic for software developers who want to create a RAG application on Arm servers.
7
7
8
8
learning_objectives:
9
-
- Create a simple RAG application using Milvus/Zilliz
10
-
- Launch LLM service on Arm machines
9
+
- Create a simple RAG application using Zilliz Cloud
10
+
- Launch a LLM service on Arm servers
11
11
12
12
prerequisites:
13
-
- Basic understand of RAG pipeline.
14
-
- An [AWS account](/learning-paths/servers-and-cloud-computing/csp/aws/) to access instance types with different AWS Graviton processors.
15
-
- A [Zilliz account](https://zilliz.com/cloud), which you can sign up for a free trial.
13
+
- Basic understanding of a RAG pipeline.
14
+
- An AWS Graviton3 c7g.2xlarge instance, or any [Arm based instance](/learning-paths/servers-and-cloud-computing/csp) from a cloud service provider or an on-premise Arm server.
15
+
- A [Zilliz account](https://zilliz.com/cloud), which you can sign up for with a free trial.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/milvus-rag/_next-steps.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
next_step_guidance: Thank you for completing the Milvus RAG tutorial.
2
+
next_step_guidance: Thank you for completing the RAG with Zilliz Cloud Learning Path. You might be interested in learning how to run the Llama 3.1 8B model with KleidiAI optimizations on Arm servers.
This will output a new file, `dolphin-2.9.4-llama3.1-8b-Q4_0_8_8.gguf`, which contains reconfigured weights that allow `llama-cli` to use SVE 256 and MATMUL_INT8 support.
79
79
80
-
> This requantization is optimal specifically for Graviton3. For Graviton2, the optimal requantization should be performed in the `Q4_0_4_4` format, and for Graviton4, the `Q4_0_4_8` format is the most suitable for requantization.
80
+
This requantization is optimal specifically for Graviton3. For Graviton2, the optimal requantization should be performed in the `Q4_0_4_4` format, and for Graviton4, the `Q4_0_4_8` format is the most suitable for requantization.
81
81
82
-
### Start the LLM Service
83
-
You can utilize the llama.cpp server program and send requests via an OpenAI-compatible API. This allows you to develop applications that interact with the LLM multiple times without having to repeatedly start and stop it. Additionally, you can access the server from another machine where the LLM is hosted over the network.
82
+
### Start the LLM Server
83
+
You can utilize the `llama.cpp` server program and send requests via an OpenAI-compatible API. This allows you to develop applications that interact with the LLM multiple times without having to repeatedly start and stop it. Additionally, you can access the server from another machine where the LLM is hosted over the network.
84
84
85
85
Start the server from the command line, and it listens on port 8080:
'main: server is listening on 127.0.0.1:8080 - starting the main loop
92
95
```
93
96
94
97
You can also adjust the parameters of the launched LLM to adapt it to your server hardware to obtain ideal performance. For more parameter information, see the `llama-server --help` command.
95
98
96
-
If you struggle to perform this step, you can refer to the [this documents](https://learn.arm.com/learning-paths/servers-and-cloud-computing/llama-cpu/llama-chatbot/) for more information.
97
-
98
-
You have started the LLM service on your Arm-based CPU. Next, we directly interact with the service using the OpenAI SDK.
99
+
You have started the LLM service on your AWS Graviton instance with an Arm-based CPU. In the next section, you will directly interact with the service using the OpenAI SDK.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/milvus-rag/offline_data_loading.md
+52-22Lines changed: 52 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,45 +6,66 @@ weight: 3
6
6
layout: learningpathall
7
7
---
8
8
9
-
In this section, we will show you how to load private knowledge in our RAG.
9
+
In this section, you will learn how to setup a cluster on Zilliz Cloud. You will then learn how to load your private knowledge database into the cluster.
10
+
11
+
### Create a dedicated cluster
12
+
13
+
You will need to [register](https://docs.zilliz.com/docs/register-with-zilliz-cloud) for a free account on Zilliz Cloud.
14
+
15
+
After you register, [create a cluster](https://docs.zilliz.com/docs/create-cluster) on Zilliz Cloud. In this Learning Path, you will create a dedicated cluster deployed in AWS using Arm-based machines to store and retreive the vector data as shown:
16
+
17
+

18
+
19
+
When you select the `Create Cluster` Button, you should see the cluster running in your Default Project.
20
+
21
+

22
+
23
+
{{% notice Note %}}
24
+
You can use self-hosted Milvus as an alternative to Zilliz Cloud. This option is more complicated to set up. We can also deploy [Milvus Standalone](https://milvus.io/docs/install_standalone-docker-compose.md) and [Kubernetes](https://milvus.io/docs/install_cluster-milvusoperator.md) on Arm-based machines. For more information about Milvus installation, please refer to the [installation documentation](https://milvus.io/docs/install-overview.md).
25
+
{{% /notice %}}
10
26
11
27
### Create the Collection
12
-
We use [Zilliz Cloud](https://zilliz.com/cloud) deployed on AWS with Arm-based machines to store and retrieve the vector data. To quick start, simply [register an account](https://docs.zilliz.com/docs/register-with-zilliz-cloud) on Zilliz Cloud for free.
13
28
14
-
> In addition to Zilliz Cloud, self-hosted Milvus is also a (more complicated to set up) option. We can also deploy [Milvus Standalone](https://milvus.io/docs/install_standalone-docker-compose.md) and [Kubernetes](https://milvus.io/docs/install_cluster-milvusoperator.md) on ARM-based machines. For more information about Milvus installation, please refer to the [installation documentation](https://milvus.io/docs/install-overview.md).
29
+
With the dedicated cluster running in Zilliz Cloud, you are now ready to create a collection in your cluster.
30
+
31
+
Within your activated python `venv`, start by creating a file named `zilliz-llm-rag.py` and copy the contents below into it:
15
32
16
-
We set the `uri` and `token` as the [Public Endpoint and Api key](https://docs.zilliz.com/docs/on-zilliz-cloud-console#free-cluster-details) in Zilliz Cloud.
Check if the collection already exists and drop it if it does.
41
+
Replace <your_zilliz_public_endpoint> and <yourzilliz_api_key> with the `URI` and `Token` for your running cluster. Refer to [Public Endpoint and Api key](https://docs.zilliz.com/docs/on-zilliz-cloud-console#free-cluster-details) in Zilliz Cloud for more details.
42
+
43
+
Now, append the following code to `zilliz-llm-rag.py` and save the contents:
44
+
28
45
```python
46
+
collection_name ="my_rag_collection"
47
+
embedding_dim ="384"
48
+
29
49
if milvus_client.has_collection(collection_name):
30
50
milvus_client.drop_collection(collection_name)
31
-
```
32
-
Create a new collection with specified parameters.
33
51
34
-
If we don't specify any field information, Milvus will automatically create a default `id` field for primary key, and a `vector` field to store the vector data. A reserved JSON field is used to store non-schema-defined fields and their values.
We use inner product distance as the default metric type. For more information about distance types, you can refer to [Similarity Metrics page](https://milvus.io/docs/metric.md?tab=floating)
59
+
This code checks if a collection already exists and drops it if it does. You then, create a new collection with the specified parameters.
60
+
61
+
If you don't specify any field information, Milvus will automatically create a default `id` field for primary key, and a `vector` field to store the vector data. A reserved JSON field is used to store non-schema-defined fields and their values.
62
+
You will use inner product distance as the default metric type. For more information about distance types, you can refer to [Similarity Metrics page](https://milvus.io/docs/metric.md?tab=floating)
63
+
64
+
You can now prepare the data to use in this collection.
44
65
45
66
### Prepare the data
46
67
47
-
We use the FAQ pages from the [Milvus Documentation 2.4.x](https://github.com/milvus-io/milvus-docs/releases/download/v2.4.6-preview/milvus_docs_2.4.x_en.zip) as the private knowledge in our RAG, which is a good data source for a simple RAG pipeline.
68
+
In this example, you will use the FAQ pages from the [Milvus Documentation 2.4.x](https://github.com/milvus-io/milvus-docs/releases/download/v2.4.6-preview/milvus_docs_2.4.x_en.zip) as the private knowledge that is loaded in your RAG dataset/collection.
48
69
49
70
Download the zip file and extract documents to the folder `milvus_docs`.
We load all markdown files from the folder `milvus_docs/en/faq`. For each document, we just simply use "# " to separate the content in the file, which can roughly separate the content of each main part of the markdown file.
77
+
You will load all the markdown files from the folder `milvus_docs/en/faq` into your data collection. For each document, use "# " to separate the content in the file, which can roughly separate the content of each main part of the markdown file.
57
78
79
+
Open `zilliz-llm-rag.py` and append the following code to it:
58
80
59
81
```python
60
82
from glob import glob
@@ -69,17 +91,17 @@ for file_path in glob("milvus_docs/en/faq/*.md", recursive=True):
69
91
```
70
92
71
93
### Insert data
72
-
We prepare a simple but efficient embedding model [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) that can convert text into embedding vectors.
94
+
You will now prepare a simple but efficient embedding model [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) that can convert the loaded text into embedding vectors.
95
+
96
+
You will iterate through the text lines, create embeddings, and then insert the data into Milvus.
97
+
98
+
Append and save the code shown below into `zilliz-llm-rag.py`:
99
+
73
100
```python
74
101
from langchain_huggingface import HuggingFaceEmbeddings
Iterate through the text lines, create embeddings, and then insert the data into Milvus.
80
-
81
-
Here is a new field `text`, which is a non-defined field in the collection schema. It will be automatically added to the reserved JSON dynamic field, which can be treated as a normal field at a high level.
82
-
```python
83
105
from tqdm import tqdm
84
106
85
107
data = []
@@ -93,6 +115,14 @@ for i, (line, embedding) in enumerate(
0 commit comments