Skip to content

Overview: Knowledge Graph Training

This document outlines the complete process to train the Knowledge Graph with e-commerce data, covering:

  • Extracting structured data using WooCommerce APIs
  • Crawling supplemental web content
  • Uploading AI model configurations
  • Loading enriched product/category data into the Knowledge Graph

  1. Extract records from woocommerce

    1. Upload your WooCommerce store configuration file to:
      [POST]: /woocommerce-store/config.
      Click here to view sample file.

    2. Upload your post entity extraction config file to:
      [POST]: /woocommerce-store/entity/records/extract/config.
      Click here to view sample file.

    3. In this step we will extract entity(products, categories, posts) records from woocommerce store.
      Use the following API endpoint three times, once for each entity:
      [PUT]: /woocommerce-store/entity/records/extract.
      Each call requires the following parameters:

      • entity: Type of data to extract (products, categories, or posts)
      • key_fields:
        • For products: "id", "slug", "sku" - add all of this string as one by one.
        • For categories and posts: "id"
      • store_name: Always use "casters"
      • max_records: Always use 8000
  2. AI training configuration

    1. Upload your vector store configuration to:
      [POST]: /vector-store/config.
      Click here to view sample file.

    2. Upload your knowledge graph product attributes configurations.
      Use the following API endpoint two times, once for each sample file given:
      [POST]: /kg/config.
      Click here to view sample file 1.
      Click here to view sample file 2.

    3. Upload your ai-search configuration to:
      [POST]: /search/config.
      Click here to view sample file

  3. Load data to knowledge graph

    1. Load your e-commerce products and categories extracted from woocommerce apis to the knowledge graph using the endpoint:
      [PUT]: /kg/train.
      Use "casters" as value of the parameter "store_name".
  4. Now, you have done with the training process in kray ai model training, then go to the parse tree service.

  5. Natural Language Processing

    1. NER (Named Entity Recognition) training:
      [POST]: /train/ner.
      Use "casters" as value of the parameter "namespace".

    2. Train NER synonyms:
      [POST]: /ner/synonyms/many.
      Click here to view sample file.

    3. Verify Synonyms are trained properly:
      Go to the Kray ai model training interface and hit the search endpoint with the following configuration:

      • Use "casters" as value for the parameter "namespace".
      • And here is the sample request body for this endpoint with the alternate name for 'heavy duty casters' { "user_query": "heavy load casters", "user": "site-search", "limit": 10, "whitelabel_domain": "", "group": { "filter": "all", "sources": [ "string" ] } }

Now you are done with the Knowledge Graph Training 🎉.