Skip to main content

Google Cloud Platform Vertex AI PaLM

注意:这与谷歌 PaLM 集成是分开的,它在谷歌云上公开了 Vertex AI PaLM API

默认情况下,谷歌云 不使用 客户数据来训练其基础模型,作为谷歌云的 AI/ML 隐私承诺的一部分。有关谷歌如何处理数据的更多详细信息也可以在 谷歌的客户数据处理附加协议 (CDPA) 中找到。

要使用 Vertex AI PaLM,您必须安装 google-cloud-aiplatform Python 包,并满足以下条件之一:

  • 配置了您的环境的凭据(gcloud、工作负载标识等)
  • 将服务帐号 JSON 文件的路径存储为 GOOGLE_APPLICATION_CREDENTIALS 环境变量

此代码库使用 google.auth 库,该库首先查找上述应用凭据变量,然后查找系统级身份验证。

更多信息,请参见:

#!pip install google-cloud-aiplatform
from langchain.embeddings import VertexAIEmbeddings
embeddings = VertexAIEmbeddings()
text = "这是一个测试文档。"
query_result = embeddings.embed_query(text)
doc_result = embeddings.embed_documents([text])