이제 실제 pdf 파일을 기반으로 AI가 답변하는 완전한 로컬 RAG(Retrieval-Augmented Generation) 파이프라인의 전체 소스 코드를 작성해보겠습니다.
코드를 작성하기 전에 Qwen을 실행하여 ‘Roborock Qrevo Curv 2 Flow’ 모델의 로봇청소기와 관련된 질문을 하겠습니다. 해당 로봇 청소기는 신제품이라 Qwen3 모델에 학습은 되지 않았을 겁니다.
% ollama run qwen3:8b
>>> 'Roborock Qrevo Curv 2 Flow' 제품에서 롤러가 하는 역할은?
Thinking...
Okay, I need to explain the role of the roller in the Roborock Qrevo Curv 2 Flow. Let me start by recalling what I know about
Roborock products. They're robotic vacuum cleaners, right? The Qrevo Curv 2 Flow is a specific model. Now, the user is asking
about the roller's role.
First, I should think about the typical components of a robotic vacuum. There's the main brush, which is usually a rotating brush
that helps pick up hair and debris. But the user mentioned a roller. Wait, sometimes "roller" might refer to the main brush, but
maybe in this model, they have a different design.
Wait, the Qrevo Curv 2 Flow is a model that uses a "Curv" design, which I think refers to the shape of the robot. But the
roller... Maybe it's a separate component? Or perhaps the user is referring to the main brush as the roller. Let me check.
In some robotic vacuums, there's a main brush that rotates to agitate the floor and pick up debris. The roller could be part of
the main brush assembly. Alternatively, maybe there's a separate roller for something else. Wait, the Qrevo Curv 2 Flow is a
model that uses a "Flow" system, which might relate to air flow or water flow. But the user is asking about the roller.
Wait, maybe the user is confusing terms. In some contexts, "roller" could refer to a rotating part that helps in suction.
Alternatively, maybe it's a part of the cleaning mechanism. Let me think about the Qrevo Curv 2 Flow's features.
I remember that Roborock's Qrevo series uses a main brush that rotates to help lift debris. The roller might be part of that main
brush. So the role of the roller (main brush) would be to agitate the floor, loosen dirt, and push it into the suction area.
Alternatively, could there be a separate roller for something else? Maybe not. Since the user is asking specifically about the
roller, I should focus on the main brush.
So, the main answer would be that the roller (main brush) helps in agitating the floor, lifting debris, and pushing it into the
suction area to enhance cleaning efficiency. But I need to make sure this is accurate for the Qrevo Curv 2 Flow.
Wait, maybe there's a specific feature in this model. The Qrevo Curv 2 Flow has a "Curv" design which allows it to clean under
furniture. The roller might be part of the main brush that helps in cleaning different floor types.
Alternatively, maybe the roller is part of the dustbin system? No, that's more likely the dustbin.
I think the key point is that the roller (main brush) is responsible for agitating the floor, lifting dirt, and pushing it into
the suction path. This is a standard function in robotic vacuums. So the answer should explain that role, and maybe mention how
it contributes to the overall cleaning efficiency, especially in the Qrevo Curv 2 Flow model.
...done thinking.
Roborock Qrevo Curv 2 Flow의 **롤러**(주 모터 브러시)는 청소 효율을 극대화하기 위해 설계된 핵심 부품입니다. 이 롤러의 주요 역할은
다음과 같습니다:
### 1. **바닥 표면의 먼지 및 쓰레기를 집어 올리기**
- 롤러는 회전하면서 바닥 표면을 마찰시켜 **진드기, 털, 미세 먼지** 등을 흡입구로 끌어들입니다. 특히 **카펫, 천연 섬유, 매트** 같
은 표면에서 효과적입니다.
### 2. **흡입 효율 향상**
- 롤러가 바닥을 진동시켜 쌓인 먼지를 **분산**하고, 흡입구로 더 잘 집어 올릴 수 있도록 합니다. 이는 **흡입력의 효율성**을 높여 전
체 청소 성능을 개선합니다.
### 3. **다양한 바닥 유형에 적응**
- Qrevo Curv 2 Flow는 **경사 바닥, 높은 가구 밑, 복잡한 구조**에서도 청소를 수행할 수 있습니다. 롤러는 이러한 환경에서도 **진동
과 회전**을 통해 먼지를 효과적으로 제거합니다.
### 4. **청소 잔류물 제거**
- 롤러는 흡입 후 남은 먼지를 **바닥 표면에 남기지 않도록** 청소하여, **반복적이고 깨끗한 청소**를 가능하게 합니다.
### 5. **Qrevo Curv 2 Flow의 특징과 연계**
- 이 모델은 **Curv 디자인**으로 높은 가구 밑까지 접근 가능하며, 롤러는 이러한 구조에서 **모든 구석의 먼지를 집어 올리는 데 기여
**합니다. 또한, **Flow 시스템**과 연계해 **흡입력과 청소 효율**을 극대화합니다.
### 요약
롤러는 Roborock Qrevo Curv 2 Flow의 **핵심 청소 메커니즘**으로, 바닥 표면의 먼지를 집어 올리고 흡입 효율을 높이는 역할을 합니다. 이
는 다양한 바닥 유형과 복잡한 환경에서도 **정교하고 완전한 청소**를 가능하게 하는 중요한 요소입니다.
>>> Send a message (/? for help)
이제 아래 파이썬 코드를 실행하여 ‘Roborock Qrevo Curv 2 Flow’ 제품 설명서 PDF 파일을 입력하고 결과를 보겠습니다.
제품 설명서 : https://gl-files.roborock.com/product/center/images/v69660e28ac3eb.pdf
그 과정은 아래와 같이 이루어질 것입니다.
[원시 데이터] -> (1) 로드 -> (2) 분할 -> (3) 벡터화 -> (4) 저장 -> [벡터 DB]
(1) 데이터 로드 (Load): PDF, 웹페이지, DB 등에서 텍스트를 긁어옵니다. (코드의 raw_documents)
(2) 텍스트 분할 (Split): 긴 글을 AI가 읽기 좋은 작은 조각으로 쪼갭니다. (코드의 CharacterTextSplitter)
(3) 텍스트 벡터화 (Embedding): 쪼갠 문장을 임베딩 모델을 통해 숫자로 바꿉니다. (코드의 OllamaEmbeddings)
(4) 저장 (Store): 벡터화된 데이터를 검색이 가능한 데이터베이스에 넣습니다. (코드의 Chroma.from_documents)
from langchain_ollama import OllamaLLM
from langchain_ollama import OllamaEmbeddings
from langchain_chroma import Chroma
from langchain_text_splitters import CharacterTextSplitter
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import RunnablePassthrough
from langchain_core.output_parsers import StrOutputParser
from langchain_community.document_loaders import PyPDFLoader
# 1. 백엔드 AI 엔진 설정
llm = OllamaLLM(model="qwen3:8b")
embeddings = OllamaEmbeddings(model="bge-m3")
# 2. PDF 읽어오기
loader = PyPDFLoader("qrevo.pdf")
raw_documents = loader.load()
# 3. 텍스트 쪼개기 및 벡터 DB 저장
# chunk_size: 글자를 몇 자 단위로 쪼갤지, chunk_overlap: 쪼갤 때 앞뒤 문맥을 얼마나 겹치게 할지
text_splitter = CharacterTextSplitter(chunk_size=500, chunk_overlap=100)
docs = text_splitter.split_documents(raw_documents)
db = Chroma.from_documents(docs, embeddings)
retriever = db.as_retriever()
# 4. 프롬프트 템플릿 설정
template = """아래의 제공된 문맥(Context)만을 바탕으로 질문에 답하세요.
만약 답을 모른다면 모른다고 말하고, 답변을 지어내지 마세요.
Context:
{context}
Question: {question}
Answer:"""
prompt = ChatPromptTemplate.from_template(template)
# 5. LCEL 파이프라인 구성
rag_chain = (
{"context": retriever, "question": RunnablePassthrough()}
| prompt
| llm
| StrOutputParser()
)
# 6. 내가 넣은 파일에 있을 법한 내용 질문하기
query = input('질문을 입력하세요 : ')
response = rag_chain.invoke(query)
print("==== 진짜 RAG AI의 답변 ====")
print(response)
(venv) % python3 app.py
질문을 입력하세요 : 'Roborock Qrevo Curv 2 Flow' 제품에서 롤러가 하는 역할은?
==== 진짜 RAG AI의 답변 ====
제공된 문맥에 따르면 'Roborock Qrevo Curv 2 Flow' 제품에서 **롤러**(롤러 물걸레)는 **바닥을 닦는 주요 청소 부품**으로 작용합니다. 구체적으로는 다음과 같은 역할을 합니다:
1. **바닥 닦기**: 롤러 물걸레는 물과 청소제를 사용해 바닥을 닦는 데 사용되며, 사용 후 깨끗이 세척하고 건조시켜야 합니다.
2. **청소 효율성**: 롤러 물걸레는 바닥의 먼지와 흔적을 제거하고, 물을 흡수하여 청소 효율을 높이는 역할을 합니다.
3. **정기적인 관리**: 사용 후 세척하고 1~3개월마다 교체해야 하며, 오염된 경우 세척해야 합니다.
문맥에 명시된 내용을 바탕으로, 롤러는 **청소 기능을 수행하는 핵심 부품**으로 설명됩니다.
답글 남기기