查看架构定义

您可以查看包含支持架构的数据的任何数据存储区的架构,例如结构化数据包含结构化数据的网站数据包含结构化数据的非结构化数据

您可以在 Google Cloud 控制台中或使用 dataStores.schemas.get API 方法查看架构。仅通过 REST API 支持查看网站的架构。

控制台

如需在 Google Cloud 控制台中查看架构,请按以下步骤操作。

  1. 如果您查看的是自动生成的架构,请确保您已完成数据注入。否则,该架构可能尚未推出。

  2. 在 Google Cloud 控制台中,前往 Agent Builder 页面。

    Agent Builder

  3. 在导航菜单中,点击数据存储区

  4. 名称列中,点击包含要查看的架构的数据存储区。

  5. 点击 Schema 标签页可查看数据的架构。

REST

如需使用该 API 获取架构的定义,请按以下步骤操作:

  1. 如果您查看的是自动生成的架构,请确保您已完成数据注入。否则,该架构可能尚未推出。

    如需查看包含网站数据或包含元数据的非结构化数据的数据存储区的架构,请跳至第 3 步以调用 schema.get 方法。

  2. 找到您的数据存储区 ID。如果您已拥有数据存储区 ID,请跳至下一步。

    1. 在 Google Cloud 控制台中,前往 Agent Builder 页面,然后在导航菜单中点击数据存储区

      前往“数据存储区”页面

    2. 点击您的数据存储区的名称。

    3. 在数据存储区的数据页面上,获取数据存储区 ID。

  3. 使用 schemas.get API 方法获取架构定义。

    curl -X GET \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    "https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID/locations/global/collections/default_collection/dataStores/DATA_STORE_ID/schemas/default_schema"
    
    • PROJECT_ID:您的项目的 ID。
    • DATA_STORE_ID:数据存储区的 ID。

C#

如需了解详情,请参阅 Vertex AI Agent Builder C# API 参考文档

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

using Google.Cloud.DiscoveryEngine.V1;

public sealed partial class GeneratedSchemaServiceClientSnippets
{
    /// <summary>Snippet for GetSchema</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void GetSchemaRequestObject()
    {
        // Create client
        SchemaServiceClient schemaServiceClient = SchemaServiceClient.Create();
        // Initialize request argument(s)
        GetSchemaRequest request = new GetSchemaRequest
        {
            SchemaName = SchemaName.FromProjectLocationDataStoreSchema("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SCHEMA]"),
        };
        // Make the request
        Schema response = schemaServiceClient.GetSchema(request);
    }
}

Go

如需了解详情,请参阅 Vertex AI Agent Builder Go API 参考文档

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


package main

import (
	"context"

	discoveryengine "cloud.google.com/go/discoveryengine/apiv1"
	discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := discoveryengine.NewSchemaClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &discoveryenginepb.GetSchemaRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb#GetSchemaRequest.
	}
	resp, err := c.GetSchema(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

如需了解详情,请参阅 Vertex AI Agent Builder Java API 参考文档

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

import com.google.cloud.discoveryengine.v1.GetSchemaRequest;
import com.google.cloud.discoveryengine.v1.Schema;
import com.google.cloud.discoveryengine.v1.SchemaName;
import com.google.cloud.discoveryengine.v1.SchemaServiceClient;

public class SyncGetSchema {

  public static void main(String[] args) throws Exception {
    syncGetSchema();
  }

  public static void syncGetSchema() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
      GetSchemaRequest request =
          GetSchemaRequest.newBuilder()
              .setName(
                  SchemaName.ofProjectLocationDataStoreSchemaName(
                          "[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SCHEMA]")
                      .toString())
              .build();
      Schema response = schemaServiceClient.getSchema(request);
    }
  }
}

Python

如需了解详情,请参阅 Vertex AI Agent Builder Python API 参考文档

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

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import discoveryengine_v1


def sample_get_schema():
    # Create a client
    client = discoveryengine_v1.SchemaServiceClient()

    # Initialize request argument(s)
    request = discoveryengine_v1.GetSchemaRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_schema(request=request)

    # Handle the response
    print(response)

Ruby

如需了解详情,请参阅 Vertex AI Agent Builder Ruby API 参考文档

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

require "google/cloud/discovery_engine/v1"

##
# Snippet for the get_schema call in the SchemaService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::DiscoveryEngine::V1::SchemaService::Client#get_schema.
#
def get_schema
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::DiscoveryEngine::V1::SchemaService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::DiscoveryEngine::V1::GetSchemaRequest.new

  # Call the get_schema method.
  result = client.get_schema request

  # The returned object is of type Google::Cloud::DiscoveryEngine::V1::Schema.
  p result
end

后续步骤