跳到主要內容

AwaDB

AwaDB 是一個 AI 原生資料庫,用於搜尋和儲存 LLM 應用程式使用的嵌入向量。

此筆記本說明如何在 LangChain 中使用 AwaEmbeddings

# pip install awadb

導入庫 (import the library)

from langchain_community.embeddings import AwaEmbeddings
API 參考:AwaEmbeddings
Embedding = AwaEmbeddings()

設定嵌入模型 (Set embedding model)

使用者可以使用 Embedding.set_model() 來指定嵌入模型。
此函數的輸入是代表模型名稱的字串。
目前支援的模型列表可以在這裡找到。

預設模型all-mpnet-base-v2,無需設定即可使用。

text = "our embedding test"

Embedding.set_model("all-mpnet-base-v2")
res_query = Embedding.embed_query("The test information")
res_document = Embedding.embed_documents(["test1", "another test"])

此頁面是否有幫助? (Was this page helpful?)