iT邦幫忙

2024 iThome 鐵人賽

DAY 23
0

前言

昨天我們介紹了AWS Bedrock Knowledge Bases和Azrue AI Search,這些都有提供將文件轉乘向量的功能,但是其實也有不轉成向量,單純用非結構文件的方式進行關鍵字搜尋的服務,也能和LangChain串接。

正文

AWS Kendra

https://aws.amazon.com/tw/kendra/
https://ithelp.ithome.com.tw/upload/images/20240922/20168697H09nmAxChG.png
透過連接器,可以是AWS的或是其他第三方的資料源整合進Kendra內
https://ithelp.ithome.com.tw/upload/images/20240922/201686976hlrx7W2hP.png
連接器的種類https://aws.amazon.com/tw/kendra/connectors/
https://ithelp.ithome.com.tw/upload/images/20240922/20168697spcii6vYJX.png
在LangChain的串接上,只需要提供ID即可
https://python.langchain.com/v0.2/docs/integrations/retrievers/amazon_kendra_retriever/

rom langchain_community.retrievers import AmazonKendraRetriever
retriever = AmazonKendraRetriever(index_id="")

AWS官方的Kendra結合LangChain應用

https://aws.amazon.com/cn/blogs/china/quickly-build-high-accuracy-generative-ai-applications-on-enterprise-data-using-amazon-kendra-langchain-and-large-language-models/
這個文章有大量說明和結構圖如下
https://ithelp.ithome.com.tw/upload/images/20240922/20168697wXpjjlTtSi.png
https://ithelp.ithome.com.tw/upload/images/20240922/201686974riNaXMx5S.png

Vertex AI Agent Builder (Vertex AI Search )

其實我在查看文件時,很容易看見這兩個名子,目前推測這兩個名子可能是同個服務?
https://cloud.google.com/products/agent-builder?hl=zh-cn
https://ithelp.ithome.com.tw/upload/images/20240922/20168697DXIt0fjw3B.png
在使用上我們會針對資料儲存庫和應用程式去進行使用
https://ithelp.ithome.com.tw/upload/images/20240922/20168697aVvn9DZPk2.png
資料來源的種類
https://ithelp.ithome.com.tw/upload/images/20240922/2016869793fD6EmhZs.png
https://ithelp.ithome.com.tw/upload/images/20240922/20168697OAswn7aXgB.png
langChain串接上,主要說明SEARCH_ENGINE_ID、DATA_STORE_ID

from langchain_google_community import (
    VertexAIMultiTurnSearchRetriever,
    VertexAISearchRetriever,
)

PROJECT_ID = "<YOUR PROJECT ID>"  # Set to your Project ID
LOCATION_ID = "<YOUR LOCATION>"  # Set to your data store location
SEARCH_ENGINE_ID = "<YOUR SEARCH APP ID>"  # Set to your search app ID
DATA_STORE_ID = "<YOUR DATA STORE ID>"  # Set to your data store ID

retriever = VertexAISearchRetriever(
    project_id=PROJECT_ID,
    location_id=LOCATION_ID,
    data_store_id=DATA_STORE_ID,
    max_documents=3,
)

未來規劃

明天我們會針對AgentBuilder進行說明,上傳我們的文件上去,作為RAG資料來源


上一篇
day22 RAG加速資料檢索:雲端資料庫與雲端向量搜尋服務初探
下一篇
day24 探索 GCP Agent Builder Search:實現文件上傳與搜尋測試的智能搜尋體驗
系列文
智能雲端架構圖生成:結合LangChain&LangGrpah與Rag的創新應用27
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言