Python
使用 LangChain Python 集成 Gpt4all 嵌入模型。
pip install -qU gpt4all > /dev/null
from langchain_community.embeddings import GPT4AllEmbeddings
gpt4all_embd = GPT4AllEmbeddings()
Model downloaded at: /Users/rlm/.cache/gpt4all/ggml-all-MiniLM-L6-v2-f16.bin
text = "This is a test document."
query_result = gpt4all_embd.embed_query(text)
doc_result = gpt4all_embd.embed_documents([text])