Load Model và test giải pháp (tiếp tục)
Thông tin này chứa trong bộ results, và bạn sẽ sử dụng nó để tạo prompt.
Prompt sẽ chứa 2 phần:
+ Bối cảnh: Đây là nơi bạn sẽ cung cấp thông tin cái model cần để xem xét ngoài cái gì nó đã biết. Trong trường hợp
này, nó sẽ là kết quả giành từ truy vấn tới CSDL.
+ Câu hỏi người dùng: Đây là phần nơi người dùng có thể nhập vào câu hỏi cụ thể của họ hay truy vấn.
Xây dựng prompt là đơn giản như móc xích cùng với nhau các textx để kết thúc với prompt mong muốn.
question = “Can I buy a new Toshiba laptop?”
context = ” “.join([f”#{str(i)}” for i in results[“documents”][0]])
#context = context[0:5120]
prompt_template = f”””
Relevant context: {context}
Considering the relevant context, answer the question.
Question: {question}
Answer: “””
prompt_template
Relevant context: #The Legendary Toshiba is Officially Done With Making Laptops #3 gaming laptop deals you can’t afford to miss today #Lenovo and HP control half of the global laptop market #Asus ROG Zephyrus G14 gaming laptop announced in India #Acer Swift 3 featuring a 10th-generation Intel Ice Lake CPU, 2K screen, and more launched in India for INR 64999 (US$865) #Apple’s Next MacBook Could Be the Cheapest in Company’s History #Features of Huawei’s Desktop Computer Revealed #Redmi to launch its first gaming laptop on August 14: Here are all the details #Toshiba shuts the lid on laptops after 35 years #This is the cheapest Windows PC by a mile and it even has a spare SSD slot
Considering the relevant context, answer the question.
Question: Can I buy a new Toshiba laptop?
Answer:
Như bạn có thể thấy, mọi thứ hoàn toàn theo đường thẳng! Không có các bí mật. Bạn đơn giản thông báo model
“Consider this context that I’m providing, followed by a line break, and the user’s question is this one.”
Từ đây trở đi, model đảm nhận và làm tất cả công việc biên dịch prompt và tạo sinh một trả lời đúng.
Để giành trả lời, tất cả việc bạn cần làm là gọi dòng ống tạo trước và truyền nó prompt tạo gần đây.
lm_response = pipe(prompt_template)
print(lm_response[0][“generated_text”])
Relevant context: #The Legendary Toshiba is Officially Done With Making Laptops #3 gaming laptop deals you can’t afford to miss today #Lenovo and HP control half of the global laptop market #Asus ROG Zephyrus G14 gaming laptop announced in India #Acer Swift 3 featuring a 10th-generation Intel Ice Lake CPU, 2K screen, and more launched in India for INR 64999 (US$865) #Apple’s Next MacBook Could Be the Cheapest in Company’s History #Features of Huawei’s Desktop Computer Revealed #Redmi to launch its first gaming laptop on August 14: Here are all the details #Toshiba shuts the lid on laptops after 35 years #This is the cheapest Windows PC by a mile and it even has a spare SSD slot
Considering the relevant context, answer the question.
Question: Can I buy a new Toshiba laptop?
Answer:
Based on the given material, the answer to the question is no. Toshiba has discontinued making laptops.
Bạn đã nhận một trả lời từ một LLM sử dụng một hệ thống RAG, và nó là bằng chứng như thế nào trả lời bị ảnh hưởng
bởi thông tin thu thập từ CSDl vector hóa.
