调整语言基础模型(生成式 AI)

使用调优数据集对语言基础模型进行调优。

代码示例

Node.js

在尝试此示例之前,请按照《Vertex AI 快速入门:使用客户端库》中的 Node.js 设置说明执行操作。 如需了解详情,请参阅 Vertex AI Node.js API 参考文档

如需向 Vertex AI 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证

/**
 * TODO(developer): Uncomment these variables before running the sample.\
 * (Not necessary if passing values as arguments)
 */
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
// const model = 'text-bison@001';
const aiplatform = require('@google-cloud/aiplatform');

const {ModelServiceClient} = aiplatform.v1;
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiate the service client.
const modelServiceClient = new ModelServiceClient(clientOptions);

async function listTunedModels() {
  // Configure the parent resource
  const parent = `projects/${project}/locations/${location}`;
  const filter = `labels.google-vertex-llm-tuning-base-model-id=${model}`;

  const request = {
    parent,
    filter,
  };

  const [response] = await modelServiceClient.listModels(request);
  console.log('List Tuned Models response');
  for (const model of response) {
    console.log(`\tModel name: ${model.name}`);
    console.log(`\tDisplay name: ${model.displayName}`);
  }
}
await listTunedModels();

后续步骤

如需搜索和过滤其他 Google Cloud 产品的代码示例,请参阅 Google Cloud 示例浏览器