הצגת הגדרת סכימה

אפשר לראות את הסכימה של כל מאגר נתונים שמכיל נתונים שתומכים בסכימה, כמו נתונים מובְנים, נתוני אתר עם נתונים מובְנים או נתונים לא מובְנים עם נתונים מובְנים.

אפשר לראות את הסכימה במסוף Google Cloud או באמצעות שיטת ה-API‏ dataStores.schemas.get. אפשר לראות את הסכימה של אתר רק דרך API בארכיטקטורת REST.

המסוף

כדי להציג סכימה במסוף Google Cloud , פועלים לפי השלבים הבאים.

  1. אם אתם צופים בסכימה שנוצרה אוטומטית, ודאו שהשלמתם את הטמעת הנתונים. אחרת, יכול להיות שהסכימה עדיין לא תהיה זמינה.

  2. נכנסים לדף AI Applications במסוף Google Cloud .

    אפליקציות AI

  3. בתפריט הניווט, לוחצים על מאגרי נתונים.

  4. בעמודה שם, לוחצים על מאגר הנתונים עם הסכימה שרוצים לראות.

  5. לוחצים על הכרטיסייה סכימה כדי לראות את הסכימה של הנתונים.

REST

כדי להשתמש ב-API כדי לקבל את ההגדרה של הסכימה, פועלים לפי השלבים הבאים:

  1. אם אתם צופים בסכימה שנוצרה אוטומטית, ודאו שהשלמתם את הטמעת הנתונים. אחרת, יכול להיות שהסכימה עדיין לא תהיה זמינה.

    כדי לראות את הסכימה של מאגרי נתונים עם אתרים או נתונים לא מובְנים עם מטא-נתונים, אפשר לדלג לשלב 3 כדי לקרוא למתודה schema.get.

  2. איך מוצאים את המזהה של מאגר הנתונים אם כבר יש לכם מזהה של מאגר נתונים, אפשר לדלג לשלב הבא.

    1. במסוף Google Cloud , עוברים לדף AI Applications ובתפריט הניווט לוחצים על Data Stores.

      מעבר לדף Data Stores

    2. לוחצים על השם של מאגר הנתונים.

    3. בדף Data של מאגר הנתונים, מעתיקים את המזהה של מאגר הנתונים.

  3. משתמשים ב-method ‏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: מזהה הפרויקט.
    • DATA_STORE_ID: המזהה של מאגר הנתונים.

C#

מידע נוסף מופיע בתיעוד העזר של ה-API של חיפוש מבוסס סוכנים C#.

כדי לבצע אימות ב-חיפוש מבוסס סוכנים, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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

מידע נוסף מופיע בתיעוד העזר של ה-API של חיפוש מבוסס סוכנים Go.

כדי לבצע אימות ב-חיפוש מבוסס סוכנים, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.


//go:build examples

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

מידע נוסף מופיע בתיעוד העזר של ה-API של חיפוש מבוסס סוכנים Java.

כדי לבצע אימות ב-חיפוש מבוסס סוכנים, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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

מידע נוסף מופיע בתיעוד העזר של ה-API של חיפוש מבוסס סוכנים Python.

כדי לבצע אימות ב-חיפוש מבוסס סוכנים, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

# 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

מידע נוסף מופיע בתיעוד העזר של ה-API של חיפוש מבוסס סוכנים Ruby.

כדי לבצע אימות ב-חיפוש מבוסס סוכנים, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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

המאמרים הבאים